Skip to content

Commit

Permalink
adding defined tables
Browse files Browse the repository at this point in the history
  • Loading branch information
DART committed Oct 30, 2024
1 parent 0968cab commit 80d6d47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 1 addition & 3 deletions analysis/dataset_definition_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,4 @@


dataset.sex = patients.sex
dataset.dob = patients.date_of_birth


dataset.dob = patients.date_of_birth
18 changes: 14 additions & 4 deletions analysis/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,29 @@
os.makedirs(output_dir, exist_ok=True)

# Load the data
data = pd.read_csv("output/full_dataset.csv.gz")
data = pd.read_csv("output/full_dataset_test.csv.gz")

# Melt the ADHD events data
adhd_events = data.melt(
id_vars=['patient_id', 'sex'],
id_vars=['patient_id', 'sex','dob'],
value_vars=[f'num_adhd_events_{year}' for year in range(2016, 2024)],
var_name='year',
value_name='num_adhd_events'
)

#Computing ADHD disgnosis

#First this is the total
adhd_total_sex_table = data.groupby(['sex']).count()
adhd_total_sex_table = adhd_total_sex_table.drop(['patient_id'],axis=1)
adhd_total_sex_table = adhd_total_sex_table.drop(['patient_id','dob'],axis=1)

adhd_dia_sex_table = data.
#Second the the number of adhd dia
#Need to binaries the dia
adhd_dia_sex_table = data.copy()
col_years = [f'num_adhd_events_{year}' for year in range(2016, 2024)]
adhd_dia_sex_table[col_years] = adhd_dia_sex_table[col_years] > 0
adhd_dia_sex_table = adhd_dia_sex_table.groupby(['sex']).sum()
adhd_dia_sex_table = adhd_dia_sex_table.drop(['patient_id','dob'],axis=1)

#Caulcate the prelavence
prevelnce = adhd_dia_sex_table/adhd_total_sex_table

0 comments on commit 80d6d47

Please sign in to comment.