Skip to content

Instantly share code, notes, and snippets.

@knowtheory
Forked from anonymous/gist:5446542
Created April 23, 2013 19:20
Show Gist options
  • Save knowtheory/5446555 to your computer and use it in GitHub Desktop.
Save knowtheory/5446555 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 18 13:10:10 2013
@author: Owner
"""
import sys
import csv
import time
from easygui import *
def MedicalHistory():
ReturnDict = {}
ReturnDict["Date Unknown"] = choicebox("Date medical history taken is unknown or undocumented?", "", ["Yes","No"])
if ReturnDict["Date Unknown"] == "No":
ReturnDict["Medical Hx Date"] = enterbox("Date Medical History taken:","","")
while True:
try:
time.strptime(ReturnDict["Medical Hx Date"], "%d-%m-%Y") #using strptime to check date formatting, kinda kludgy.
except ValueError:
info[0] = enterbox("Date formatting error, please enter it again in the format dd-mm-yyyy.","")
continue
break
ConditionList = ["Stroke", "Ischemic stroke", "Hemorrhagic stroke", "Cerebral aneurysm", "Dural sinus/cerebral venous thrombosis", "Transient ischemic attack (TIA)", "Cerebral arteriovenous malformation (AVM)", "Fibromuscular dysplasia", "Carotid stenosis", "Epilepsy/seizure disorder", "Central nervous system (CNS) infection", "Head trauma", "Bodily trauma", "Atrial fibrillation/flutter", "Rheumatic heart disease", "Coronary artery disease", "Myocardial infarction", "Angina", "Valvular heart disease", "Major surgery", "Cardiac surgery", "Artificial valve", "Coronary stent or percutaneous transluminal coronary angioplasty (PTCA)", "Congestive heart failure", "Congenital heart disease", "Patent foramen ovale", "Chronic obstructive pulmonary disorder (COPD)", "Peripheral vascular disease", "Peripheral arterial disease", "Hypertension", "Diabetes mellitus", "Dyslipidemia", "Hypercholesteremia", "Cancer", "Systemic malignancy", "Current chemotherapy", "Sickle cell anemia", "Hypercoagulable disorder", "Inflammatory bowel disease", "Renal insufficiency", "Renal failure", "Liver disease", "Sleep apnea", "Somatization", "Migraines", "Dementia"]
for x in ConditionList:
ReturnDict[ConditionList[x]] = "No/Not documented"
HistoryYNList = multchoicebox("Does the patient have a documented medical history (prior or current) of the following? (Select all that apply)","",ConditionList)
for x in HistoryYNList:
ReturnDict[HistoryYNList[x]] = "Yes"
if "Hemorrhagic stroke" in HistoryYNList:
ReturnDict["Hemorrhagic Stroke Type"] = choicebox("Type of prior hemorrhagic stroke:","",["Intracerebral hemorrhage", "Subarachnoid hemorrhage", "Unspecified","Unknown/Not documented"])
if "Head trauma" in HistoryYNList:
ReturnDict["Head trauma results"] = multchoicebox("Indicate if head trauma resulted in any of the following:","",["Loss of consciousness > 30 minutes", "Post-traumatic amnesia > 24 hours", "Abnormal brain imaging findings", "None of the above", "Unknown/Not documented"])
if "Cardiac surgery" in HistoryYNList:
ReturnDict["Cardiac Surgery Type"] = multchoicebox("Type of prior cardiac surgery:","",["Coronary artery bypass graft (CABG)", "Cardiac valve surgery, including non-open (e.g. percutaneous valvuloplasty)", "Other", "Unknown/Not documented"])
if ReturnDict["Cardiac Surgery Type"] == "Other":
ReturnDict["Other Cardiac Surgery"] = enterbox("Please specify type of other cardiac surgery:","","")
if "Artificial valve" in HistoryYNList:
ReturnDict["Valve Type"] = multchoicebox("Type of artificial valve:","",["Biological/Tissue valve", "Mechanical/Non-tissue valve", "Valvuloplasty", "Unknown/Not documented"]
if "Hypertension" in HistoryYNList:
ReturnDict["Hypertension Age"] = integerbox("Age hypertension first diagnosed, 0 if unknown/undocumented")
if "Diabetes mellitus" in HistoryYNList:
ReturnDict["Diabetes Age"] = integerbox("Age diabetes first diagnosed, 0 if unknown/undocumented")
ReturnDict["Diabetes Complications"] = multchoicebox("Complications of diabetes:","",["Nephropathy","Neuropathy","Retinopathy","Other","None of the above"])
ReturnDict["Diabetes Treatment"] = multchoicebox("Current treatment for diabetes:","",["Diet", "Oral medication", "Insulin", "None of the above", "Unknown/Not Documented"])
if "Cancer" in HistoryYNList:
ReturnDict["Cancer Type"] = multchoicebox("Type(s) of cancer (select all that apply):","",["Brain", "Breast", "Colorectal", "Endometrial", "Lung", "Prostate", "Renal (kidney)", "Skin", "Other"])
if "Hypercoagulable disorder" in HistoryYNList:
ReturnDict["Hypercoagulable type:"] = enterbox("Type of primary hypercoagulable disorder:","")
ReturnDict["Pregnancy"] = choicebox("Patient is pregnant or in the postpartum period?","",["Yes", "No", "Not Documented"])
if ReturnDict["Pregnancy"] = "Yes":
ReturnDict["Pregnancy State"] = choicebox("Specify current pregnancy state:","",["Pre-partum 1st trimester","Pre-partum 2nd trimester","Pre-partum 3rd trimester","Active labor","Postpartum first 24 hours","Postpartum first week","Postpartum > 1 week"])
return ReturnDict
a = SocialStatus()
print(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment