Skip to content

Commit

Permalink
Update domains.py
Browse files Browse the repository at this point in the history
Review edits: suggestion (domain.py): In harmonize_TADA_dict, we could use a groupby operation to avoid looping through the dataframe using python. TOCHECK
  • Loading branch information
jbousquin authored Jul 9, 2024
1 parent 01a75da commit 5b79f0f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions harmonize_wq/domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ def harmonize_TADA_dict():
csv = f'{TADA_DATA_URL}develop/inst/extdata/HarmonizationTemplate.csv'
df = pandas.read_csv(csv) # Read csv url to DataFrame
full_dict = {} # Setup results dict
# Loop over one unique characteristicName at a time
for char in df['TADA.CharacteristicName'].unique():
sub_df = df[df['TADA.CharacteristicName']==char] # Mask by char
# Build dict one unique characteristicName at a time
for char, sub_df in df.groupby('TADA.CharacteristicName'):
full_dict[char] = char_tbl_TADA(sub_df, char) # Build dictionary

# Domains to check agaisnt
Expand Down

0 comments on commit 5b79f0f

Please sign in to comment.