Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
measured_variable.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2018 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 /*
17  * phenotype.h
18  *
19  * Created on: 11 Sep 2018
20  * Author: billy
21  */
22 
23 #ifndef SERVICES_FIELD_TRIALS_INCLUDE_MEASURED_VARIABLE_H_
24 #define SERVICES_FIELD_TRIALS_INCLUDE_MEASURED_VARIABLE_H_
25 
26 #include <time.h>
27 
30 #include "instrument.h"
31 #include "typedefs.h"
32 #include "jansson.h"
33 #include "schema_term.h"
34 #include "schema_keys.h"
35 #include "crop_ontology_tool.h"
36 
37 
38 
39 typedef struct MeasuredVariable
40 {
41  bson_oid_t *mv_id_p;
42 
44 
46 
48 
50 
52 
54 
55 
56 typedef struct MeasuredVariableNode
57 {
59 
61 
63 
64  char *mvn_id_s;
65 
67 
68 #ifndef DOXYGEN_SHOULD_SKIP_THIS
69 
70 #ifdef ALLOCATE_MEASURED_VARIABLE_TAGS
71  #define MEASURED_VARIABLE_PREFIX DFW_FIELD_TRIAL_SERVICE_LOCAL
72  #define MEASURED_VARIABLE_VAL(x) = x
73  #define MEASURED_VARIABLE_CONCAT_VAL(x,y) = x y
74 #else
75  #define MEASURED_VARIABLE_PREFIX extern
76  #define MEASURED_VARIABLE_VAL(x)
77  #define MEASURED_VARIABLE_CONCAT_VAL(x,y)
78 #endif
79 
80 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
81 
82 
83 MEASURED_VARIABLE_PREFIX const char *MV_TRAIT_S MEASURED_VARIABLE_VAL ("trait");
84 
85 MEASURED_VARIABLE_PREFIX const char *MV_MEASUREMENT_S MEASURED_VARIABLE_VAL ("measurement");
86 
87 MEASURED_VARIABLE_PREFIX const char *MV_UNIT_S MEASURED_VARIABLE_VAL ("unit");
88 
89 MEASURED_VARIABLE_PREFIX const char *MV_VARIABLE_S MEASURED_VARIABLE_VAL ("variable");
90 
91 MEASURED_VARIABLE_PREFIX const char *MV_FORM_S MEASURED_VARIABLE_VAL ("form");
92 
93 MEASURED_VARIABLE_PREFIX const char *MV_VALUE_S MEASURED_VARIABLE_VAL ("value");
94 
95 MEASURED_VARIABLE_PREFIX const char *MV_INTERNAL_NAME_S MEASURED_VARIABLE_VAL ("internal_name");
96 
97 MEASURED_VARIABLE_PREFIX const char *MV_SCALE_S MEASURED_VARIABLE_VAL ("scale");
98 
99 MEASURED_VARIABLE_PREFIX const char *MV_NAME_S MEASURED_VARIABLE_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "name");
100 
101 
102 #ifdef __cplusplus
103 extern "C"
104 {
105 #endif
106 
107 
108 DFW_FIELD_TRIAL_SERVICE_LOCAL MeasuredVariable *AllocateMeasuredVariable (bson_oid_t *id_p, SchemaTerm *trait_p, SchemaTerm *measurement_p, SchemaTerm *unit_p, SchemaTerm *variable_p, const ScaleClass *class_p);
109 
111 
113 
115 
117 
119 
121 
123 
124 DFW_FIELD_TRIAL_SERVICE_LOCAL MeasuredVariable *GetMeasuredVariableBySchemaURLs (const char *trait_url_s, const char *method_url_s, const char *unit_url_s, const FieldTrialServiceData *data_p);
125 
127 
129 
131 
133 
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 
141 
142 #endif /* SERVICES_FIELD_TRIALS_INCLUDE_MEASURED_VARIABLE_H_ */
crop_ontology_tool.h
instrument.h
MeasuredVariableNode::mvn_node
ListItem mvn_node
Definition: measured_variable.h:58
AllocateMeasuredVariable
MeasuredVariable * AllocateMeasuredVariable(bson_oid_t *id_p, SchemaTerm *trait_p, SchemaTerm *measurement_p, SchemaTerm *unit_p, SchemaTerm *variable_p, const ScaleClass *class_p)
SaveMeasuredVariable
OperationStatus SaveMeasuredVariable(MeasuredVariable *treatment_p, ServiceJob *job_p, const FieldTrialServiceData *data_p)
MEM_FLAG
MEM_FLAG
An enum specifying the particular status of a piece of dynamically allocated memory for a particular ...
Definition: memory_allocations.h:38
MeasuredVariable::mv_id_p
bson_oid_t * mv_id_p
Definition: measured_variable.h:41
MeasuredVariableNode::mvn_measured_variable_p
MeasuredVariable * mvn_measured_variable_p
Definition: measured_variable.h:60
ServiceJob
A datatype to represent a running task.
Definition: service_job.h:72
MeasuredVariable::mv_variable_term_p
SchemaTerm * mv_variable_term_p
Definition: measured_variable.h:43
GetMeasuredVariableByIdString
MeasuredVariable * GetMeasuredVariableByIdString(const char *id_s, const FieldTrialServiceData *data_p)
GetMeasuredVariableName
const char * GetMeasuredVariableName(const MeasuredVariable *mv_p)
GetMeasuredVariableBySchemaURLs
MeasuredVariable * GetMeasuredVariableBySchemaURLs(const char *trait_url_s, const char *method_url_s, const char *unit_url_s, const FieldTrialServiceData *data_p)
GetMeasuredVariableAsJSON
json_t * GetMeasuredVariableAsJSON(const MeasuredVariable *treatment_p, const ViewFormat format)
GetMeasuredVariableById
MeasuredVariable * GetMeasuredVariableById(const bson_oid_t *id_p, const FieldTrialServiceData *data_p)
FreeMeasuredVariableNode
void FreeMeasuredVariableNode(ListItem *node_p)
MeasuredVariableNode::mvn_id_s
char * mvn_id_s
Definition: measured_variable.h:64
dfw_field_trial_service_library.h
schema_keys.h
The keys for the Grassroots Schema.
MeasuredVariableNode
Definition: measured_variable.h:56
DFW_FIELD_TRIAL_SERVICE_LOCAL
#define DFW_FIELD_TRIAL_SERVICE_LOCAL
Definition: dfw_field_trial_service_library.h:43
CONTEXT_PREFIX_SCHEMA_ORG_S
#define CONTEXT_PREFIX_SCHEMA_ORG_S
Definition: schema_keys.h:103
MeasuredVariable
Definition: measured_variable.h:39
MEASURED_VARIABLE_CONCAT_VAL
const MEASURED_VARIABLE_PREFIX char *MV_NAME_S MEASURED_VARIABLE_CONCAT_VAL(CONTEXT_PREFIX_SCHEMA_ORG_S, "name")
GetMeasuredVariableScaleClass
const struct ScaleClass * GetMeasuredVariableScaleClass(const MeasuredVariable *const variable_p)
typedefs.h
FreeMeasuredVariable
void FreeMeasuredVariable(MeasuredVariable *treatment_p)
GetMeasuredVariableFromJSON
MeasuredVariable * GetMeasuredVariableFromJSON(const json_t *phenotype_json_p, const FieldTrialServiceData *data_p)
AllocateMeasuredVariableNode
MeasuredVariableNode * AllocateMeasuredVariableNode(MeasuredVariable *variable_p, MEM_FLAG mv_mem)
MeasuredVariable::mv_scale_class_p
const ScaleClass * mv_scale_class_p
Definition: measured_variable.h:51
MeasuredVariableNode::mvn_measured_variable_mem
MEM_FLAG mvn_measured_variable_mem
Definition: measured_variable.h:62
OperationStatus
OperationStatus
The current status of an Operation.
Definition: operation.h:96
GetMeasuredVariableByName
MeasuredVariable * GetMeasuredVariableByName(const char *const name_s, const FieldTrialServiceData *data_p)
MeasuredVariable::mv_unit_term_p
SchemaTerm * mv_unit_term_p
Definition: measured_variable.h:49
schema_term.h
MeasuredVariable::mv_measurement_term_p
SchemaTerm * mv_measurement_term_p
Definition: measured_variable.h:47
dfw_field_trial_service_data.h
MeasuredVariable::mv_trait_term_p
SchemaTerm * mv_trait_term_p
Definition: measured_variable.h:45
MEASURED_VARIABLE_VAL
const MEASURED_VARIABLE_PREFIX char *MV_TRAIT_S MEASURED_VARIABLE_VAL("trait")
GetMeasuredVariableURL
const char * GetMeasuredVariableURL(const MeasuredVariable *mv_p)
ScaleClass
Definition: dfw_field_trial_service_data.h:105
FieldTrialServiceData
The configuration data used by the DFW Field Trial Service.
Definition: dfw_field_trial_service_data.h:118
ViewFormat
ViewFormat
An indicator of what the output destination is for the JSON data values.
Definition: view_format.h:19
SchemaTerm
A datatype for specifying ontological terms as a way to describe the data that each of the Services c...
Definition: schema_term.h:38
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43