-
Notifications
You must be signed in to change notification settings - Fork 0
/
scoring_script.py
37 lines (29 loc) · 18.1 KB
/
scoring_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import logging
import json
import numpy as np
import pip
pip.main([
'install', 'joblib'
])
classes = ['abdominal aortic aneurysm', 'abdominal hernia', 'abscess of nose', 'abscess of the lung', 'abscess of the pharynx', 'acanthosis nigricans', 'acariasis', 'achalasia', 'acne', 'actinic keratosis', 'acute bronchiolitis', 'acute bronchitis', 'acute bronchospasm', 'acute fatty liver of pregnancy (aflp)', 'acute glaucoma', 'acute kidney injury', 'acute otitis media', 'acute pancreatitis', 'acute respiratory distress syndrome (ards)', 'acute sinusitis', 'acute stress reaction', 'adhesive capsulitis of the shoulder', 'adjustment reaction', 'adrenal adenoma', 'adrenal cancer', 'alcohol abuse', 'alcohol intoxication', 'alcohol withdrawal', 'alcoholic liver disease', 'allergy', 'allergy to animals', 'alopecia', 'alzheimer disease', 'amblyopia', 'amyloidosis', 'amyotrophic lateral sclerosis (als)', 'anal fissure', 'anal fistula', 'anemia', 'anemia due to chronic kidney disease', 'anemia due to malignancy', 'anemia of chronic disease', 'angina', 'ankylosing spondylitis', 'anxiety', 'aortic valve disease', 'aphakia', 'aphthous ulcer', 'aplastic anemia', 'appendicitis', 'arrhythmia', 'arthritis of the hip', 'ascending cholangitis', 'asperger syndrome', 'aspergillosis', 'asthma', 'astigmatism', 'atelectasis', "athlete's foot", 'atonic bladder', 'atrial fibrillation', 'atrial flutter', 'atrophic skin condition', 'atrophic vaginitis', 'atrophy of the corpus cavernosum', 'attention deficit hyperactivity disorder (adhd)', 'autism', 'autonomic nervous system disorder', 'avascular necrosis', 'balanitis', 'bell palsy', 'benign kidney cyst', 'benign paroxysmal positional vertical (bppv)', 'benign prostatic hyperplasia (bph)', 'benign vaginal discharge (leukorrhea)', 'bipolar disorder', 'birth trauma', 'bladder cancer', 'bladder disorder', 'bladder obstruction', 'blepharitis', 'blepharospasm', 'bone cancer', 'bone disorder', 'bone spur of the calcaneous', 'brachial neuritis', 'brain cancer', 'breast cancer', 'breast cyst', 'breast infection (mastitis)', 'broken tooth', 'bunion', 'burn', 'bursitis', 'callus', 'carbon monoxide poisoning', 'carcinoid syndrome', 'cardiac arrest', 'cardiomyopathy', 'carpal tunnel syndrome', 'cat scratch disease', 'cataract', 'celiac disease', 'cellulitis or abscess of mouth', 'central atherosclerosis', 'central retinal artery or vein occlusion', 'cerebral edema', 'cerebral palsy', 'cervical cancer', 'cervical disorder', 'cervicitis', 'chalazion', 'chickenpox', 'chlamydia', 'cholecystitis', 'choledocholithiasis', 'cholesteatoma', 'chondromalacia of the patella', 'chorioretinitis', 'chronic back pain', 'chronic constipation', 'chronic glaucoma', 'chronic inflammatory demyelinating polyneuropathy (cidp)', 'chronic kidney disease', 'chronic knee pain', 'chronic obstructive pulmonary disease (copd)', 'chronic otitis media', 'chronic pain disorder', 'chronic pancreatitis', 'chronic rheumatic fever', 'chronic sinusitis', 'chronic ulcer', 'cirrhosis', 'coagulation (bleeding) disorder', 'cold sore', 'colonic polyp', 'colorectal cancer', 'common cold', 'complex regional pain syndrome', 'concussion', 'conduct disorder', 'conductive hearing loss', 'congenital heart defect', 'congenital malformation syndrome', 'conjunctivitis', 'conjunctivitis due to allergy', 'conjunctivitis due to bacteria', 'conjunctivitis due to virus', 'connective tissue disorder', 'contact dermatitis', 'conversion disorder', 'cornea infection', 'corneal abrasion', 'corneal disorder', 'coronary atherosclerosis', 'cranial nerve palsy', 'crohn disease', 'croup', 'crushing injury', 'cryptococcosis', 'cryptorchidism', 'cushing syndrome', 'cyst of the eyelid', 'cystic fibrosis', 'cysticercosis', 'cystitis', 'de quervain disease', 'decubitus ulcer', 'deep vein thrombosis (dvt)', 'degenerative disc disease', 'delirium', 'dementia', 'dengue fever', 'dental caries', 'depression', 'dermatitis due to sun exposure', 'developmental disability', 'deviated nasal septum', 'diabetes', 'diabetes insipidus', 'diabetic ketoacidosis', 'diabetic kidney disease', 'diabetic peripheral neuropathy', 'diabetic retinopathy', 'diaper rash', 'dislocation of the ankle', 'dislocation of the elbow', 'dislocation of the finger', 'dislocation of the foot', 'dislocation of the hip', 'dislocation of the knee', 'dislocation of the patella', 'dislocation of the shoulder', 'dislocation of the vertebra', 'dislocation of the wrist', 'dissociative disorder', 'diverticulitis', 'diverticulosis', 'down syndrome', 'drug abuse', 'drug abuse (barbiturates)', 'drug abuse (cocaine)', 'drug abuse (methamphetamine)', 'drug abuse (opioids)', 'drug poisoning due to medication', 'drug reaction', 'drug withdrawal', 'dry eye of unknown cause', 'dumping syndrome', 'dyshidrosis', 'dysthymic disorder', 'ear drum damage', 'ear wax impaction', 'eating disorder', 'ectopic pregnancy', 'ectropion', 'eczema', 'edward syndrome', 'emphysema', 'empyema', 'encephalitis', 'endocarditis', 'endometrial cancer', 'endometrial hyperplasia', 'endometriosis', 'endophthalmitis', 'envenomation from spider or animal bite', 'ependymoma', 'epididymitis', 'epidural hemorrhage', 'epilepsy', 'erectile dysfunction', 'erythema multiforme', 'esophageal cancer', 'esophageal varices', 'esophagitis', 'essential tremor', 'eustachian tube dysfunction (ear disorder)', 'extrapyramidal effect of drugs', 'eye alignment disorder', 'factitious disorder', 'female genitalia infection', 'female infertility of unknown cause', 'fetal alcohol syndrome', 'fibroadenoma', 'fibrocystic breast disease', 'fibromyalgia', 'flat feet', 'floaters', 'flu', 'fluid overload', 'folate deficiency', 'food allergy', 'foreign body in the ear', 'foreign body in the eye', 'foreign body in the gastrointestinal tract', 'foreign body in the nose', 'foreign body in the throat', 'foreign body in the vagina', 'fracture of the ankle', 'fracture of the arm', 'fracture of the facial bones', 'fracture of the finger', 'fracture of the foot', 'fracture of the hand', 'fracture of the jaw', 'fracture of the leg', 'fracture of the neck', 'fracture of the patella', 'fracture of the pelvis', 'fracture of the rib', 'fracture of the shoulder', 'fracture of the skull', 'fracture of the vertebra', 'friedrich ataxia', 'frostbite', 'fungal infection of the hair', 'fungal infection of the skin', 'g6pd enzyme deficiency', 'galactorrhea of unknown cause', 'gallstone', 'ganglion cyst', 'gas gangrene', 'gastritis', 'gastroduodenal ulcer', 'gastroesophageal reflux disease (gerd)', 'gastrointestinal hemorrhage', 'gastroparesis', 'genital herpes', 'gestational diabetes', 'glaucoma', 'glucocorticoid deficiency', 'goiter', 'gonorrhea', 'gout', 'granuloma inguinale', 'graves disease', 'guillain barre syndrome', 'gum disease', 'gynecomastia', 'hammer toe', 'hashimoto thyroiditis', 'head and neck cancer', 'head injury', 'headache after lumbar puncture', 'heart attack', 'heart block', 'heart contusion', 'heart failure', 'heat exhaustion', 'heat stroke', 'hemangioma', 'hemarthrosis', 'hematoma', 'hemiplegia', 'hemochromatosis', 'hemolytic anemia', 'hemophilia', 'hemorrhoids', 'hepatic encephalopathy', 'hepatitis due to a toxin', 'herniated disk', 'herpangina', 'hiatal hernia', 'hidradenitis suppurativa', 'high blood pressure', 'hirschsprung disease', 'hirsutism', 'histoplasmosis', 'hormone disorder', 'hpv', 'human immunodeficiency virus infection (hiv)', 'huntington disease', 'hydatidiform mole', 'hydrocele of the testicle', 'hydrocephalus', 'hydronephrosis', 'hypercalcemia', 'hypercholesterolemia', 'hyperemesis gravidarum', 'hypergammaglobulinemia', 'hyperhidrosis', 'hyperkalemia', 'hyperlipidemia', 'hypernatremia', 'hyperopia', 'hyperosmotic hyperketotic state', 'hypertension of pregnancy', 'hypertensive heart disease', 'hypertrophic obstructive cardiomyopathy (hocm)', 'hypocalcemia', 'hypoglycemia', 'hypokalemia', 'hyponatremia', 'hypothermia', 'hypothyroidism', 'hypovolemia', 'idiopathic absence of menstruation', 'idiopathic excessive menstruation', 'idiopathic infrequent menstruation', 'idiopathic irregular menstrual cycle', 'idiopathic nonmenstrual bleeding', 'idiopathic painful menstruation', 'ileus', 'impetigo', 'impulse control disorder', 'indigestion', 'induced abortion', 'infection of open wound', 'infectious gastroenteritis', 'ingrown toe nail', 'inguinal hernia', 'injury of the ankle', 'injury to internal organ', 'injury to the abdomen', 'injury to the arm', 'injury to the face', 'injury to the finger', 'injury to the hand', 'injury to the hip', 'injury to the knee', 'injury to the leg', 'injury to the shoulder', 'injury to the spinal cord', 'injury to the trunk', 'insect bite', 'insulin overdose', 'interstitial lung disease', 'intertrigo (skin condition)', 'intestinal cancer', 'intestinal disease', 'intestinal malabsorption', 'intestinal obstruction', 'intracerebral hemorrhage', 'intracranial abscess', 'intracranial hemorrhage', 'intussusception', 'iridocyclitis', 'iron deficiency anemia', 'irritable bowel syndrome', 'ischemia of the bowel', 'ischemic heart disease', 'itching of unknown cause', 'jaw disorder', 'joint effusion', 'juvenile rheumatoid arthritis', 'kaposi sarcoma', 'kidney cancer', 'kidney disease due to longstanding hypertension', 'kidney failure', 'kidney stone', 'knee ligament or meniscus tear', 'labyrinthitis', 'lactose intolerance', 'laryngitis', 'lateral epicondylitis (tennis elbow)', 'leukemia', 'lewy body dementia', 'lice', 'lichen planus', 'lichen simplex', 'lipoma', 'liver cancer', 'liver disease', 'lumbago', 'lung cancer', 'lung contusion', 'lyme disease', 'lymphadenitis', 'lymphangitis', 'lymphedema', 'lymphogranuloma venereum', 'lymphoma', 'macular degeneration', 'magnesium deficiency', 'malaria', 'male genitalia infection', 'malignant hypertension', 'marijuana abuse', 'mastectomy', 'mastoiditis', 'meckel diverticulum', 'melanoma', 'meniere disease', 'meningioma', 'meningitis', 'menopause', 'metabolic disorder', 'metastatic cancer', 'migraine', 'missed abortion', 'mitral valve disease', 'mittelschmerz', 'molluscum contagiosum', 'mononeuritis', 'mononucleosis', 'moyamoya disease', 'mucositis', 'multiple myeloma', 'multiple sclerosis', 'mumps', 'muscle spasm', 'muscular dystrophy', 'myasthenia gravis', 'myelodysplastic syndrome', 'myocarditis', 'myoclonus', 'myopia', 'myositis', 'narcolepsy', 'nasal polyp', 'necrotizing fasciitis', 'neonatal jaundice', 'nerve impingement near the shoulder', 'neuralgia', 'neurofibromatosis', 'neuropathy due to drugs', 'neurosis', 'nonalcoholic liver disease (nash)', 'noninfectious gastroenteritis', 'normal pressure hydrocephalus', 'nose disorder', 'obesity', 'obsessive compulsive disorder (ocd)', 'obstructive sleep apnea (osa)', 'omphalitis', 'onychomycosis', 'open wound due to trauma', 'open wound from surgical incision', 'open wound of the abdomen', 'open wound of the arm', 'open wound of the back', 'open wound of the cheek', 'open wound of the chest', 'open wound of the ear', 'open wound of the eye', 'open wound of the face', 'open wound of the finger', 'open wound of the foot', 'open wound of the hand', 'open wound of the head', 'open wound of the jaw', 'open wound of the knee', 'open wound of the lip', 'open wound of the mouth', 'open wound of the neck', 'open wound of the nose', 'open wound of the shoulder', 'oppositional disorder', 'optic neuritis', 'oral leukoplakia', 'oral mucosal lesion', 'oral thrush (yeast infection)', 'orbital cellulitis', 'orthostatic hypotension', 'osteoarthritis', 'osteochondroma', 'osteochondrosis', 'osteomyelitis', 'osteoporosis', "otitis externa (swimmer's ear)", 'otitis media', 'otosclerosis', 'ovarian cancer', 'ovarian cyst', 'ovarian torsion', 'overflow incontinence', 'pain after an operation', 'pain disorder affecting the neck', 'pancreatic cancer', 'panic attack', 'panic disorder', 'parasitic disease', 'parathyroid adenoma', 'parkinson disease', 'paronychia', 'paroxysmal supraventricular tachycardia', 'paroxysmal ventricular tachycardia', 'pelvic fistula', 'pelvic inflammatory disease', 'pelvic organ prolapse', 'pemphigus', 'pericarditis', 'peripheral arterial disease', 'peripheral arterial embolism', 'peripheral nerve disorder', 'perirectal infection', 'peritonitis', 'peritonsillar abscess', 'persistent vomiting of unknown cause', 'personality disorder', 'peyronie disease', 'pharyngitis', 'phimosis', 'pilonidal cyst', 'pinguecula', 'pinworm infection', 'pituitary adenoma', 'pituitary disorder', 'pityriasis rosea', 'placenta previa', 'placental abruption', 'plantar fasciitis', 'pleural effusion', 'pneumoconiosis', 'pneumonia', 'pneumothorax', 'poisoning due to analgesics', 'poisoning due to anticonvulsants', 'poisoning due to antidepressants', 'poisoning due to antihypertensives', 'poisoning due to antimicrobial drugs', 'poisoning due to antipsychotics', 'poisoning due to ethylene glycol', 'poisoning due to gas', 'poisoning due to opioids', 'poisoning due to sedatives', 'polycystic kidney disease', 'polycystic ovarian syndrome (pcos)', 'polycythemia vera', 'polymyalgia rheumatica', 'post-traumatic stress disorder (ptsd)', 'postoperative infection', 'postpartum depression', 'preeclampsia', 'pregnancy', 'premature atrial contractions (pacs)', 'premature ovarian failure', 'premature rupture of amniotic membrane', 'premature ventricular contractions (pvcs)', 'premenstrual tension syndrome', 'presbyacusis', 'presbyopia', 'priapism', 'primary immunodeficiency', 'primary insomnia', 'primary kidney disease', 'primary thrombocythemia', 'problem during pregnancy', 'prostate cancer', 'prostatitis', 'protein deficiency', 'pseudohypoparathyroidism', 'pseudotumor cerebri', 'psoriasis', 'psychosexual disorder', 'psychotic disorder', 'pterygium', 'pulmonary congestion', 'pulmonary embolism', 'pulmonary eosinophilia', 'pulmonary fibrosis', 'pulmonary hypertension', 'pulmonic valve disease', 'pyelonephritis', 'pyloric stenosis', 'pyogenic skin infection', 'raynaud disease', 'reactive arthritis', 'rectal disorder', 'restless leg syndrome', 'retinal detachment', 'retinopathy due to high blood pressure', 'rhabdomyolysis', 'rheumatic fever', 'rheumatoid arthritis', 'rocky mountain spotted fever', 'rosacea', 'rotator cuff injury', 'salivary gland disorder', 'sarcoidosis', 'scabies', 'scar', 'scarlet fever', 'schizophrenia', 'sciatica', 'scleritis', 'scleroderma', 'scoliosis', 'scurvy', 'seasonal allergies (hay fever)', 'sebaceous cyst', 'seborrheic dermatitis', 'seborrheic keratosis', 'sensorineural hearing loss', 'sepsis', 'septic arthritis', 'shingles (herpes zoster)', 'sialoadenitis', 'sick sinus syndrome', 'sickle cell anemia', 'sickle cell crisis', 'sinus bradycardia', 'sjogren syndrome', 'skin cancer', 'skin disorder', 'skin pigmentation disorder', 'skin polyp', 'smoking or tobacco addiction', 'social phobia', 'soft tissue sarcoma', 'spasm of the larynx', 'spider bite', 'spinal cord injury', 'spinal cord tumor', 'spinal stenosis', 'sporotrichosis', 'squamous cell carcinoma', 'staphylococcal infection', 'stasis dermatitis and ulcers', 'steven johnson syndrome', 'stomach cancer', 'stomach disorder', 'stomach flu', 'stomach ulcer', 'stress', 'stroke', 'stye', 'subacute thyroiditis', 'subarachnoid hemorrhage', 'subconjunctival hemorrhage', 'substance abuse', 'substance withdrawal syndrome', 'sudden cardiac arrest', 'sudden infant death syndrome (sids)', 'superficial thrombophlebitis', 'superior vena cava syndrome', 'supraventricular tachycardia', 'sweating disorder', 'syphilis', 'systemic lupus erythematosus (sle)', 'tachycardia', 'tardive dyskinesia', 'tendinitis', 'testicular cancer', 'testicular torsion', 'thoracic aortic aneurysm', 'thoracic outlet syndrome', 'thoracic radiculopathy', 'throat abscess', 'thrombocytopenia', 'thrombophlebitis', 'thymoma', 'thyroid cancer', 'thyroid disorder', 'thyrotoxic crisis', 'tick bite', 'tinea corporis', 'tinea cruris', 'tinea pedis', 'tinnitus', 'tongue cancer', 'torticollis', 'toxic shock syndrome', 'toxic synovitis', 'tracheitis', 'transient ischemic attack (tia)', 'transient synovitis', 'transurethral resection of the prostate (turp)', 'trauma to the breast', 'traumatic amputation', 'traumatic injury', 'traumatic rupture of the diaphragm', 'trichomoniasis', 'trigeminal neuralgia', 'tuberculosis', 'tumor of the brain', 'tumor of the eye', 'tumor of the eyelid', 'tumor of the larynx', 'tumor of the nose', 'tumor of the pharynx', 'tumor of the pituitary gland', 'tumor of the salivary gland', 'tumor of the thyroid gland', 'tympanic membrane rupture', 'typhoid fever', 'ulcer of the mouth', 'ulcerative colitis', 'ulcerative proctitis', 'umbilical hernia', 'unconsciousness', 'unstable angina', 'uremia', 'urinary tract infection', 'urinary tract obstruction', 'urinary tract stone', 'urinary urgency and frequency', 'uterine cancer', 'uterine fibroid', 'uterine prolapse', 'uterine sarcoma', 'uterine spasm', 'uveitis', 'vaginal cancer', 'vaginal discharge with odor', 'vaginal dryness', 'vaginal infection', 'vaginal yeast infection', 'vaginismus', 'varicella pneumonia', 'varicocele', 'varicose vein', 'vasculitis', 'venous insufficiency', 'vertebral compression fracture', 'vertigo', 'viral gastroenteritis', 'viral hemorrhagic fever', 'viral hepatitis', 'viral infection', 'viral pharyngitis', 'vitamin b12 deficiency', 'vitamin c deficiency', 'vitamin d deficiency', 'vitamin k deficiency', 'vitreous hemorrhage', 'vocal cord dysfunction', 'vocal cord paralysis', 'vomiting of blood', 'vulvar cancer', 'vulvar dysplasia', 'vulvovaginal candidiasis', 'vulvovaginitis', 'vulvovaginitis due to a parasite', 'vulvovaginitis due to a sexually transmitted disease', 'vulvovaginitis due to bacteria', 'vulvovaginitis due to fungus', 'vulvovaginitis due to protozoa', 'wasp sting', 'water intoxication', 'wheezing', 'whiplash', 'whooping cough', 'wilms tumor', 'wound infection', 'yeast infection', 'yellow fever', 'yellow nail syndrome', 'zika fever']
import joblib
def init():
global model
model_path = os.path.join(
os.getenv("AZUREML_MODEL_DIR"), "model/model.pkl"
)
model = joblib.load(model_path)
logging.info("init completed!")
def run(raw_data):
logging.info("model: request received!")
data = json.loads(raw_data)['data']
data = np.array(data)
result = model.predict_proba(data)
output = {}
classes.sort()
for i in range(0, len(result[0].tolist())):
print(i)
# print(f"current proba: {result.tolist()[i]}")
output[classes[i]] = result[0].tolist()[i]
return output