terraref / reference-data

Coordination of Data Products and Standards for TERRA reference data
https://terraref.org
BSD 3-Clause "New" or "Revised" License
9 stars 2 forks source link

Linking specific methods with associated variables in BETYdb #159

Closed NewcombMaria closed 7 years ago

NewcombMaria commented 7 years ago

List of data-sets and variables uploaded to betydb that need to be linked with specific methods. This issue is connected with #61 .

dlebauer commented 7 years ago

Part 1:

-- check if any methods exist
select distinct method_id from traits 
  where variable_id in (select id from variables 
    where name in ('aboveground_fresh_biomass_handharvest', 
                   'aboveground_dry_biomass_handharvest',
                   'aboveground_biomass_moisture_handharvest',
                   'harvest_plant_count', 
                   'sum_of_gaps_greater20cm'))
-- all of these are null

-- at methods to traits
update traits 
   set method_id = (select id from methods where name = 'Harvest yield estimates Maricopa sorghum season1 hand harvest') 
   where 
     (variable_id in (select id from variables 
       where name in ('aboveground_fresh_biomass_handharvest', 
                      'aboveground_dry_biomass_handharvest',
                      'aboveground_biomass_moisture_handharvest')) 
         and date_trunc('day', created_at) = (date '2017-07-02'))
     or 
       (variable_id in (select id from variables 
          where name in ('harvest_plant_count', 
                         'sum_of_gaps_greater20cm') ) 
            and date_trunc('day', created_at) = (date '2017-07-08'))
dlebauer commented 7 years ago

@NewcombMaria for the data uploaded on July 9, we need to split out the variable and method.

E.g.

Similarly, the number_tillers and number_plants variable (trait) name should be independent from how it was sampled (though it isn't clear why the method of counting the number of tillers / plants would require a destructive sample).. I will go ahead and update the methods for these, and we can go back later and update the names / methods after they are decided and available in the database.

dlebauer commented 7 years ago
update traits 
   set method_id = (select id from methods where name = 'In-season leaf area and biomass estimates by destructive sampling') 
   where 
     (variable_id in (select id from variables 
       where name in ('number_plants_destructive_sample',
'number_tillers_destructive_sample',
'aboveground_fresh_weight_1meter_destructive_sample',
'aboveground_fresh_weight_5plant_destructive_sample',
'fresh_weight_stems',
'fresh_weight_leaves',
'dry_weight_stems',
'dry_weight_leaves',
'leaf_area_index_AreaMeter',
'biomass_dry_stems',
'biomass_dry_leaves',
'SLA',
'dry_matter_fraction')) 
         and date_trunc('day', created_at) = (date '2017-07-10'))
NewcombMaria commented 7 years ago

Thanks @dlebauer. Let me know if there are steps that I need to take. I've written Methods for mechanical harvest sorghum season1 and mechanical harvest sorghum season2 (different equipment, different methods). Should I make a list of the harvest-associated traits to be linked with each season, similar to above?

NewcombMaria commented 7 years ago

@dlebauer the following is a new updated list of data-sets and variables recently uploaded to betydb that need to be linked with specific methods.

NewcombMaria commented 7 years ago

@dlebauer I uploaded a small data-set for ground-based canopy cover estimates for the purpose of validating the canopy cover estimates from the stereoTop RGB cameras, and the data need to be linked with the appropriate Method. The method/protocol I followed is described in 'Canopy cover estimation from ground-based conventional photographs': https://terraref.ncsa.illinois.edu/bety/methods/6000000024 .

dlebauer commented 7 years ago

updated the ground-based canopy cover

UPDATE traits 
    SET method_id = (SELECT ID FROM methods NAME = 
      'Canopy cover estimation from ground-based conventional photographs')
 WHERE 
    DATE (traits.created_at) = '2017-10-13'
   AND variable_id = (SELECT    ID FROM variables WHERE NAME = 'canopy_cover');
dlebauer commented 7 years ago

Visual classification of sorghum growth stages to determine estimates of developmental timing by accession

UPDATE traits SET method_id = (
    SELECT ID FROM methods WHERE NAME = 
                 'Visual classification of sorghum growth stages to determine estimates of developmental timing by accession')
WHERE DATE (traits.created_at) = '2017-07-22'
    AND variable_id in (SELECT ID FROM variables WHERE
        NAME in ( 'flag_leaf_emergence_time','heading_time', 
                                 'flowering_time', 
                                 'grain_milk_stage_time',
                                 'grain_soft_dough_stage_time',
                                 'grain_hard_dough_stage_time'));

Grain near-infrared spectroscopy (NIRS) analysis

UPDATE traits SET method_id = (
    SELECT ID FROM methods WHERE NAME = 
                'Grain near-infrared spectroscopy (NIRS) analysis')
WHERE DATE (traits.created_at) = '2017-07-22'
    AND variable_id in (SELECT ID FROM variables WHERE
        NAME in ('grain_ash_content',
                                'grain_fat_content',
                                'grain_fiber_content',
                                'grain_moisture_content',
                                'grain_protein_content',
                                'grain_starch_content',
                                'grain_stage_at_harvest'));
dlebauer commented 7 years ago

@NewcombMaria I've associated methods with all of the traits in this issue. I am going to close it in order to keep it from getting too long - please open new ones as needed.