import os
import seaborn as sns
import pandas as pd
import plotly.express as px
import matplotlib.pyplot as plt
import numpy as np
%load_ext autoreload
%autoreload 2
import warnings
'ignore') warnings.filterwarnings(
Basic Demographics
## RUN THIS CELL ##
from hbn.constants import Defaults
from hbn.scripts import preprocess_phenotype, make_phenotype_specs
from hbn.data import make_dataset
from hbn.features.feature_selection import phenotype_features
# Preprocess data
preprocess_phenotype.run()
# get specs
make_phenotype_specs.run()
# HARDCODE PARTICIPANTS + FEATURE_SPEC
= make_dataset.get_participants(
participants ='all',
split=['ADHD-Combined Type',
disorders'ADHD-Inattentive Type',
'ADHD-Hyperactive_Impulsive_Type',
'No_Diagnosis_Given']
)
= 'features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview-spec.json'
feature_spec
# get data
= phenotype_features(
df =None,
target_spec=os.path.join(Defaults.FEATURE_DIR, feature_spec),
feature_spec=participants,
participants=False,
preprocess=False
drop_identifiers
)
# get summary of clinical diagnosis + other demographics
= make_dataset.make_summary(save=False)
dx = make_dataset._add_race_ethnicity(dataframe=dx)
dx
# get data from intake interview and merge with clinical summary
= df.merge(dx, on='Identifiers') df
phenotypic data have already been parsed...
phenotypic data have already been parsed...
phenotypic data have already been parsed...
phenotypic data have already been parsed...
created new clinical diagnosis file
writing train and test participants to file for ADHD
writing train and test participants to file for Anxiety_Disorders
writing train and test participants to file for Autism_Spectrum_Disorder
writing train and test participants to file for Bipolar_and_Related_Disorders
writing train and test participants to file for Depressive_Disorders
writing train and test participants to file for Disruptive__Impulse_Control_and_Conduct_Disorders
writing train and test participants to file for Elimination_Disorders
writing train and test participants to file for Feeding_and_Eating_Disorders
could not write out train and test participants for Gender_Dysphoria -- likely too few samples
could not write out train and test participants for Neurocognitive_Disorders -- likely too few samples
writing train and test participants to file for Neurodevelopmental_Disorders
writing train and test participants to file for No_Diagnosis_Given
writing train and test participants to file for No_Diagnosis_Given:_Incomplete_Eval
writing train and test participants to file for Obsessive_Compulsive_and_Related_Disorders
writing train and test participants to file for Other_Conditions_That_May_Be_a_Focus_of_Clinical_Attention
could not write out train and test participants for Schizophrenia_Spectrum_and_other_Psychotic_Disorders -- likely too few samples
writing train and test participants to file for Specific_Learning_Disorder_with_Impairment_in_Reading
writing train and test participants to file for Substance_Related_and_Addictive_Disorders
writing train and test participants to file for Trauma_and_Stressor_Related_Disorders
writing train and test participants to file for ADHD-Combined_Type
writing train and test participants to file for ADHD-Hyperactive_Impulsive_Type
writing train and test participants to file for ADHD-Inattentive_Type
writing train and test participants to file for Acute_Stress_Disorder
writing train and test participants to file for Adjustment_Disorders
writing train and test participants to file for Agoraphobia
could not write out train and test participants for Alcohol_Use_Disorder -- likely too few samples
writing train and test participants to file for Autism_Spectrum_Disorder
could not write out train and test participants for Avoidant_Restrictive_Food_Intake_Disorder -- likely too few samples
writing train and test participants to file for Bipolar_I_Disorder
could not write out train and test participants for Bipolar_II_Disorder -- likely too few samples
writing train and test participants to file for Borderline_Intellectual_Functioning
could not write out train and test participants for Bulimia_Nervosa -- likely too few samples
writing train and test participants to file for Cannabis_Use_Disorder
writing train and test participants to file for Conduct_Disorder-Childhood-onset_type
could not write out train and test participants for Cyclothymic_Disorder -- likely too few samples
could not write out train and test participants for Delirium_due_to_another_medical_condition -- likely too few samples
could not write out train and test participants for Delirium_due_to_multiple_etiologies -- likely too few samples
could not write out train and test participants for Depressive_Disorder_Due_to_Another_Medical_Condition -- likely too few samples
writing train and test participants to file for Disruptive_Mood_Dysregulation_Disorder
writing train and test participants to file for Encopresis
writing train and test participants to file for Enuresis
could not write out train and test participants for Excoriation_(Skin-Picking)_Disorder -- likely too few samples
could not write out train and test participants for Gender_Dysphoria_in_Adolescents_and_Adults -- likely too few samples
could not write out train and test participants for Gender_Dysphoria_in_Children -- likely too few samples
writing train and test participants to file for Generalized_Anxiety_Disorder
writing train and test participants to file for Intellectual_Disability-Mild
writing train and test participants to file for Intellectual_Disability-Moderate
could not write out train and test participants for Intellectual_Disability-Severe -- likely too few samples
writing train and test participants to file for Intermittent_Explosive_Disorder
writing train and test participants to file for Language_Disorder
writing train and test participants to file for Major_Depressive_Disorder
could not write out train and test participants for Major_Neurocognitive_Disorder_Due_to_Epilepsy -- likely too few samples
writing train and test participants to file for No_Diagnosis_Given
writing train and test participants to file for No_Diagnosis_Given:_Incomplete_Eval
writing train and test participants to file for Obsessive-Compulsive_Disorder
writing train and test participants to file for Oppositional_Defiant_Disorder
writing train and test participants to file for Other_Specified_Anxiety_Disorder
writing train and test participants to file for Other_Specified_Attention-Deficit_Hyperactivity_Disorder
could not write out train and test participants for Other_Specified_Depressive_Disorder -- likely too few samples
could not write out train and test participants for Other_Specified_Disruptive__Impulse-Control__and_Conduct_Disorder -- likely too few samples
could not write out train and test participants for Other_Specified_Feeding_or_Eating_Disorder -- likely too few samples
could not write out train and test participants for Other_Specified_Neurodevelopmental_Disorder -- likely too few samples
could not write out train and test participants for Other_Specified_Obsessive-Compulsive_and_Related_Disorder -- likely too few samples
could not write out train and test participants for Other_Specified_Schizophrenia_Spectrum_and_Other_Psychotic_Disorder -- likely too few samples
writing train and test participants to file for Other_Specified_Tic_Disorder
writing train and test participants to file for Other_Specified_Trauma-_and_Stressor-Related_Disorder
writing train and test participants to file for Panic_Disorder
could not write out train and test participants for Parent-Child_Relational_Problem -- likely too few samples
writing train and test participants to file for Persistent_(Chronic)_Motor_or_Vocal_Tic_Disorder
writing train and test participants to file for Persistent_Depressive_Disorder_(Dysthymia)
writing train and test participants to file for Posttraumatic_Stress_Disorder
writing train and test participants to file for Provisional_Tic_Disorder
could not write out train and test participants for Reactive_Attachment_Disorder -- likely too few samples
could not write out train and test participants for Schizophrenia -- likely too few samples
could not write out train and test participants for Selective_Mutism -- likely too few samples
writing train and test participants to file for Separation_Anxiety
writing train and test participants to file for Social_(Pragmatic)_Communication_Disorder
writing train and test participants to file for Social_Anxiety_(Social_Phobia)
writing train and test participants to file for Specific_Learning_Disorder_with_Impairment_in_Mathematics
writing train and test participants to file for Specific_Learning_Disorder_with_Impairment_in_Reading
could not write out train and test participants for Specific_Learning_Disorder_with_Impairment_in_Reading_ -- likely too few samples
writing train and test participants to file for Specific_Learning_Disorder_with_Impairment_in_Written_Expression
writing train and test participants to file for Specific_Phobia
writing train and test participants to file for Speech_Sound_Disorder
could not write out train and test participants for Substance_Medication-Induced_Bipolar_and_Related_Disorder -- likely too few samples
could not write out train and test participants for Tourettes_Disorder -- likely too few samples
could not write out train and test participants for Unspecified_Anxiety_Disorder -- likely too few samples
could not write out train and test participants for Unspecified_Attention-Deficit_Hyperactivity_Disorder -- likely too few samples
could not write out train and test participants for Unspecified_Neurodevelopmental_Disorder -- likely too few samples
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
spec file and features saved to disk for features-Child_Measures-Cognitive_Testing-NIH_Toolbox
spec file and features saved to disk for features-Child_Measures-Cognitive_Testing-Adaptive_Cognitive_Evaluation
spec file and features saved to disk for features-Child_Measures-Cognitive_Testing-Temporal_Discounting_Task
spec file and features saved to disk for features-Child_Measures-Cognitive_Testing-Wechsler_Intelligence_Scale_for_Children_-_V
spec file and features saved to disk for features-Child_Measures-Cognitive_Testing-Wechsler_Adult_Intelligence_Scale-IV
spec file and features saved to disk for features-Child_Measures-Cognitive_Testing-Kaufman_Brief_Intelligence_Test-II
spec file and features saved to disk for features-Child_Measures-Cognitive_Testing-Wechsler_Individual_Achievement_Test_-_III
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Clinical_Evaluation_of_Language_Fundamentals
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Clinical_Evaluation_of_Language_Fundamentals
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Clinical_Evaluation_of_Language_Fundamentals_-_Metalinguistics
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Expressive_Vocabulary_Test
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Peabody_Picture_Vocabulary_Test
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Goldman-Fristoe_Test_of_Articulation_-_III
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Comprehensive_Test_of_Phonological_Processing_–_II
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Test_of_Word_Reading_Efficiency_-_II
spec file and features saved to disk for features-Child_Measures-Language_Tasks-Clinical_Evaluation_of_Language_Fundamentals__Screening_Test
spec file and features saved to disk for features-Child_Measures-Interview_of_Emotional_and_Psychological_Function-Kiddie_Schedule_for_Affective_Disorders_and_Schizophrenia
spec file and features saved to disk for features-Child_Measures-Interview_of_Emotional_and_Psychological_Function-Negative_Life_Events_Scale_
spec file and features saved to disk for features-Child_Measures-Neurologic_Function-Electro-encephalography
spec file and features saved to disk for features-Child_Measures-Physiologic_Function-Physical_Measures
spec file and features saved to disk for features-Child_Measures-Physical_Fitness_and_Status-Treadmill_Test
spec file and features saved to disk for features-Child_Measures-Physical_Fitness_and_Status-FitnessGram
spec file and features saved to disk for features-Child_Measures-Physical_Fitness_and_Status-Body_Composition
spec file and features saved to disk for features-Child_Measures-Physical_Fitness_and_Status-Physical_Activity_Questionnaire_for_Older_Children_
spec file and features saved to disk for features-Child_Measures-Physical_Fitness_and_Status-Physical_Activity_Questionnaire_for_Adolescents_
spec file and features saved to disk for features-Child_Measures-Physical_Fitness_and_Status-Food_Frequency_Questionnaire-Screening_Form
spec file and features saved to disk for features-Child_Measures-Physical_Fitness_and_Status-Edinburgh_Handedness
spec file and features saved to disk for features-Child_Measures-Motor_Skills-Grooved_Pegboard
spec file and features saved to disk for features-Child_Measures-Vision-Ishihara_Color_Vision_Test
spec file and features saved to disk for features-Child_Measures-Medical_Status__Measures-Peterson_Puberty_Scale
spec file and features saved to disk for features-Child_Measures-Medical_Status__Measures-Drug_Screen
spec file and features saved to disk for features-Child_Measures-Medical_Status__Measures-Pregnancy_Test
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Adult_Self_Report_
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Youth_Self_Report
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Mood_and_Feelings_Questionnaire_–_Long_Version
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Screen_for_Child_Anxiety_Related_Disorders_-_Self-report
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Conners_ADHD_Rating_Scales_-_Self_Report__Short_Form
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Affective_Reactivity_Index_–_Self_Report
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Columbia_Suicide_Severity_Rating_Scale
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-The_Columbia_Impairment_Scale-Self_Report_Version
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-WHO_Disability_Assessment_Schedule_–_Self_Report
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Inventory_of_Callous-Unemotional_Traits
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Emotional_and_Cognitive_Status-Positive_and_Negative_Affect_Schedule
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Substance_Use__&_Addiction_-Fagerstrom_Test_for_Nicotine_Dependence
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Substance_Use__&_Addiction_-Alcohol_Use_Disorders_Identification_Test_
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Substance_Use__&_Addiction_-Modified_Fagerstrom_Tolerance_Questionnaire-Adolescents
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Substance_Use__&_Addiction_-European_School_Survey_Project_on_Alcohol_and_Other_Drugs_
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Substance_Use__&_Addiction_-Internet_Addiction_Test
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Substance_Use__&_Addiction_-Yale_Food_Addiction_Scale
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Family_Structure__Stress__and_Trauma-Children’s_Perception_of_Interparental_Conflict
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Family_Structure__Stress__and_Trauma-Alabama_Parenting_Questionnaire_
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Family_Structure__Stress__and_Trauma-Children’s_Coping_Strategies_Checklist-Revised_
spec file and features saved to disk for features-Child_Measures-Questionnaire_Measures_of_Family_Structure__Stress__and_Trauma-PhenX_School_Risk
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Kiddie_Schedule_for_Affective_Disorders_and_Schizophrenia
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Vineland_Adaptive_Behavior_Scale_–_Parent__Caregiver_Rating_Form
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Negative_Life_Events_Scale_–_Parent_Report
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Family_History-_Research_Diagnostic_Criteria
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Pregnancy_and_Birth_Questionnaire
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview_PreInt_Demos_Fam
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview_PreInt_DevHx
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview_PreInt_EduHx
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview_PreInt_FamHx
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview_PreInt_FamHx_RDC
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview_PreInt_Lang
spec file and features saved to disk for features-Parent_Measures-Interview_of_Emotional_and_Psychological_Function-Intake_Interview_PreInt_TxHx
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Demographics
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Financial_Support_Questionnaire
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Barratt_Simplified_Measure_of_Social_Status
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Daily_Medications
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Child_Behavior_Checklist
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Mood_and_Feelings_Questionnaire
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Screen_for_Child_Anxiety_Related_Disorders_-_Parent_report
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Extended_Strengths_and_Weaknesses_Assessment_of_Normal_Behavior-Parent_Report
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Strengths_and_Weaknesses_Assessment_of_ADHD_and_Normal_Behavior
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Autism_Spectrum_Screening_Questionnaire
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Social_Communication_Questionnaire
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-The_Columbia_Impairment_Scale-Parent_Report_Version
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Social_Aptitudes_Scale
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-WHO_Disability_Assessment_Schedule_–_Parent_Report
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Strengths_and_Difficulties_Questionnaire_(with_impact_supplement)
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Repetitive_Behavior_Scale
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Social_Responsiveness_Scale-2
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Affective_Reactivity_Index-Parent
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Inventory_of_Callous-Unemotional_Traits_–_Parent_Report
spec file and features saved to disk for features-Parent_Measures-Demographic_Questionnaire_Measures-Child_Mind_Institute_Symptom_Checker
spec file and features saved to disk for features-Parent_Measures-Questionnaire_Measures_of_Family_structure__Stress__and_Trauma-Parent-Child_Internet_Addiction_Test
spec file and features saved to disk for features-Parent_Measures-Questionnaire_Measures_of_Family_structure__Stress__and_Trauma-Alabama_Parenting_Questionnaire_–_Parent_Report
spec file and features saved to disk for features-Parent_Measures-Questionnaire_Measures_of_Family_structure__Stress__and_Trauma-PhenX_Neighborhood_Safety
spec file and features saved to disk for features-Parent_Measures-Questionnaire_Measures_of_Family_structure__Stress__and_Trauma-Distress_Tolerance_Scale
spec file and features saved to disk for features-Parent_Measures-Questionnaire_Measures_of_Family_structure__Stress__and_Trauma-Parenting_Stress_Index_Fourth_Edition
spec file and features saved to disk for features-Teacher_Measures-Questionnaire_Measures_of_Family_structure__Stress__and_Trauma-Questionnaire_Measures_of_Family_structure__Stress__and_Trauma
spec file and features saved to disk for target_DX_01_Cat_binarize
spec file and features saved to disk for target_DX_01_Cat_factorize
spec file and features saved to disk for target_DX_01_binarize
spec file and features saved to disk for target_DX_01_factorize
spec file and features saved to disk for target_Sex_binarize
What is the race breakdown of children with adhd?
= df.groupby(['DX_01', 'PreInt_Demos_Fam,Child_Race_cat']
demographics 'Identifiers': 'count',
).agg({
}).reset_index()
= px.bar(demographics, x="DX_01", y="Identifiers", color="PreInt_Demos_Fam,Child_Race_cat")
fig fig.show()
What is the sex breakdown of children with adhd?
largest M/F ratios are combined and hyperactive, but not inattentive
= df.groupby(['DX_01', 'Sex']
demographics 'Identifiers': 'count',
).agg({
}).reset_index()
= px.bar(demographics, x="DX_01", y="Identifiers", color="Sex")
fig fig.show()
What is the age breakdown of children with adhd?
= df.groupby(['DX_01', 'Age_bracket']
demographics 'Identifiers': 'count',
).agg({
}).reset_index()
= px.bar(demographics, x="DX_01", y="Identifiers", color="Age_bracket")
fig fig.show()
How many comorbidities do children with adhd have?
Girls have more combordities on average than boys (except for impulsive type)
= df.groupby(['DX_01', 'Sex']
demographics 'comorbidities': 'mean',
).agg({
}).reset_index()
= px.bar(demographics, x="DX_01", y="comorbidities", color='Sex')
fig fig.show()
How many comorbidities do children with adhd have?
Childrenn over10 have more combordities on average than children under10
= df.groupby(['DX_01', 'Age_bracket']
demographics 'comorbidities': 'mean',
).agg({
}).reset_index()
= px.bar(demographics, x="DX_01", y="comorbidities", color='Age_bracket')
fig fig.show()
get data from parent intake interview
What % of children with adhd have parents with adhd? Very few!
Previous diagnoses
Many children with adhd have been previously diagnosed with a psych/learning disorder
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat']
colors
for color in colors:
= df.groupby(['DX_01', color]).agg({'PreInt_TxHx,Past_DX': 'sum',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp['PreInt_TxHx,Past_DX'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y='percent', color=color,orientation='v', barmode="group")
fig fig.show()
about 25% of children with adhd are currently taking psych medication
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat']
colors
for color in colors:
= df.groupby(['DX_01',color]).agg({'PreInt_TxHx,psych_meds_cur': 'sum',
tmp 'PreInt_TxHx,psych_meds_past': 'sum',
'Identifiers': 'count'}
).reset_index()'percent_curr'] = tmp['PreInt_TxHx,psych_meds_cur'] / tmp['Identifiers']
tmp['percent_past'] = tmp['PreInt_TxHx,psych_meds_past'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y='percent_curr', color=color,orientation='v', barmode="group")
fig fig.show()
few children had immunication reactions
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat']
colors = 'immunization_reaction'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_TxHx,{var}': 'sum',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_TxHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y='percent', color=color,orientation='v', barmode="group")
fig fig.show()
10-20% of children have had food allergies
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat']
colors = 'food_allergy'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_TxHx,{var}': 'sum',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_TxHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y='percent', color=color,orientation='v', barmode="group")
fig fig.show()
Most children have attended an average of 2 schools
= ['Sex', 'Age_bracket']
colors = 'number_schools'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_EduHx,{var}': 'mean',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_EduHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y=f'PreInt_EduHx,{var}', color=color,orientation='v', barmode="group")
fig range=[1,4])
fig.update_yaxes( fig.show()
50-60% of children have an individualized education plan
more children over10 with hyperactive/impulsive have an IEP but more children under10 with inattentive have an IEP
= ['Sex', 'Age_bracket']
colors = 'IEP'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_EduHx,{var}': 'sum',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_EduHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y='percent', color=color,orientation='v', barmode="group")
fig range=[.1,.7])
fig.update_yaxes( fig.show()
learning disability?
few children with adhd diagnosed with a learning disability
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat', 'Age_bracket']
colors = 'learning_disability'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_EduHx,{var}': 'sum',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_EduHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y='percent', color=color,orientation='v', barmode="group")
fig fig.show()
neuropsych testing? pretty low numbers …
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat', 'Age_bracket']
colors = 'NeuroPsych'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_EduHx,{var}': 'sum',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_EduHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y='percent', color=color,orientation='v', barmode="group")
fig fig.show()
Recent grades (1-excellent, 5-failing)
= ['Sex','Age_bracket']
colors = 'recent_grades'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_EduHx,{var}': 'mean',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_EduHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y=f'PreInt_EduHx,{var}', color=color,orientation='v', barmode="group")
fig range=[1,3])
fig.update_yaxes( fig.show()
number of friends
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat', 'Age_bracket']
colors = 'number_friends'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_EduHx,{var}': 'mean',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_EduHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y=f'PreInt_EduHx,{var}', color=color,orientation='v', barmode="group")
fig range=[1,4])
fig.update_yaxes( fig.show()
outside school tutoring
40% of children with inattentive type adhd have outside tutoring
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat', 'Age_bracket']
colors = 'tutor'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_EduHx,{var}': 'sum',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_EduHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y='percent', color=color,orientation='v', barmode="group")
fig fig.show()
start of puberty
girls with adhd are starting puberty a lot earlier than boys - this tracks with children without a diagnosis. exception is boys with hyperactive adhd
= ['Sex', 'PreInt_Demos_Fam,Child_Race_cat']
colors = 'puberty_age'
var
for color in colors:
= df.groupby(['DX_01',color]).agg({f'PreInt_DevHx,{var}': 'mean',
tmp 'Identifiers': 'count'}
).reset_index()'percent'] = tmp[f'PreInt_DevHx,{var}'] / tmp['Identifiers']
tmp[
= px.bar(tmp, x="DX_01", y=f'PreInt_DevHx,{var}', color=color,orientation='v', barmode="group")
fig range=[8,12])
fig.update_yaxes( fig.show()
girls with hyperactive/impulsive adhd are starting menstruation earlier than other subtypes
= 'menstruation_age'
var
= df.groupby(['DX_01']).agg({f'PreInt_DevHx,{var}': 'mean',
tmp 'Identifiers': 'count'}
).reset_index()
= px.bar(tmp, x="DX_01", y=f'PreInt_DevHx,{var}',orientation='v', barmode="group")
fig range=[10,12])
fig.update_yaxes( fig.show()