Skip to content

Instantly share code, notes, and snippets.

@dcshapiro
Created December 18, 2017 04:43
Show Gist options
  • Save dcshapiro/5ccc3507d274854b4e6e2c2db2e5461a to your computer and use it in GitHub Desktop.
Save dcshapiro/5ccc3507d274854b4e6e2c2db2e5461a to your computer and use it in GitHub Desktop.
Data collection for mock medical notes and billing code generation
import pandas as pd
from random import shuffle
import random
import names
bodyParts = ['ankle', 'arch', 'arm', 'armpit', 'beard', 'breast', 'calf', 'cheek', 'chest', 'chin', 'earlobe', 'elbow', 'eyebrow', 'eyelash', 'eyelid', 'face', 'finger', 'forearm', 'forehead', 'gum', 'heel', 'hip', 'index finger', 'jaw', 'knee', 'knuckle', 'leg', 'lip', 'mouth', 'mustache', 'nail', 'neck', 'nostril', 'palm', 'pinkie', 'pupil', 'scalp', 'shin', 'shoulder', 'sideburns', 'thigh', 'throat', 'thumb', 'tongue', 'tooth', 'waist', 'wrist']
psychDisorders = ['Alcohol Addiction','Drug Addiction','Caffeine Addiction','Cannabis Addiction','Hallucinogen Addiction','Inhalant Addiction','Opioid Addiction','Sedative, Hypnotic, Anxiolytic Addiction','Stimulant Addiction','Tobacco Addiction','Gambling Addiction','Agoraphobia','Generalized Anxiety Disorder','Panic Disorder','Selective Mutism','Separation Anxiety Disorder','Social Anxiety Disorder','Specific Phobias','Bipolar Disorder','Cyclothymia','Other Bipolar Disorders','Major Depression','Dysthymia (now called Persistent Depressive Disorder)','Postpartum Depression','Premenstrual Dysphoric Disorder','Seasonal Affective Disorder','Depersonalization / Derealization Disorder','Dissociative Amnesia','Dissociative Fugue','Dissociative Identity Disorder','Other Dissociative Disorders','Anorexia Nervosa','Binge Eating Disorder','Bulimia Nervosa','Pica','Conduct Disorder','Intermittent Explosive Disorder','Kleptomania','Oppositional Defiant Disorder','Pyromania','Alzheimer’s Disease','Amnestic Disorder','Delerium','Huntington’s Disease','Neurocognitive Disorder (formerly called Dementia)','Parkinson’s Disease','Other Neurocognitive Disorders','Asperger’s Syndrome','Attention Deficit Hyperactivity Disorder','Autism Spectrum Disorder','Childhood Disintegrative Disorder','Childhood Onset Fluency Disorder','Dyslexia','Intellectual Development Disorder','Language Disorder','Learning Disorders','Retts Disorder','Tourettes Syndrome','Other Neurodevelopmental Disorders','Body Dysmorphic Disorder','Obsessive-Compulsive Disorder','Trichotillomania','Other Obsessive-Compulsive Disorders','Antisocial Personality Disorder','Avoidant Personality Disorder','Borderline Personality Disorder','Dependent Personality Disorder','Histrionic Personality Disorder','Narcissistic Personality Disorder','Obsessive-Compulsive Personality Disorder','Paranoid Personality Disorder','Schizoid Personality Disorder','Schizotypal Personality Disorder','Other Personality Disorders','Brief Psychotic Disorder','Delusional Disorder','Schizoaffective Disorder','Schizophrenia','Shared Psychotic Disorder','Other Psychotic Disorders','Breathing-Related Sleep Disorder','Circadian Rhythm Disorders','Hypersomnia','Insomnia','Narcolepsy','Nightmare Disorder','Non Rapid Eye Movement','REM Sleep Behavior Disorder','Restless Leg Syndrome','Sleep Arousal Disorders','Other Sleep Disorders','Conversion Disorder','Factitious Disorder','Hypochondriasis','Malingering','Munchausen Syndrome','Munchausen by Proxy','Somatization Disorder','Other Somatic Disorders','Acute Stress Disorder','Adjustment Disorder','Posttraumatic Stress Disorder','Reactive Attachment Disorder','Other Trauma Disorders']
vaccines = ['ACAM2000','ActHIB','Adacel','Afluria','AFLURIA QUADRIVALENT','Agriflu','BCG Vaccine','BEXSERO','Biothrax','Boostrix','Cervarix','Comvax','DAPTACEL','Engerix-B','FLUAD','Fluarix','Fluarix Quadrivalent','Flublok','Flublok Quadrivalent','Flucelvax','Flucelvax Quadrivalent','FluLaval','FluLaval Quadrivalent','FluMist','FluMist Quadrivalent','Fluvirin','Fluzone Quadrivalent','Fluzone, Fluzone High-Dose and Fluzone Intradermal','Gardasil','Gardasil 9','Havrix','HEPLISAV-B','Hiberix','Imovax','Infanrix','IPOL','Ixiaro','JE-Vax','KINRIX','M-M-R II','M-M-Vax','Menactra','MenHibrix','Menomune-A/C/Y/W-135','Menveo','Pediarix','PedvaxHIB','Pentacel','Pneumovax 23','Poliovax','Prevnar 13','ProQuad','Quadracel','RabAvert','Recombivax HB','ROTARIX','RotaTeq','SHINGRIX','TENIVAC','TICE BCG','TRUMENBA','Twinrix','TYPHIM Vi','VAQTA','Varivax','Vaxchora','Vivotif','YF-Vax','Zostavax']
actionList=['bodyPart','psychDisorder','vaccine','hasCold','catAllergy','dogAllergy','lactoseIntolerant','looksPale']
def nextVisitAction(item):
chance = (random.randint(1,100))
if item is 'bodyPart':
#15% chance that dr writes the patient was treated on body part (CODE1)
if chance <=15:
note='Patient '+random.choice(bodyParts)+' was injured and was treated.'
return note, 1
else:
return '', 0
elif item is 'psychDisorder':
#20% chance that dr writes the patient was treated for a mental disorder (CODE2)
if chance <=20:
note='Patient was diagnosed with and treated for '+random.choice(psychDisorders) +'.'
return note, 2
else:
return '', 0
elif item is 'vaccine':
if chance <=5:
#5% chance that dr writes the patient was treated with a vaccine (CODE3)
note='Patient was administered the vaccice '+random.choice(vaccines) +'.'
return note, 3
else:
return '', 0
elif item is 'hasCold':
if chance <=15:
return 'It appears the patient has a mild virus.', 0
else:
return '', 0
elif item is 'catAllergy':
if chance <=15:
if chance <=7:
return 'The patient is mildly allergic to cats.', 0
return 'The patient is dealthly allergic to cats.', 0
else:
return '', 0
elif item is 'dogAllergy':
if chance <=15:
if chance <=7:
return 'The patient is mildly allergic to dogs.', 0
return 'The patient is dealthly allergic to dogs.', 0
else:
return '', 0
elif item is 'lactoseIntolerant':
if chance <=15:
if chance <=7:
return 'The patient is lactose intolerant.', 0
return 'The patient is very lactose intolerant.', 0
else:
return '', 0
elif item is 'looksPale':
if chance <=15:
return 'The patient looks very pale.', 0
else:
return '', 0
return item+'MISTAKE. Probably a BUG. WHAAAA!', 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment