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.
observation.h File Reference
Include dependency graph for observation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Observation
 A datatype for storing a phneotypic observation within an experiment. More...
 
struct  ObservationNode
 

Enumerations

enum  ObservationType {
  OT_NUMERIC, OT_STRING, OT_INTEGER, OT_TIME,
  OT_NUM_TYPES
}
 
enum  ObservationNature { ON_UNSET = -1, ON_ROW, ON_EXPERIMENTAL_AREA, ON_NUM_PHENOTYPE_NATURES }
 
enum  ObservationValueType { OVT_RAW_VALUE, OVT_CORRECTED_VALUE }
 

Functions

const OBSERVATION_PREFIX char *OB_PHENOTYPE_S OBSERVATION_VAL ("phenotype")
 
const OBSERVATION_PREFIX char *OB_PHENOTYPE_ID_S OBSERVATION_VAL ("phenotype_id")
 
const OBSERVATION_PREFIX char *OB_START_DATE_S OBSERVATION_VAL ("date")
 
const OBSERVATION_PREFIX char *OB_END_DATE_S OBSERVATION_VAL ("end_date")
 
const OBSERVATION_PREFIX char *OB_RAW_VALUE_S OBSERVATION_VAL ("raw_value")
 
const OBSERVATION_PREFIX char *OB_INSTRUMENT_ID_S OBSERVATION_VAL ("instrument_id")
 
const OBSERVATION_PREFIX char *OB_INSTRUMENT_S OBSERVATION_VAL ("instrument")
 
const OBSERVATION_PREFIX char *OB_GROWTH_STAGE_S OBSERVATION_VAL ("growth_stage")
 
const OBSERVATION_PREFIX char *OB_CORRECTED_VALUE_S OBSERVATION_VAL ("corrected_value")
 
const OBSERVATION_PREFIX char *OB_METHOD_S OBSERVATION_VAL ("method")
 
const OBSERVATION_PREFIX char *OB_NATURE_S OBSERVATION_VAL ("nature")
 
const OBSERVATION_PREFIX char *OB_INDEX_S OBSERVATION_VAL ("index")
 
const OBSERVATION_PREFIX char *OB_TYPE_S OBSERVATION_VAL ("value_type")
 
const OBSERVATION_PREFIX char *OB_NOTES_S OBSERVATION_VAL ("notes")
 
const OBSERVATION_PREFIX uint32 OB_DEFAULT_INDEX OBSERVATION_VAL (1)
 
ObservationAllocateObservation (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 json_t *raw_value_p, const json_t *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, const ObservationType obs_type)
 
ObservationAllocateObservationWithErrorHandler (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 json_t *raw_value_p, const json_t *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, const ObservationType obs_type, void(*on_error_callback_fn)(ServiceJob *job_p, const char *const observation_field_s, const void *value_p, void *user_data_p), ServiceJob *job_p, void *user_data_p)
 
bool InitObservation (Observation *observation_p, 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 char *growth_stage_s, const char *method_s, Instrument *instrument_p, const ObservationNature nature, const uint32 *index_p, const char *notes_s, const ObservationType obs_type, void(*clear_fn)(Observation *observation_p), bool(*add_values_to_json_fn)(const struct 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), bool(*set_value_from_json_fn)(struct Observation *observation_p, ObservationValueType ovt, const json_t *value_p), bool(*set_value_from_string_fn)(struct Observation *observation_p, ObservationValueType ovt, const char *value_s), bool(*get_value_as_string_fn)(struct Observation *observation_p, ObservationValueType ovt, char **value_ss, bool *free_value_flag_p))
 
void FreeObservation (Observation *observation_p)
 Free an Observation. More...
 
void ClearObservation (Observation *observation_p)
 Clear the data stored within an Observation. More...
 
ObservationNodeAllocateObservationNode (Observation *observation_p)
 Allocate an ObservationNode for a given Observation. More...
 
void FreeObservationNode (ListItem *node_p)
 Free an ObservationNode. More...
 
json_t * GetObservationAsJSON (const Observation *observation_p, const ViewFormat format)
 
ObservationGetObservationFromJSON (const json_t *phenotype_json_p, FieldTrialServiceData *data_p)
 
bool SaveObservation (Observation *observation_p, const FieldTrialServiceData *data_p)
 
bool AreObservationsMatching (const Observation *observation_0_p, const Observation *observation_1_p)
 Test whether two Observations are the same in terms of phenotypes, dates and observation indexes. More...
 
bool AreObservationsMatchingByParts (const Observation *observation_p, const MeasuredVariable *variable_p, const struct tm *start_date_p, const struct tm *end_date_p, const uint32 *index_p)
 
const char * GetObservationTypeAsString (const ObservationType obs_type)
 
bool DetermineObservationTypeFromString (const char *const obs_type_s, ObservationType *obs_type_p)
 
bool SetObservationRawValueFromString (Observation *observation_p, const char *const value_s)
 
bool SetObservationCorrectedValueFromString (Observation *observation_p, const char *const value_s)
 
bool SetObservationRawValueFromJSON (Observation *observation_p, const json_t *value_p)
 
bool SetObservationCorrectedValueFromJSON (Observation *observation_p, const json_t *value_p)
 
bool AddObservationValuesToFrictionlessData (Observation *obs_p, json_t *fd_json_p)
 
ObservationType GetObservationTypeForScaleClass (const ScaleClass *class_p)
 

Enumeration Type Documentation

◆ ObservationType

Enumerator
OT_NUMERIC 
OT_STRING 
OT_INTEGER 
OT_TIME 
OT_NUM_TYPES 

◆ ObservationNature

Enumerator
ON_UNSET 
ON_ROW 
ON_EXPERIMENTAL_AREA 
ON_NUM_PHENOTYPE_NATURES 

◆ ObservationValueType

Enumerator
OVT_RAW_VALUE 
OVT_CORRECTED_VALUE 

Function Documentation

◆ OBSERVATION_VAL() [1/15]

const OBSERVATION_PREFIX char* OB_PHENOTYPE_S OBSERVATION_VAL ( "phenotype"  )

◆ OBSERVATION_VAL() [2/15]

const OBSERVATION_PREFIX char* OB_PHENOTYPE_ID_S OBSERVATION_VAL ( "phenotype_id"  )

◆ OBSERVATION_VAL() [3/15]

const OBSERVATION_PREFIX char* OB_START_DATE_S OBSERVATION_VAL ( "date"  )

◆ OBSERVATION_VAL() [4/15]

const OBSERVATION_PREFIX char* OB_END_DATE_S OBSERVATION_VAL ( "end_date"  )

◆ OBSERVATION_VAL() [5/15]

const OBSERVATION_PREFIX char* OB_RAW_VALUE_S OBSERVATION_VAL ( "raw_value"  )

◆ OBSERVATION_VAL() [6/15]

const OBSERVATION_PREFIX char* OB_INSTRUMENT_ID_S OBSERVATION_VAL ( "instrument_id"  )

◆ OBSERVATION_VAL() [7/15]

const OBSERVATION_PREFIX char* OB_INSTRUMENT_S OBSERVATION_VAL ( "instrument"  )

◆ OBSERVATION_VAL() [8/15]

const OBSERVATION_PREFIX char* OB_GROWTH_STAGE_S OBSERVATION_VAL ( "growth_stage"  )

◆ OBSERVATION_VAL() [9/15]

const OBSERVATION_PREFIX char* OB_CORRECTED_VALUE_S OBSERVATION_VAL ( "corrected_value"  )

◆ OBSERVATION_VAL() [10/15]

const OBSERVATION_PREFIX char* OB_METHOD_S OBSERVATION_VAL ( "method"  )

◆ OBSERVATION_VAL() [11/15]

const OBSERVATION_PREFIX char* OB_NATURE_S OBSERVATION_VAL ( "nature"  )

◆ OBSERVATION_VAL() [12/15]

const OBSERVATION_PREFIX char* OB_INDEX_S OBSERVATION_VAL ( "index"  )

◆ OBSERVATION_VAL() [13/15]

const OBSERVATION_PREFIX char* OB_TYPE_S OBSERVATION_VAL ( "value_type"  )

◆ OBSERVATION_VAL() [14/15]

const OBSERVATION_PREFIX char* OB_NOTES_S OBSERVATION_VAL ( "notes"  )

◆ OBSERVATION_VAL() [15/15]

const OBSERVATION_PREFIX uint32 OB_DEFAULT_INDEX OBSERVATION_VAL ( )

◆ AllocateObservation()

Observation* AllocateObservation ( 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 json_t *  raw_value_p,
const json_t *  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,
const ObservationType  obs_type 
)

◆ AllocateObservationWithErrorHandler()

Observation* AllocateObservationWithErrorHandler ( 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 json_t *  raw_value_p,
const json_t *  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,
const ObservationType  obs_type,
void(*)(ServiceJob *job_p, const char *const observation_field_s, const void *value_p, void *user_data_p)  on_error_callback_fn,
ServiceJob job_p,
void *  user_data_p 
)

◆ InitObservation()

bool InitObservation ( Observation observation_p,
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 char *  growth_stage_s,
const char *  method_s,
Instrument instrument_p,
const ObservationNature  nature,
const uint32 *  index_p,
const char *  notes_s,
const ObservationType  obs_type,
void(*)(Observation *observation_p)  clear_fn,
bool(*)(const struct 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)  add_values_to_json_fn,
bool(*)(struct Observation *observation_p, ObservationValueType ovt, const json_t *value_p)  set_value_from_json_fn,
bool(*)(struct Observation *observation_p, ObservationValueType ovt, const char *value_s)  set_value_from_string_fn,
bool(*)(struct Observation *observation_p, ObservationValueType ovt, char **value_ss, bool *free_value_flag_p)  get_value_as_string_fn 
)

◆ GetObservationAsJSON()

json_t* GetObservationAsJSON ( const Observation observation_p,
const ViewFormat  format 
)

◆ GetObservationFromJSON()

Observation* GetObservationFromJSON ( const json_t *  phenotype_json_p,
FieldTrialServiceData data_p 
)

◆ SaveObservation()

bool SaveObservation ( Observation observation_p,
const FieldTrialServiceData data_p 
)

◆ AreObservationsMatchingByParts()

bool AreObservationsMatchingByParts ( const Observation observation_p,
const MeasuredVariable variable_p,
const struct tm *  start_date_p,
const struct tm *  end_date_p,
const uint32 *  index_p 
)

◆ GetObservationTypeAsString()

const char* GetObservationTypeAsString ( const ObservationType  obs_type)

◆ DetermineObservationTypeFromString()

bool DetermineObservationTypeFromString ( const char *const  obs_type_s,
ObservationType obs_type_p 
)

◆ SetObservationRawValueFromString()

bool SetObservationRawValueFromString ( Observation observation_p,
const char *const  value_s 
)

◆ SetObservationCorrectedValueFromString()

bool SetObservationCorrectedValueFromString ( Observation observation_p,
const char *const  value_s 
)

◆ SetObservationRawValueFromJSON()

bool SetObservationRawValueFromJSON ( Observation observation_p,
const json_t *  value_p 
)

◆ SetObservationCorrectedValueFromJSON()

bool SetObservationCorrectedValueFromJSON ( Observation observation_p,
const json_t *  value_p 
)

◆ AddObservationValuesToFrictionlessData()

bool AddObservationValuesToFrictionlessData ( Observation obs_p,
json_t *  fd_json_p 
)

◆ GetObservationTypeForScaleClass()

ObservationType GetObservationTypeForScaleClass ( const ScaleClass class_p)