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.
time_observation.h
Go to the documentation of this file.
1 /*
2  * time_observation.h
3  *
4  * Created on: 7 Apr 2022
5  * Author: billy
6  */
7 
8 #ifndef SERVICES_FIELD_TRIALS_INCLUDE_TIME_OBSERVATION_H_
9 #define SERVICES_FIELD_TRIALS_INCLUDE_TIME_OBSERVATION_H_
10 
11 
12 #include "observation.h"
13 #include "typedefs.h"
14 
15 #include <time.h>
16 
17 typedef struct TimeObservation
18 {
20 
24  struct tm *to_raw_value_p;
25 
30 
31 
33 
34 
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
41 
42 
43 DFW_FIELD_TRIAL_SERVICE_LOCAL TimeObservation *AllocateTimeObservation (bson_oid_t *id_p, const struct tm *start_date_p, const struct tm *end_date_p, MeasuredVariable *phenotype_p, MEM_FLAG phenotype_mem, const struct tm *raw_value_p, const struct tm *corrected_value_p,
44  const char *growth_stage_s, const char *method_s, Instrument *instrument_p, const ObservationNature nature, const uint32 *index_p, const char *notes_s);
45 
46 
48 
49 
50 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetTimeObservationAsJSON (const TimeObservation *observation_p, const ViewFormat format);
51 
52 
54 
55 
56 
58 
59 
61 
62 
63 DFW_FIELD_TRIAL_SERVICE_LOCAL bool SetTimeObservationRawValueFromJSON (TimeObservation *observation_p, const json_t *value_p);
64 
65 
67 
68 
69 DFW_FIELD_TRIAL_SERVICE_LOCAL bool AddTimeObservationRawValueToJSON (const TimeObservation *obs_p, const char *key_s, json_t *json_p, const char *null_sequence_s, bool only_if_exists_flag);
70 
71 
72 DFW_FIELD_TRIAL_SERVICE_LOCAL bool AddTimeObservationCorrectedValueToJSON (const TimeObservation *obs_p, const char *key_s, json_t *json_p, const char *null_sequence_s, bool only_if_exists_flag);
73 
74 
75 DFW_FIELD_TRIAL_SERVICE_LOCAL bool AddTimeObservationValuesToJSON (const Observation *obs_p, const char *raw_key_s, const char *corrected_key_s, json_t *json_p, const char *null_sequence_s, bool only_if_exists_flag);
76 
77 
78 DFW_FIELD_TRIAL_SERVICE_LOCAL bool GetTimeObservationRawValueAsString (TimeObservation *observation_p, char **value_ss, bool *free_flag_p);
79 
80 
81 DFW_FIELD_TRIAL_SERVICE_LOCAL bool GetTimeObservationCorrectedValueAsString (TimeObservation *observation_p, char **value_ss, bool *free_flag_p);
82 
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 
89 
90 
91 #endif /* SERVICES_FIELD_TRIALS_INCLUDE_TIME_OBSERVATION_H_ */
TimeObservation::to_corrected_value_p
struct tm * to_corrected_value_p
The corrected phenotypic value for this Observation.
Definition: time_observation.h:29
Instrument
Definition: instrument.h:33
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
SetTimeObservationRawValueFromString
bool SetTimeObservationRawValueFromString(TimeObservation *observation_p, const char *value_s)
SetTimeObservationRawValueFromJSON
bool SetTimeObservationRawValueFromJSON(TimeObservation *observation_p, const json_t *value_p)
SetTimeObservationCorrectedValueFromString
bool SetTimeObservationCorrectedValueFromString(TimeObservation *observation_p, const char *value_s)
GetTimeObservationFromJSON
TimeObservation * GetTimeObservationFromJSON(const json_t *phenotype_json_p, FieldTrialServiceData *data_p)
DFW_FIELD_TRIAL_SERVICE_LOCAL
#define DFW_FIELD_TRIAL_SERVICE_LOCAL
Definition: dfw_field_trial_service_library.h:43
MeasuredVariable
Definition: measured_variable.h:39
typedefs.h
TimeObservation::to_raw_value_p
struct tm * to_raw_value_p
The raw phenotypic value for this Observation.
Definition: time_observation.h:24
AllocateTimeObservation
TimeObservation * AllocateTimeObservation(bson_oid_t *id_p, const struct tm *start_date_p, const struct tm *end_date_p, MeasuredVariable *phenotype_p, MEM_FLAG phenotype_mem, const struct tm *raw_value_p, const struct tm *corrected_value_p, const char *growth_stage_s, const char *method_s, Instrument *instrument_p, const ObservationNature nature, const uint32 *index_p, const char *notes_s)
AddTimeObservationCorrectedValueToJSON
bool AddTimeObservationCorrectedValueToJSON(const TimeObservation *obs_p, const char *key_s, json_t *json_p, const char *null_sequence_s, bool only_if_exists_flag)
TimeObservation
Definition: time_observation.h:17
GetTimeObservationCorrectedValueAsString
bool GetTimeObservationCorrectedValueAsString(TimeObservation *observation_p, char **value_ss, bool *free_flag_p)
ObservationNature
ObservationNature
Definition: observation.h:41
observation.h
ClearTimeObservation
void ClearTimeObservation(Observation *observation_p)
AddTimeObservationRawValueToJSON
bool AddTimeObservationRawValueToJSON(const TimeObservation *obs_p, const char *key_s, json_t *json_p, const char *null_sequence_s, bool only_if_exists_flag)
Observation
A datatype for storing a phneotypic observation within an experiment.
Definition: observation.h:63
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
AddTimeObservationValuesToJSON
bool AddTimeObservationValuesToJSON(const Observation *obs_p, const char *raw_key_s, const char *corrected_key_s, json_t *json_p, const char *null_sequence_s, bool only_if_exists_flag)
SetTimeObservationCorrectedValueFromJSON
bool SetTimeObservationCorrectedValueFromJSON(TimeObservation *observation_p, const json_t *value_p)
TimeObservation::to_base_observation
Observation to_base_observation
Definition: time_observation.h:19
GetTimeObservationRawValueAsString
bool GetTimeObservationRawValueAsString(TimeObservation *observation_p, char **value_ss, bool *free_flag_p)
GetTimeObservationAsJSON
json_t * GetTimeObservationAsJSON(const TimeObservation *observation_p, const ViewFormat format)