brapi_put_studies_studyDbId_observations: put /studies/{studyDbId}/observations

View source: R/brapi_put_studies_studyDbId_observations.R

brapi_put_studies_studyDbId_observationsR Documentation

put /studies/{studyDbId}/observations

Description

Update the Observations or create new Observations of a specific Study

Usage

brapi_put_studies_studyDbId_observations(
  con = NULL,
  studyDbId = "",
  observations = ""
)

Arguments

con

list; required: TRUE; BrAPI connection object

studyDbId

character; required: TRUE; Identifier of the study. Usually a number, could be alphanumeric.

observations

data.frame; required: TRUE; data.frame of observation references to be created or updated with default: ""; Each row in the observations data.frame represents a single observation and can consist of the following columns:

  • collector vector of type character; the name or identifier of the entity which collected each observation.

  • observationDbId vector of type character; the internal database identifier of each existing observation to be updated.

  • observationTimeStamp vector of type character; The date and time each individual observation was taken and specified in the ISO 8601 standard, e.g. for two observations c("2020-06-09T10:18:29.000Z", "2020-06-09T10:18:40.010Z")

  • observationUnitDbId vector of type character; the unique internal database identifier specifying the observation unit for each observation.

  • observationVariableDbId vector of type character; the internal database identifier of the trait for each observation

  • value vector of type character; the value of each observation as specified by the observation variable defined by its observationVariableDbId in the previous column.

The Examples Section shows an example of how to construct the observations argument as a data.frame object.

Details

The following rules are used for updating observations and creating new observations:

  • If an observationDbId is "null" or an empty string in the request, a NEW observation should be created for the given study and observationUnit

  • If an observationDbId is populated but not found in the database, a NEW observation should be created for the given study and observationUnit AND an NEW observationDbId should be assigned to it. A warning should be returned to the client.

  • If an observationDbId is populated and found in the database, but the existing entry is not associated with the given study or observationUnit, a NEW observation should be created for the given study and observationUnit AND an NEW observationDbId should be assigned to it. A warning should be returned to the client.

  • If an observationDbId is populated and found in the database and is associated with the given study and observationUnit, then it should be updated with the new data given.

Value

data.frame

Author(s)

brapir generator package

References

BrAPI SwaggerHub

See Also

Other brapi_1.3: brapi_get_allelematrices_search(), brapi_get_allelematrices(), brapi_get_attributes_categories(), brapi_get_attributes(), brapi_get_breedingmethods_breedingMethodDbId(), brapi_get_breedingmethods(), brapi_get_calls(), brapi_get_commoncropnames(), brapi_get_germplasm_germplasmDbId_attributes(), brapi_get_germplasm_germplasmDbId_markerprofiles(), brapi_get_germplasm_germplasmDbId_mcpd(), brapi_get_germplasm_germplasmDbId_pedigree(), brapi_get_germplasm_germplasmDbId_progeny(), brapi_get_germplasm_germplasmDbId(), brapi_get_germplasm(), brapi_get_images_imageDbId(), brapi_get_images(), brapi_get_lists_listDbId(), brapi_get_lists(), brapi_get_locations_locationDbId(), brapi_get_locations(), brapi_get_maps_mapDbId_positions_linkageGroupName(), brapi_get_maps_mapDbId_positions(), brapi_get_maps_mapDbId(), brapi_get_maps(), brapi_get_markerprofiles_markerProfileDbId(), brapi_get_markerprofiles(), brapi_get_markers_markerDbId(), brapi_get_markers(), brapi_get_methods_methodDbId(), brapi_get_methods(), brapi_get_observationlevels(), brapi_get_observationunits(), brapi_get_ontologies(), brapi_get_people_personDbId(), brapi_get_people(), brapi_get_programs(), brapi_get_samples_sampleDbId(), brapi_get_samples(), brapi_get_scales_scaleDbId(), brapi_get_scales(), brapi_get_search_germplasm_searchResultsDbId(), brapi_get_search_images_searchResultsDbId(), brapi_get_search_markers_searchResultsDbId(), brapi_get_search_observationtables_searchResultsDbId(), brapi_get_search_observationunits_searchResultsDbId(), brapi_get_search_programs_searchResultsDbId(), brapi_get_search_samples_searchResultsDbId(), brapi_get_search_studies_searchResultsDbId(), brapi_get_search_variables_searchResultsDbId(), brapi_get_seasons(), brapi_get_studies_studyDbId_germplasm(), brapi_get_studies_studyDbId_layouts(), brapi_get_studies_studyDbId_observations(), brapi_get_studies_studyDbId_observationunits(), brapi_get_studies_studyDbId_observationvariables(), brapi_get_studies_studyDbId_table(), brapi_get_studies_studyDbId(), brapi_get_studies(), brapi_get_studytypes(), brapi_get_traits_traitDbId(), brapi_get_traits(), brapi_get_trials_trialDbId(), brapi_get_trials(), brapi_get_variables_observationVariableDbId(), brapi_get_variables(), brapi_get_vendor_orders_orderId_plates(), brapi_get_vendor_orders_orderId_results(), brapi_get_vendor_orders_orderId_status(), brapi_get_vendor_orders(), brapi_get_vendor_plates_submissionId(), brapi_get_vendor_specifications(), brapi_post_allelematrices_search(), brapi_post_images(), brapi_post_lists_listDbId_items(), brapi_post_lists(), brapi_post_methods(), brapi_post_people(), brapi_post_phenotypes(), brapi_post_scales(), brapi_post_search_germplasm(), brapi_post_search_images(), brapi_post_search_markers(), brapi_post_search_observationtables(), brapi_post_search_observationunits(), brapi_post_search_programs(), brapi_post_search_samples(), brapi_post_search_studies(), brapi_post_search_variables(), brapi_post_studies_studyDbId_table(), brapi_post_traits(), brapi_post_vendor_orders(), brapi_post_vendor_plates(), brapi_put_images_imageDbId_imagecontent(), brapi_put_images_imageDbId(), brapi_put_lists_listDbId(), brapi_put_methods_methodDbId(), brapi_put_people_personDbId(), brapi_put_samples(), brapi_put_scales_scaleDbId(), brapi_put_studies_studyDbId_layouts(), brapi_put_studies_studyDbId_observationunits(), brapi_put_traits_traitDbId()

Other Studies: brapi_get_search_studies_searchResultsDbId(), brapi_get_seasons(), brapi_get_studies_studyDbId_germplasm(), brapi_get_studies_studyDbId_layouts(), brapi_get_studies_studyDbId_observations(), brapi_get_studies_studyDbId_observationunits(), brapi_get_studies_studyDbId_observationvariables(), brapi_get_studies_studyDbId_table(), brapi_get_studies_studyDbId(), brapi_get_studies(), brapi_get_studytypes(), brapi_post_search_studies(), brapi_post_studies_studyDbId_table(), brapi_put_studies_studyDbId_layouts(), brapi_put_studies_studyDbId_observationunits()

Other Observations: brapi_get_observationlevels(), brapi_get_observationunits(), brapi_get_search_observationtables_searchResultsDbId(), brapi_get_search_observationunits_searchResultsDbId(), brapi_get_studies_studyDbId_observations(), brapi_get_studies_studyDbId_observationunits(), brapi_get_studies_studyDbId_table(), brapi_post_phenotypes(), brapi_post_search_observationtables(), brapi_post_search_observationunits(), brapi_post_studies_studyDbId_table(), brapi_put_studies_studyDbId_observationunits()

Examples

## Not run: 

# Create a connection object
con <- brapi_db()$testserver

# Create an observations data.frame
# containing the observations to be updated and added
# 1) change Plant Height (observationVariableDbId = "MO_123:100002")
#    from 1.1. to 2.1 for Plant 1 (observationUnitDbId = "2") matching
#    observationDbId = "3"
# 2) add Virus severity (observationVariableDbId = "MO_123:100006")
#    of 0.8 for Plant 2 (observationUnitDbId = "4")
observations <- data.frame(
  collector = c("Jack", "Freddy"),
  observationDbId = c("3", ""),
  observationTimeStamp = c(
    paste0(anytime::iso8601(lubridate::with_tz(Sys.time(),
                                               tzone = "UTC")),
           "Z"),
    paste0(anytime::iso8601(lubridate::with_tz(Sys.time(),
                                               tzone = "UTC")),
           "Z")),
  observationUnitDbId = c("2", "4"),
  obserbationVariableDbId = c("MO_123:100002", "MO_123:100006"),
  value = c("2.2", "0.8"))

# Make put /studies/{studyDbId}/observations call
brapi_put_studies_studyDbId_observations(con = con,
                                         studyDbId = '1001',
                                         observations = observations)

## End(Not run)


mverouden/brapir documentation built on April 10, 2022, 5:36 p.m.