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.
study_jobs.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  * experimental_area_jobs.h
18  *
19  * Created on: 1 Oct 2018
20  * Author: billy
21  */
22 
23 #ifndef SERVICES_DFW_FIELD_TRIAL_SERVICE_INCLUDE_EXPERIMENTAL_AREA_JOBS_H_
24 #define SERVICES_DFW_FIELD_TRIAL_SERVICE_INCLUDE_EXPERIMENTAL_AREA_JOBS_H_
25 
26 
29 
30 #include "study.h"
31 #include "string_parameter.h"
32 
33 
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 
36 #ifdef ALLOCATE_STUDY_JOB_CONSTANTS
37  #define STUDY_JOB_PREFIX DFW_FIELD_TRIAL_SERVICE_API
38  #define STUDY_JOB_STRUCT_VAL(x,y) = { x, y}
39 #else
40  #define STUDY_JOB_PREFIX extern
41  #define STUDY_JOB_STRUCT_VAL(x,y)
42 #endif
43 
44 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
45 
46 /*
47  * Study parameters
48  */
49 STUDY_JOB_PREFIX NamedParameterType STUDY_ID STUDY_JOB_STRUCT_VAL("ST Id", PT_STRING);
50 
51 STUDY_JOB_PREFIX NamedParameterType STUDY_NAME STUDY_JOB_STRUCT_VAL("ST Name", PT_STRING);
52 
53 STUDY_JOB_PREFIX NamedParameterType STUDY_LINK STUDY_JOB_STRUCT_VAL("ST Link", PT_STRING);
54 
55 STUDY_JOB_PREFIX NamedParameterType STUDY_ASPECT STUDY_JOB_STRUCT_VAL("ST Field Aspect", PT_STRING);
56 STUDY_JOB_PREFIX NamedParameterType STUDY_SLOPE STUDY_JOB_STRUCT_VAL("ST Slope", PT_STRING);
57 
58 //STUDY_JOB_PREFIX NamedParameterType STUDY_GET_ALL_PLOTS STUDY_JOB_STRUCT_VAL("Get all Plots for Study", PT_BOOLEAN);
59 
60 STUDY_JOB_PREFIX NamedParameterType STUDY_DETAIL_LEVEL STUDY_JOB_STRUCT_VAL("The level of data to get for matching Studies", PT_STRING);
61 
62 STUDY_JOB_PREFIX NamedParameterType STUDY_ADD_STUDY STUDY_JOB_STRUCT_VAL("Add Study", PT_BOOLEAN);
63 
64 STUDY_JOB_PREFIX NamedParameterType STUDY_THIS_CROP STUDY_JOB_STRUCT_VAL("This Crop", PT_STRING);
65 STUDY_JOB_PREFIX NamedParameterType STUDY_PREVIOUS_CROP STUDY_JOB_STRUCT_VAL("Previous Crop", PT_STRING);
66 
67 
68 STUDY_JOB_PREFIX NamedParameterType STUDY_FIELD_TRIALS_LIST STUDY_JOB_STRUCT_VAL("Field Trials", PT_STRING);
69 STUDY_JOB_PREFIX NamedParameterType STUDY_LOCATIONS_LIST STUDY_JOB_STRUCT_VAL("Locations", PT_STRING);
70 
71 STUDY_JOB_PREFIX NamedParameterType STUDY_DESCRIPTION STUDY_JOB_STRUCT_VAL("ST Description", PT_LARGE_STRING);
72 
73 
74 STUDY_JOB_PREFIX NamedParameterType STUDY_DESIGN STUDY_JOB_STRUCT_VAL("ST Design", PT_LARGE_STRING);
75 STUDY_JOB_PREFIX NamedParameterType STUDY_GROWING_CONDITIONS STUDY_JOB_STRUCT_VAL("ST Growing Conditions", PT_LARGE_STRING);
76 STUDY_JOB_PREFIX NamedParameterType STUDY_PHENOTYPE_GATHERING_NOTES STUDY_JOB_STRUCT_VAL("ST Phenotype Gathering Notes", PT_LARGE_STRING);
77 
78 
79 STUDY_JOB_PREFIX NamedParameterType STUDY_PLAN_CHANGES STUDY_JOB_STRUCT_VAL("ST Plan Changes", PT_LARGE_STRING);
80 STUDY_JOB_PREFIX NamedParameterType STUDY_DATA_NOT_INCLUDED STUDY_JOB_STRUCT_VAL("ST Data not included", PT_LARGE_STRING);
81 STUDY_JOB_PREFIX NamedParameterType STUDY_PHYSICAL_SAMPLES_COLLECTED STUDY_JOB_STRUCT_VAL("ST Samples collected", PT_LARGE_STRING);
82 
83 
84 STUDY_JOB_PREFIX NamedParameterType STUDY_CURATOR_NAME STUDY_JOB_STRUCT_VAL("ST Curator name", PT_STRING);
85 STUDY_JOB_PREFIX NamedParameterType STUDY_CURATOR_EMAIL STUDY_JOB_STRUCT_VAL("ST Curator email", PT_STRING);
86 STUDY_JOB_PREFIX NamedParameterType STUDY_CURATOR_ROLE STUDY_JOB_STRUCT_VAL("ST Curator role", PT_STRING);
87 STUDY_JOB_PREFIX NamedParameterType STUDY_CURATOR_AFFILATION STUDY_JOB_STRUCT_VAL("ST Curator affiliation", PT_STRING);
88 STUDY_JOB_PREFIX NamedParameterType STUDY_CURATOR_ORCID STUDY_JOB_STRUCT_VAL("ST Curator orcid", PT_STRING);
89 
90 STUDY_JOB_PREFIX NamedParameterType STUDY_CONTACT_NAME STUDY_JOB_STRUCT_VAL("ST Contact name", PT_STRING);
91 STUDY_JOB_PREFIX NamedParameterType STUDY_CONTACT_EMAIL STUDY_JOB_STRUCT_VAL("ST Contact email", PT_STRING);
92 STUDY_JOB_PREFIX NamedParameterType STUDY_CONTACT_ROLE STUDY_JOB_STRUCT_VAL("ST Contact role", PT_STRING);
93 STUDY_JOB_PREFIX NamedParameterType STUDY_CONTACT_AFFILATION STUDY_JOB_STRUCT_VAL("ST Contact affiliation", PT_STRING);
94 STUDY_JOB_PREFIX NamedParameterType STUDY_CONTACT_ORCID STUDY_JOB_STRUCT_VAL("ST Contact orcid", PT_STRING);
95 
96 STUDY_JOB_PREFIX NamedParameterType STUDY_SEARCH_STUDIES STUDY_JOB_STRUCT_VAL("ST Search Studies", PT_BOOLEAN);
97 STUDY_JOB_PREFIX NamedParameterType STUDY_SOWING_YEAR STUDY_JOB_STRUCT_VAL("ST Sowing Year", PT_UNSIGNED_INT);
98 STUDY_JOB_PREFIX NamedParameterType STUDY_HARVEST_YEAR STUDY_JOB_STRUCT_VAL("ST Harvest Year", PT_UNSIGNED_INT);
99 
100 
101 STUDY_JOB_PREFIX NamedParameterType STUDY_WEATHER_LINK STUDY_JOB_STRUCT_VAL("ST Weather", PT_STRING);
102 
103 STUDY_JOB_PREFIX NamedParameterType STUDY_SHAPE_DATA STUDY_JOB_STRUCT_VAL("ST Shape Data", PT_JSON);
104 
105 STUDY_JOB_PREFIX NamedParameterType STUDY_SHAPE_NOTES STUDY_JOB_STRUCT_VAL("ST Shape Data Notes", PT_LARGE_STRING);
106 
107 
108 STUDY_JOB_PREFIX NamedParameterType STUDY_NUM_PLOT_ROWS STUDY_JOB_STRUCT_VAL("ST Num Rows", PT_UNSIGNED_INT);
109 STUDY_JOB_PREFIX NamedParameterType STUDY_NUM_PLOT_COLS STUDY_JOB_STRUCT_VAL("ST Num Columns", PT_UNSIGNED_INT);
110 STUDY_JOB_PREFIX NamedParameterType STUDY_NUM_REPLICATES STUDY_JOB_STRUCT_VAL("ST Num Replicates", PT_UNSIGNED_INT);
111 STUDY_JOB_PREFIX NamedParameterType STUDY_PLOT_WIDTH STUDY_JOB_STRUCT_VAL("ST Plot Width", PT_UNSIGNED_REAL);
112 STUDY_JOB_PREFIX NamedParameterType STUDY_PLOT_LENGTH STUDY_JOB_STRUCT_VAL("ST Plot Length", PT_UNSIGNED_REAL);
113 
114 STUDY_JOB_PREFIX NamedParameterType STUDY_PLOT_ROWS_PER_BLOCK STUDY_JOB_STRUCT_VAL("ST Rows Per Block", PT_UNSIGNED_INT);
115 STUDY_JOB_PREFIX NamedParameterType STUDY_PLOT_COLS_PER_BLOCK STUDY_JOB_STRUCT_VAL("ST Cols Per Block", PT_UNSIGNED_INT);
116 STUDY_JOB_PREFIX NamedParameterType STUDY_PLOT_HGAP STUDY_JOB_STRUCT_VAL("ST Plot Horizontal Gap", PT_UNSIGNED_REAL);
117 STUDY_JOB_PREFIX NamedParameterType STUDY_PLOT_VGAP STUDY_JOB_STRUCT_VAL("ST Plot Vertical Gap", PT_UNSIGNED_REAL);
118 STUDY_JOB_PREFIX NamedParameterType STUDY_PLOT_BLOCK_HGAP STUDY_JOB_STRUCT_VAL("ST Plot Block Horizontal Gap", PT_UNSIGNED_REAL);
119 STUDY_JOB_PREFIX NamedParameterType STUDY_PLOT_BLOCK_VGAP STUDY_JOB_STRUCT_VAL("ST Plot Block Vertical Gap", PT_UNSIGNED_REAL);
120 
121 STUDY_JOB_PREFIX NamedParameterType STUDY_PHOTO STUDY_JOB_STRUCT_VAL("Photo", PT_STRING);
122 STUDY_JOB_PREFIX NamedParameterType STUDY_IMAGE_NOTES STUDY_JOB_STRUCT_VAL("ST Image Notes", PT_LARGE_STRING);
123 
124 
125 STUDY_JOB_PREFIX NamedParameterType STUDY_MEASURED_VARIABLES STUDY_JOB_STRUCT_VAL("ST Measured Variables", PT_STRING);
126 
127 
128 /* forward declarations */
129 struct TreatmentFactor;
130 
131 
132 
133 #ifdef __cplusplus
134 extern "C"
135 {
136 #endif
137 
138 
139 
141 
142 
144 
145 
147 
148 
150 
151 
153 
154 
156 
157 
159 
160 
161 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetAllStudiesAsJSON (const FieldTrialServiceData *data_p, bool full_data_flag);
162 
163 
164 DFW_FIELD_TRIAL_SERVICE_LOCAL bool SetUpStudiesListParameter (const FieldTrialServiceData *data_p, Parameter *param_p, const Study *active_study_p, const bool empty_option_flag);
165 
166 
167 DFW_FIELD_TRIAL_SERVICE_LOCAL bool AddStudyToServiceJob (ServiceJob *job_p, Study *study_p, const ViewFormat format, JSONProcessor *processor_p, FieldTrialServiceData *data_p);
168 
169 
171 
172 
173 DFW_FIELD_TRIAL_SERVICE_LOCAL const KeyValuePair *GetAspect (const char *aspect_value_s);
174 
175 
177 
178 
180 
181 
182 DFW_FIELD_TRIAL_SERVICE_LOCAL void FindAndAddStudyToServiceJob (const char *id_s, const ViewFormat format, ServiceJob *job_p, JSONProcessor *processor_p, const FieldTrialServiceData *data_p);
183 
184 
185 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetStudyJSONForId (const char *id_s, const ViewFormat format, JSONProcessor *processor_p, char **study_name_ss, const FieldTrialServiceData *data_p);
186 
187 
188 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetStudyDistinctPhenotypesAsJSON (bson_oid_t *study_id_p, const FieldTrialServiceData *data_p);
189 
190 
191 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetStudyDistinctAccessionsAsJSON (bson_oid_t *study_id_p, const FieldTrialServiceData *data_p);
192 
193 
195 
196 
198 
199 
200 DFW_FIELD_TRIAL_SERVICE_LOCAL struct TreatmentFactor *GetOrCreateTreatmentFactorForStudy (Study *study_p, const bson_oid_t *treatment_id_p, const FieldTrialServiceData *data_p);
201 
202 
203 DFW_FIELD_TRIAL_SERVICE_LOCAL struct TreatmentFactor *GetTreatmentFactorForStudy (Study *study_p, const bson_oid_t *treatment_id_p, const FieldTrialServiceData *data_p);
204 
205 
206 DFW_FIELD_TRIAL_SERVICE_LOCAL struct TreatmentFactor *GetTreatmentFactorForStudyByUrl (const Study *study_p, const char *treatment_url_s, const FieldTrialServiceData *data_p);
207 
208 
210 
211 
213 
214 
215 
216 
218 
219 
221 
222 
224 
225 
227 
228 
230 
231 
232 DFW_FIELD_TRIAL_SERVICE_LOCAL bool BackupStudy (Study *study_p, const char *id_s, FieldTrialServiceData *data_p);
233 
234 
235 DFW_FIELD_TRIAL_SERVICE_LOCAL OperationStatus DeleteStudyById (const char *id_s, ServiceJob *job_p, FieldTrialServiceData *data_p, const bool backup_flag);
236 
237 
239 
240 
242 
243 #ifdef __cplusplus
244 }
245 #endif
246 
247 
248 #endif /* SERVICES_DFW_FIELD_TRIAL_SERVICE_INCLUDE_EXPERIMENTAL_AREA_JOBS_H_ */
GenerateStatisticsForStudy
OperationStatus GenerateStatisticsForStudy(Study *study_p, ServiceJob *job_p, FieldTrialServiceData *data_p)
Parameter
The datatype that stores all of the information about a Parameter.
Definition: parameter.h:121
PT_JSON
A JSON fragment.
Definition: parameter_type.h:95
RunForSubmissionStudyParams
bool RunForSubmissionStudyParams(FieldTrialServiceData *data_p, ParameterSet *param_set_p, ServiceJob *job_p)
GetAllStudiesAsJSON
json_t * GetAllStudiesAsJSON(const FieldTrialServiceData *data_p, bool full_data_flag)
RemovePlotsForStudyById
OperationStatus RemovePlotsForStudyById(const char *id_s, FieldTrialServiceData *data_p)
GetStudyDistinctPhenotypesAsJSON
json_t * GetStudyDistinctPhenotypesAsJSON(bson_oid_t *study_id_p, const FieldTrialServiceData *data_p)
GetTreatmentFactorForStudyByUrl
struct TreatmentFactor * GetTreatmentFactorForStudyByUrl(const Study *study_p, const char *treatment_url_s, const FieldTrialServiceData *data_p)
NamedParameterType
This is a datatype that stores a read-only c-style string along with a ParameterType.
Definition: parameter.h:85
GetOrCreateTreatmentFactorForStudy
struct TreatmentFactor * GetOrCreateTreatmentFactorForStudy(Study *study_p, const bson_oid_t *treatment_id_p, const FieldTrialServiceData *data_p)
ParameterType
ParameterType
The different types that a Parameter can take.
Definition: parameter_type.h:35
study.h
ServiceJob
A datatype to represent a running task.
Definition: service_job.h:72
GetStudyJSONForId
json_t * GetStudyJSONForId(const char *id_s, const ViewFormat format, JSONProcessor *processor_p, char **study_name_ss, const FieldTrialServiceData *data_p)
PT_STRING
A c-style string.
Definition: parameter_type.h:58
GetTreatmentFactorForStudy
struct TreatmentFactor * GetTreatmentFactorForStudy(Study *study_p, const bson_oid_t *treatment_id_p, const FieldTrialServiceData *data_p)
DataResource
A datatype representing a URI.
Definition: data_resource.h:40
JSONProcessor
Definition: json_processor.h:21
PT_LARGE_STRING
A potentially large c-style string.
Definition: parameter_type.h:90
AddStudyToServiceJob
bool AddStudyToServiceJob(ServiceJob *job_p, Study *study_p, const ViewFormat format, JSONProcessor *processor_p, FieldTrialServiceData *data_p)
TreatmentFactor
A TreatmentFactor is a set of values for a Treatment applied to plots within a Study.
Definition: treatment_factor.h:76
GenerateStatisticsForAllStudies
OperationStatus GenerateStatisticsForAllStudies(ServiceJob *job_p, FieldTrialServiceData *data_p)
GetAllStudiesAsJSONInViewFormat
json_t * GetAllStudiesAsJSONInViewFormat(FieldTrialServiceData *data_p, const ViewFormat format)
GetAllStudyIds
json_t * GetAllStudyIds(Service *service_p)
dfw_field_trial_service_library.h
GetStudyAsString
char * GetStudyAsString(const Study *study_p)
SaveStudyAsFrictionlessData
bool SaveStudyAsFrictionlessData(Study *study_p, FieldTrialServiceData *data_p)
DFW_FIELD_TRIAL_SERVICE_LOCAL
#define DFW_FIELD_TRIAL_SERVICE_LOCAL
Definition: dfw_field_trial_service_library.h:43
GetSearchStudyParameterTypeForNamedParameter
bool GetSearchStudyParameterTypeForNamedParameter(const char *param_name_s, ParameterType *pt_p)
Service
A datatype which defines an available service, its capabilities and its parameters.
Definition: service.h:153
KeyValuePair
A pair of strings.
Definition: key_value_pair.h:42
GetStudyFromResource
Study * GetStudyFromResource(DataResource *resource_p, const NamedParameterType study_param_type, FieldTrialServiceData *dfw_data_p)
AddSearchStudyParams
bool AddSearchStudyParams(ServiceData *data_p, ParameterSet *param_set_p)
PT_UNSIGNED_REAL
An unsigned real number.
Definition: parameter_type.h:55
STUDY_JOB_STRUCT_VAL
STUDY_JOB_PREFIX NamedParameterType STUDY_ID STUDY_JOB_STRUCT_VAL("ST Id", PT_STRING)
PT_BOOLEAN
A boolean parameter.
Definition: parameter_type.h:38
DeleteStudyFromLuceneIndexById
OperationStatus DeleteStudyFromLuceneIndexById(const char *id_s, uuid_t uuid, FieldTrialServiceData *data_p)
GetStudyDistinctPhenotypesAsFrictionlessDataJSON
json_t * GetStudyDistinctPhenotypesAsFrictionlessDataJSON(bson_oid_t *study_id_p, const FieldTrialServiceData *data_p)
DeleteStudyById
OperationStatus DeleteStudyById(const char *id_s, ServiceJob *job_p, FieldTrialServiceData *data_p, const bool backup_flag)
GetStudyDistinctAccessionsAsJSON
json_t * GetStudyDistinctAccessionsAsJSON(bson_oid_t *study_id_p, const FieldTrialServiceData *data_p)
OperationStatus
OperationStatus
The current status of an Operation.
Definition: operation.h:96
GetStudyAsFrictionlessDataResource
json_t * GetStudyAsFrictionlessDataResource(const Study *study_p, const FieldTrialServiceData *data_p)
RunForSearchStudyParams
bool RunForSearchStudyParams(FieldTrialServiceData *data_p, ParameterSet *param_set_p, ServiceJob *job_p)
dfw_field_trial_service_data.h
GetSubmissionStudyParameterTypeForNamedParameter
bool GetSubmissionStudyParameterTypeForNamedParameter(const char *param_name_s, ParameterType *pt_p)
RemoveStudyPhenotypesFromStudyById
OperationStatus RemoveStudyPhenotypesFromStudyById(const char *id_s, FieldTrialServiceData *data_p)
BackupStudy
bool BackupStudy(Study *study_p, const char *id_s, FieldTrialServiceData *data_p)
CalculateStudyStatistics
OperationStatus CalculateStudyStatistics(Study *study_p, const FieldTrialServiceData *service_data_p)
FindAndAddStudyToServiceJob
void FindAndAddStudyToServiceJob(const char *id_s, const ViewFormat format, ServiceJob *job_p, JSONProcessor *processor_p, const FieldTrialServiceData *data_p)
ServiceData
A datatype for holding the configuration data for a Service.
Definition: service.h:126
AddSubmissionStudyParams
bool AddSubmissionStudyParams(ServiceData *data_p, ParameterSet *param_set_p, DataResource *resource_p)
FieldTrialServiceData
The configuration data used by the DFW Field Trial Service.
Definition: dfw_field_trial_service_data.h:118
SetUpStudiesListParameter
bool SetUpStudiesListParameter(const FieldTrialServiceData *data_p, Parameter *param_p, const Study *active_study_p, const bool empty_option_flag)
ViewFormat
ViewFormat
An indicator of what the output destination is for the JSON data values.
Definition: view_format.h:19
ParameterSet
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
BackupStudyByIdString
bool BackupStudyByIdString(const char *id_s, FieldTrialServiceData *data_p)
GetSubmissionStudyParameterTypeForDefaultPlotNamedParameter
bool GetSubmissionStudyParameterTypeForDefaultPlotNamedParameter(const char *param_name_s, ParameterType *pt_p)
string_parameter.h
Study
Definition: study.h:182
GetAspect
const KeyValuePair * GetAspect(const char *aspect_value_s)
PT_UNSIGNED_INT
A non-negative 32-bit integer.
Definition: parameter_type.h:44
uuid_t
Definition: windows_uuid.h:43