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():