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.
material.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  * material.h
18  *
19  * Created on: 11 Sep 2018
20  * Author: billy
21  */
22 
23 #ifndef SERVICES_FIELD_TRIALS_INCLUDE_MATERIAL_H_
24 #define SERVICES_FIELD_TRIALS_INCLUDE_MATERIAL_H_
25 
26 
27 
28 
29 
32 #include "jansson.h"
33 #include "typedefs.h"
34 #include "study.h"
35 #include "gene_bank.h"
36 
37 /*
38  *
39  * Species name
40  * Germplasm ID
41  * Type of Material
42  * Reason for selection
43  * Generation
44  * Seed Supplier
45  * Source of Seed
46  * Germplasm Origin
47  * In GRU?
48  * GRU Accession
49  * TGW
50  * Seed Treatment
51  * Cleaned
52  keyword list F2, F3 etc Organisation Trial or Organisation Organisation Y/N ID Number Treatment Y/N
53 Triticum aestivum BT1604 Synthetic Derived yield, drought tolerance Rothamsted 17/18 Trial NIAB
54 Triticum aestivum Skyfall Elite control RAGT Commercial RAGT 150 Azole fungicide X
55 
56  *
57  */
58 
59 
60 typedef struct MaterialStudyDetails
61 {
63 
65 
67 
68  char *ma_type_s;
69 
71 
73 
75 
77 
79 
81 
82  uint32 ma_tgw;
83 
85 
87 
92 
93 
98 
103 
108 
109 
111 
112 
114 {
116 
119 
120 
121 typedef struct Material
122 {
123  bson_oid_t *ma_id_p;
124 
125  bson_oid_t *ma_gene_bank_id_p;
126 
128 
129 } Material;
130 
131 
132 
133 
134 
135 #ifndef DOXYGEN_SHOULD_SKIP_THIS
136 
137 #ifdef ALLOCATE_MATERIAL_TAGS
138  #define MATERIAL_PREFIX DFW_FIELD_TRIAL_SERVICE_LOCAL
139  #define MATERIAL_VAL(x) = x
140  #define MATERIAL_CONCAT_VAL(x,y) = x y
141 #else
142  #define MATERIAL_PREFIX extern
143  #define MATERIAL_VAL(x)
144  #define MATERIAL_CONCAT_VAL(x,y)
145 #endif
146 
147 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
148 
149 
150 
151 MATERIAL_PREFIX const char *MA_ID_S MATERIAL_VAL ("id");
152 
153 MATERIAL_PREFIX const char *MA_ACCESSION_S MATERIAL_VAL ("accession");
154 
155 MATERIAL_PREFIX const char *MA_BARCODE_S MATERIAL_VAL ("barcode");
156 
157 MATERIAL_PREFIX const char *MA_PEDIGREE_S MATERIAL_VAL ("pedigree");
158 
159 MATERIAL_PREFIX const char *MA_GENE_BANK_ID_S MATERIAL_VAL ("gene_bank_id");
160 
161 MATERIAL_PREFIX const char *MA_GENE_BANK_S MATERIAL_VAL ("gene_bank");
162 
163 MATERIAL_PREFIX const char *MA_EXPERIMENTAL_AREA_ID_S MATERIAL_VAL ("area_id");
164 
165 MATERIAL_PREFIX const char *MA_GERMPLASM_ID_S MATERIAL_VAL ("germplasm_id");
166 
167 
168 
169 
170 MATERIAL_PREFIX const char *MA_SPECIES_S MATERIAL_VAL ("http://purl.obolibrary.org/obo/NCIT_C45293");
171 
172 MATERIAL_PREFIX const char *MA_TYPE_S MATERIAL_VAL ("type");
173 MATERIAL_PREFIX const char *MA_SELECTION_REASON_S MATERIAL_VAL ("selection_reason");
174 MATERIAL_PREFIX const char *MA_GENERATION_S MATERIAL_VAL ("generation");
175 MATERIAL_PREFIX const char *MA_SEED_SUPPLIER_S MATERIAL_VAL ("seed_supplier");
176 MATERIAL_PREFIX const char *MA_SEED_SOURCE_S MATERIAL_VAL ("seed_source");
177 MATERIAL_PREFIX const char *MA_GERMPLASM_ORIGIN_S MATERIAL_VAL ("germplasm_origin");
178 MATERIAL_PREFIX const char *MA_IN_GRU_S MATERIAL_VAL ("in_gru");
179 MATERIAL_PREFIX const char *MA_TGW_S MATERIAL_VAL ("tgw");
180 MATERIAL_PREFIX const char *MA_SEED_TREATMENT_S MATERIAL_VAL ("seed_treatment");
181 
182 MATERIAL_PREFIX const char *MA_PRIMARY_NAME_S MATERIAL_VAL("primary_name");
183 MATERIAL_PREFIX const char *MA_SECONDARY_NAME_S MATERIAL_VAL("secondary_name");
184 MATERIAL_PREFIX const char *MA_TERTIARY_NAME_S MATERIAL_VAL("tertiary_name");
185 MATERIAL_PREFIX const char *MA_STODE_CODE_S MATERIAL_VAL("store_code");
186 
187 MATERIAL_PREFIX const char *MA_CLEANED_NAME_S MATERIAL_VAL ("cleaned");
188 
189 
190 
191 
192 #ifdef __cplusplus
193 extern "C"
194 {
195 #endif
196 
197 
198 DFW_FIELD_TRIAL_SERVICE_LOCAL Material *AllocateMaterial (bson_oid_t *id_p, const char *accession_s, const char *species_s, const char *type_s, const char *selection_reason_s, const char *generation_s, const char *supplier_s, const char *source_s, const char *germplasm_origin_s, const char *treatment_s, bool gru_flag, bool cleaned_flag, uint32 tgw, const Study *area_p, const bson_oid_t *gene_bank_id_p, const FieldTrialServiceData *data_p);
199 
200 
201 DFW_FIELD_TRIAL_SERVICE_LOCAL Material *AllocateMaterialByGermplasmID (bson_oid_t *id_p, const char *germplasm_id_s, const Study *area_p, const FieldTrialServiceData *data_p);
202 
203 
204 DFW_FIELD_TRIAL_SERVICE_LOCAL Material *AllocateMaterialByAccession (bson_oid_t *id_p, const char *accession_s, bson_oid_t *gene_bank_id_p, const FieldTrialServiceData *data_p);
205 
206 
207 
208 DFW_FIELD_TRIAL_SERVICE_LOCAL bool SetMaterialAccession (Material *material_p, const char * const accession_s);
209 
210 /*
211 DFW_FIELD_TRIAL_SERVICE_LOCAL bool SetMaterialPedigree (Material *material_p, const char * const pedigree_s);
212 
213 DFW_FIELD_TRIAL_SERVICE_LOCAL bool SetMaterialBarcode (Material *material_p, const char * const barcode_s);
214 
215 DFW_FIELD_TRIAL_SERVICE_LOCAL bool SetMaterialInternalName (Material *material_p, const char * const internal_name_s);
216 */
217 
219 
220 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetMaterialAsJSON (const Material *material_p, const ViewFormat format, const FieldTrialServiceData *data_p);
221 
222 DFW_FIELD_TRIAL_SERVICE_LOCAL Material *GetMaterialFromJSON (const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p);
223 
224 
226 
228 
229 
231 
232 DFW_FIELD_TRIAL_SERVICE_LOCAL Material *GetOrCreateMaterialByAccession (const char *accession_s, GeneBank *gene_bank_p, const FieldTrialServiceData *data_p);
233 
234 
235 DFW_FIELD_TRIAL_SERVICE_LOCAL Material *GetMaterialByGermplasmID (const char *material_s, Study *area_p, const FieldTrialServiceData *data_p);
236 
237 DFW_FIELD_TRIAL_SERVICE_LOCAL Material *GetMaterialById (const bson_oid_t *material_id_p, const FieldTrialServiceData *data_p);
238 
239 
240 DFW_FIELD_TRIAL_SERVICE_LOCAL Material *GetMaterialByAccession (const char *accession_s, GeneBank *gene_bank_p, const bool case_sensitive_flag, const FieldTrialServiceData *data_p);
241 
242 
243 DFW_FIELD_TRIAL_SERVICE_LOCAL bool IsMaterialComplete (const Material * const material_p);
244 
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 
251 #endif /* SERVICES_FIELD_TRIALS_INCLUDE_MATERIAL_H_ */
AllocateMaterialByGermplasmID
Material * AllocateMaterialByGermplasmID(bson_oid_t *id_p, const char *germplasm_id_s, const Study *area_p, const FieldTrialServiceData *data_p)
study.h
MaterialStudyDetails::ma_species_name_s
char * ma_species_name_s
Definition: material.h:66
MaterialStudyDetailsNode::msdn_node
ListItem msdn_node
Definition: material.h:115
Material::ma_id_p
bson_oid_t * ma_id_p
Definition: material.h:123
MaterialStudyDetails::ma_parent_area_p
const Study * ma_parent_area_p
Definition: material.h:64
MaterialStudyDetails::ma_germplasm_origin_s
char * ma_germplasm_origin_s
Definition: material.h:78
GetOrCreateMaterialByInternalName
Material * GetOrCreateMaterialByInternalName(const char *material_s, Study *area_p, const FieldTrialServiceData *data_p)
GetMaterialByAccession
Material * GetMaterialByAccession(const char *accession_s, GeneBank *gene_bank_p, const bool case_sensitive_flag, const FieldTrialServiceData *data_p)
SaveMaterial
bool SaveMaterial(Material *material_p, const FieldTrialServiceData *data_p)
MaterialStudyDetails
Definition: material.h:60
LoadMaterial
Material * LoadMaterial(const int32 material_id, FieldTrialServiceData *data_p)
MaterialStudyDetails::ma_seed_source_s
char * ma_seed_source_s
Definition: material.h:76
SetMaterialAccession
bool SetMaterialAccession(Material *material_p, const char *const accession_s)
MaterialStudyDetails::ma_secondary_name_s
char * ma_secondary_name_s
Optional simpler code for a toolkit line.
Definition: material.h:97
MaterialStudyDetails::ma_in_gru_flag
bool ma_in_gru_flag
Definition: material.h:80
GetOrCreateMaterialByAccession
Material * GetOrCreateMaterialByAccession(const char *accession_s, GeneBank *gene_bank_p, const FieldTrialServiceData *data_p)
Material::ma_accession_s
char * ma_accession_s
Definition: material.h:127
Material
Definition: material.h:121
GetMaterialByGermplasmID
Material * GetMaterialByGermplasmID(const char *material_s, Study *area_p, const FieldTrialServiceData *data_p)
dfw_field_trial_service_library.h
MaterialStudyDetailsNode::msdn_details_p
MaterialStudyDetails * msdn_details_p
Definition: material.h:117
MaterialStudyDetails::ma_tertiary_name_s
char * ma_tertiary_name_s
Optional Breeders Toolkit Number if the line is selected for the toolkit.
Definition: material.h:102
DFW_FIELD_TRIAL_SERVICE_LOCAL
#define DFW_FIELD_TRIAL_SERVICE_LOCAL
Definition: dfw_field_trial_service_library.h:43
typedefs.h
Material::ma_gene_bank_id_p
bson_oid_t * ma_gene_bank_id_p
Definition: material.h:125
MaterialStudyDetails::ma_type_s
char * ma_type_s
Definition: material.h:68
gene_bank.h
MaterialStudyDetails::ma_germplasm_id_s
char * ma_germplasm_id_s
Definition: material.h:62
AllocateMaterialByAccession
Material * AllocateMaterialByAccession(bson_oid_t *id_p, const char *accession_s, bson_oid_t *gene_bank_id_p, const FieldTrialServiceData *data_p)
IsMaterialComplete
bool IsMaterialComplete(const Material *const material_p)
MaterialStudyDetails::ma_cleaned_flag
bool ma_cleaned_flag
Definition: material.h:86
MaterialStudyDetails::ma_store_code_s
char * ma_store_code_s
Store code from the GRU.
Definition: material.h:107
GeneBank
Definition: gene_bank.h:34
GetMaterialFromJSON
Material * GetMaterialFromJSON(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p)
dfw_field_trial_service_data.h
MaterialStudyDetails::ma_primary_name_s
char * ma_primary_name_s
Optional full name of a toolkit line.
Definition: material.h:91
FreeMaterial
void FreeMaterial(Material *material_p)
AllocateMaterial
Material * AllocateMaterial(bson_oid_t *id_p, const char *accession_s, const char *species_s, const char *type_s, const char *selection_reason_s, const char *generation_s, const char *supplier_s, const char *source_s, const char *germplasm_origin_s, const char *treatment_s, bool gru_flag, bool cleaned_flag, uint32 tgw, const Study *area_p, const bson_oid_t *gene_bank_id_p, const FieldTrialServiceData *data_p)
MaterialStudyDetails::ma_selection_reason_s
char * ma_selection_reason_s
Definition: material.h:70
MaterialStudyDetails::ma_seed_supplier_s
char * ma_seed_supplier_s
Definition: material.h:74
MATERIAL_VAL
const MATERIAL_PREFIX char *MA_ID_S MATERIAL_VAL("id")
MaterialStudyDetailsNode
Definition: material.h:113
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
MaterialStudyDetails::ma_tgw
uint32 ma_tgw
Definition: material.h:82
GetMaterialById
Material * GetMaterialById(const bson_oid_t *material_id_p, const FieldTrialServiceData *data_p)
Study
Definition: study.h:182
MaterialStudyDetails::ma_seed_treatment_s
char * ma_seed_treatment_s
Definition: material.h:84
GetMaterialAsJSON
json_t * GetMaterialAsJSON(const Material *material_p, const ViewFormat format, const FieldTrialServiceData *data_p)
MaterialStudyDetails::ma_generation_s
char * ma_generation_s
Definition: material.h:72
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43