R/lab_result.R

Defines functions lds_get_lab_test lds_post_lab_test lds_put_lab_test lds_delete_lab_test

Documented in lds_delete_lab_test lds_get_lab_test lds_post_lab_test lds_put_lab_test

#' Get information about areas
#' @export
lds_get_lab_test <- function(...) {
  
  lds_call("lab_results", "GET", query = ...)
  
}

#' Create areas
#' @export
lds_post_lab_test <- function(external_id = NA, tested_at = NA, testing_status = NA, notes = NA, received_at = NA,
                              type = NA, foreign_matter = NA, moisture_content_percent = NA, 
                              moisture_content_water_activity_rate = NA, herbicides_ppm = NA, growth_regulators_ppm = NA,
                              cannabinoid_editor = NA, cannabinoid_status = "not_started", cannabinoid_d9_thca_percent = NA, 
                              cannabinoid_d9_thca_mg_g = NA, cannabinoid_d9_thc_percent = NA, 
                              cannabinoid_d9_thc_mg_g = NA, cannabinoid_d8_thc_percent = NA, 
                              cannabinoid_d8_thc_mg_g = NA, cannabinoid_thcv_percent = NA, cannabinoid_thcv_mg_g = NA, 
                              cannabinoid_cbd_percent = NA, cannabinoid_cbd_mg_g = NA, cannabinoid_cbda_percent = NA, 
                              cannabinoid_cbda_mg_g = NA, cannabinoid_cbdv_percent = NA, cannabinoid_cbdv_mg_g = NA, 
                              cannabinoid_cbg_percent = NA, cannabinoid_cbg_mg_g = NA, cannabinoid_cbga_percent = NA,
                              cannabinoid_cbga_mg_g = NA, cannabinoid_cbc_percent = NA, 
                              cannabinoid_cbc_mg_g = NA, cannabinoid_cbn_percent = NA, 
                              cannabinoid_cbn_mg_g = NA, terpenoid_editor = NA,
                              terpenoid_status = "not_started", terpenoid_bisabolol_percent = NA,
                              terpenoid_bisabolol_mg_g = NA, terpenoid_humulene_percent = NA,
                              terpenoid_humulene_mg_g = NA, terpenoid_pinene_percent = NA, 
                              terpenoid_pinene_mg_g = NA, terpenoid_terpinolene_percent = NA,
                              terpenoid_terpinolene_mg_g = NA, terpenoid_b_caryophyllene_percent = NA,
                              terpenoid_b_caryophyllene_mg_g = NA, terpenoid_b_myrcene_percent = NA,
                              terpenoid_b_myrcene_mg_g = NA, terpenoid_b_pinene_percent = NA, 
                              terpenoid_b_pinene_mg_g = NA, terpenoid_caryophyllene_oxide_percent = NA,
                              terpenoid_caryophyllene_oxide_mg_g = NA, terpenoid_limonene_percent = NA, 
                              terpenoid_limonene_mg_g = NA, terpenoid_linalool_percent = NA, 
                              terpenoid_linalool_mg_g = NA, microbial_editor = NA, microbial_status = "not_started", 
                              microbial_total_viable_plate_count_cfu_g = NA,
                              microbial_total_yeast_mold_cfu_g = NA, microbial_total_coliform_cfu_g = NA,
                              microbial_bile_tolerant_cfu_g = NA, microbial_pathogenic_e_coli_cfu_g = NA,
                              microbial_salmonella_cfu_g = NA, mycotoxin_editor = NA, mycotoxin_status = "not_started",
                              mycotoxin_aflatoxins_ppb = NA, mycotoxin_ochratoxin_ppb = NA, metal_editor = NA,
                              metal_status = "not_started", metal_arsenic_ppm = NA, metal_cadmium_ppm = NA, 
                              metal_lead_ppm = NA, metal_mercury_ppm = NA, pesticide_editor = NA, 
                              pesticide_status = "not_started", pesticide_abamectin_ppm = NA, 
                              pesticide_acequinocyl_ppm = NA, pesticide_bifenazate_ppm = NA, 
                              pesticide_bifentrin_ppm = NA, pesticide_captan_ppm = NA, 
                              pesticide_cyfluthrin_ppm = NA, pesticide_cypermethrin_ppm = NA,
                              pesticide_dimethomorph_ppm = NA, pesticide_etoxazole_ppm = NA, 
                              pesticide_fenhexamid_ppm = NA, pesticide_flonicamid_ppm = NA, 
                              pesticide_fludioxonil_ppm = NA, pesticide_imidacloprid_ppm = NA, 
                              pesticide_myclobutanil_ppm = NA, pesticide_pcnb_ppm = NA, 
                              pesticide_piperonyl_butoxide_ppm = NA, pesticide_pyrethrin_ppm = NA,
                              pesticide_spinetoram_ppm = NA, pesticide_spinosad_ppm = NA,
                              pesticide_spirotetramet_ppm = NA, pesticide_thiamethoxam_ppm = NA, 
                              pesticide_trifloxystrobin_ppm = NA, solvent_editor = NA, solvent_status = "not_started",
                              solvent_butanes_ppm = NA, solvent_heptane_ppm = NA, solvent_propane_ppm = NA,
                              global_for_mme_id, global_inventory_id = NA, global_batch_id = NA, 
                              global_for_inventory_id) {
  
  lds_call("lab_results", "POST", body = list(
    lab_result = data.frame(external_id, tested_at, testing_status, notes, received_at,
                          type, foreign_matter, moisture_content_percent, 
                          moisture_content_water_activity_rate, herbicides_ppm, growth_regulators_ppm,
                          cannabinoid_editor, cannabinoid_status = "not_started", cannabinoid_d9_thca_percent, 
                          cannabinoid_d9_thca_mg_g, cannabinoid_d9_thc_percent, 
                          cannabinoid_d9_thc_mg_g, cannabinoid_d8_thc_percent, 
                          cannabinoid_d8_thc_mg_g, cannabinoid_thcv_percent, cannabinoid_thcv_mg_g, 
                          cannabinoid_cbd_percent, cannabinoid_cbd_mg_g, cannabinoid_cbda_percent, 
                          cannabinoid_cbda_mg_g, cannabinoid_cbdv_percent, cannabinoid_cbdv_mg_g, 
                          cannabinoid_cbg_percent, cannabinoid_cbg_mg_g, cannabinoid_cbga_percent,
                          cannabinoid_cbga_mg_g, cannabinoid_cbc_percent, 
                          cannabinoid_cbc_mg_g, cannabinoid_cbn_percent, 
                          cannabinoid_cbn_mg_g, terpenoid_editor,
                          terpenoid_status = "not_started", terpenoid_bisabolol_percent,
                          terpenoid_bisabolol_mg_g, terpenoid_humulene_percent,
                          terpenoid_humulene_mg_g, terpenoid_pinene_percent, 
                          terpenoid_pinene_mg_g, terpenoid_terpinolene_percent,
                          terpenoid_terpinolene_mg_g, terpenoid_b_caryophyllene_percent,
                          terpenoid_b_caryophyllene_mg_g, terpenoid_b_myrcene_percent,
                          terpenoid_b_myrcene_mg_g, terpenoid_b_pinene_percent, 
                          terpenoid_b_pinene_mg_g, terpenoid_caryophyllene_oxide_percent,
                          terpenoid_caryophyllene_oxide_mg_g, terpenoid_limonene_percent, 
                          terpenoid_limonene_mg_g, terpenoid_linalool_percent, 
                          terpenoid_linalool_mg_g, microbial_editor, microbial_status = "not_started", 
                          microbial_total_viable_plate_count_cfu_g,
                          microbial_total_yeast_mold_cfu_g, microbial_total_coliform_cfu_g,
                          microbial_bile_tolerant_cfu_g, microbial_pathogenic_e_coli_cfu_g,
                          microbial_salmonella_cfu_g, mycotoxin_editor, mycotoxin_status = "not_started",
                          mycotoxin_aflatoxins_ppb, mycotoxin_ochratoxin_ppb, metal_editor,
                          metal_status = "not_started", metal_arsenic_ppm, metal_cadmium_ppm, 
                          metal_lead_ppm, metal_mercury_ppm, pesticide_editor, 
                          pesticide_status = "not_started", pesticide_abamectin_ppm, 
                          pesticide_acequinocyl_ppm, pesticide_bifenazate_ppm, 
                          pesticide_bifentrin_ppm, pesticide_captan_ppm, 
                          pesticide_cyfluthrin_ppm, pesticide_cypermethrin_ppm,
                          pesticide_dimethomorph_ppm, pesticide_etoxazole_ppm, 
                          pesticide_fenhexamid_ppm, pesticide_flonicamid_ppm, 
                          pesticide_fludioxonil_ppm, pesticide_imidacloprid_ppm, 
                          pesticide_myclobutanil_ppm, pesticide_pcnb_ppm, 
                          pesticide_piperonyl_butoxide_ppm, pesticide_pyrethrin_ppm,
                          pesticide_spinetoram_ppm, pesticide_spinosad_ppm,
                          pesticide_spirotetramet_ppm, pesticide_thiamethoxam_ppm, 
                          pesticide_trifloxystrobin_ppm, solvent_editor, solvent_status = "not_started",
                          solvent_butanes_ppm, solvent_heptane_ppm, solvent_propane_ppm,
                          global_for_mme_id, global_inventory_id, global_batch_id, 
                          global_for_inventory_id)
  ))
  
}

#' Update area
#' @export
lds_put_lab_test <- function(global_id, external_id = NA, is_initial_lab_test = NA, is_active = NA,
                              lab_test_created_at = NA, lab_test_packaged_at = NA, medically_compliant = NA,
                              qty = NA, uom = NA, global_area_id, global_strain_id = NA, global_lab_test_type_id,
                              legacy_id = NA) {
  
  lds_call("lab_results", "PUT", body = list(
    lab_test = data.frame(external_id, is_initial_lab_test, is_active,
                           lab_test_created_at, lab_test_packaged_at, medically_compliant,
                           qty, uom, global_area_id, global_strain_id, global_lab_test_type_id,
                           legacy_id, global_id)
  ))
  
}

#' Delete area
#' @export
lds_delete_lab_test <- function(global_id) {
  
  lds_call("lab_results", "DELETE", global_id = global_id)
  
}
CannaData/CannaLeafDataSystems documentation built on May 17, 2019, 8:03 a.m.