From 5f5becdf9dcdbbfc7b0791cbbc334ca79e711a24 Mon Sep 17 00:00:00 2001 From: "J.G. Rubingh" Date: Tue, 24 Nov 2020 14:54:37 +0100 Subject: [PATCH] Fix wrong state casing --- webservice/apps/synthea/lib/utils.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/webservice/apps/synthea/lib/utils.py b/webservice/apps/synthea/lib/utils.py index 73a1044..57b1452 100644 --- a/webservice/apps/synthea/lib/utils.py +++ b/webservice/apps/synthea/lib/utils.py @@ -11,15 +11,14 @@ from uuid import uuid4 def available_states(): states = [] - # Read the timezones.csv file from the Synthea resources. This should give us all the 'state' on the first column - df = pd.read_csv(settings.SYNTHEA_STATES_DIR / 'timezones.csv', index_col=False) - for state in df[df.columns[0]].to_list(): + # Read the demographics.csv file from the Synthea resources and get all the unique state names + # Important, the state name for synthea is case sensitive (field id) + df = pd.read_csv(settings.SYNTHEA_STATES_DIR / 'demographics.csv', index_col=False) + for state in df.STNAME.unique(): states.append({'id' : state , 'name' : state}) - #states = df[df.columns[0]].to_list() # Sort on name states = sorted(states, key=lambda k: k['name'].lower()) - #states.sort() return states def available_modules():