FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 64719365 authored by Dr T. Mona's avatar Dr T. Mona
Browse files

feat: convert severity string values to int

parent 7c19b032
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,21 @@ cases_incident = {
'high':'high'
}
cases_severity = {
'1':1,
'5':5,
'10':10,
'15':15,
'20':20,
'30':30,
'40':40,
'50':50,
'60':60,
'70':70,
'80':80,
'80+':80,
}
def get_from_kobotoolbox(url,form_id,form_token,**kwargs):
'''Make the HTTP request, then checking the status code.'''
......@@ -109,7 +124,7 @@ def get_newODK_form_as_csv(form_credentials: dict, jobPath: str, config: dict, s
'imei' : 'imei',
'leaf_rust/leafrust_host_plant_reaction' : 'leaf_rust-leafrust_host_plant_reaction',
'leaf_rust/leafrust_incidence' : ('parse_cases',(('name_out','leaf_rust-leafrust_incidence'),('cases', cases_incident))),
'leaf_rust/leafrust_severity' : 'leaf_rust-leafrust_severity',
'leaf_rust/leafrust_severity' : ('parse_cases',(('name_out','leaf_rust-leafrust_severity'),('cases', cases_severity),('dtype', int))),
'live_leafrust_samples' : 'SET-OF-live_leafrust_samples',
'live_leafrust_samples_count' : 'live_leafrust_samples_count',
'live_stemrust_samples' : 'SET-OF-live_stemrust_samples',
......@@ -127,7 +142,7 @@ def get_newODK_form_as_csv(form_credentials: dict, jobPath: str, config: dict, s
'site_information/survey_site' : 'site_information-survey_site',
'site_information/variety' : 'site_information-variety',
'start' : ('parse_date',(('name_out','start'),('fmt_in','%Y-%m-%dT%H:%M:%S.%f%z'))),
'stem_rust/Stemrust_severity' : 'stem_rust-Stemrust_severity',
'stem_rust/Stemrust_severity' : ('parse_cases',(('name_out','stem_rust-Stemrust_severity'),('cases', cases_severity),('dtype', int))),
'stem_rust/stemrust_host_plant_reaction' : 'stem_rust-stemrust_host_plant_reaction',
'stem_rust/stemrust_incidence' : ('parse_cases',(('name_out','stem_rust-stemrust_incidence'),('cases', cases_incident))),
'survey_infromation/location' : ('parse_location_kobotoolbox',()),
......@@ -139,8 +154,8 @@ def get_newODK_form_as_csv(form_credentials: dict, jobPath: str, config: dict, s
'today' : ('parse_date',(('name_out','today'),('fmt_in','%Y-%m-%d'))),
'username' : 'username',
'yellow_rust/yellowrust_host_plant_reaction' : 'yellow_rust-yellowrust_host_plant_reaction',
'yellow_rust/yellowrust_incidence' : ('parse_cases',(('name_out','leaf_rust-leafrust_incidence'),('cases', cases_incident))),
'yellow_rust/yellowrust_severity' : 'yellow_rust-yellowrust_severity',
'yellow_rust/yellowrust_incidence' : ('parse_cases',(('name_out','yellow_rust-yellowrust_incidence'),('cases', cases_incident))),
'yellow_rust/yellowrust_severity' : ('parse_cases',(('name_out','yellow_rust-yellowrust_severity'),('cases', cases_severity),('dtype', int))),
}
logger.debug('Performing download')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment