a b/ehrkit/README.md
1
# EHRKit Documentation
2
## Directory Structure
3
* EHRKit
4
  * ehrkit
5
    * ehrkit.py
6
    * solr_lib.py
7
    * classes.py
8
  * external
9
    * icd9
10
      * status: incorporated but doesn't seem useful
11
    * patient2vec
12
      * status: not yet incorporated
13
      * could be useful:
14
    * phrase-at-scale
15
      * status: incorporated, but only a crude version
16
      * problem: does not return the phrases but outputs it to files
17
  * scripts
18
    * helper scripts for handling data
19
    * see README_scripts for more descriptions
20
  * tests
21
    * see README_tests for more descriptions
22
23
## ehrkit.py functions
24
* helper functions:
25
  * *def start_session(db_user, db_pass): -> dict*:
26
  * *def createPatient(data):*
27
  * *def flatten(lst):*
28
  * *def numbered_print(lst):*
29
  * *def init_embedding_model():*
30
  * *def get_abbs_sent_ids(text):*
31
  * *def post_single_dict_to_solr(d: dict, core: str)-> None*
32
  * *def abbs_disambiguate(ABB):*
33
  * *def get_documents_solr(query):*
34
35
* *class ehr_db*
36
  * attributes:
37
    * *cnx* -- MySQL connection object
38
    * *cur* -- MySQL cursor
39
    * *patients = {}* -- Patient (from classes.py) dictionary
40
  * methods:
41
    * *def close_session(self):*
42
    * *def get_patients(self, n):*
43
    * *def count_patients(self):*
44
    * *def count_gender(self, gender):*
45
    * *def count_docs(self, query, getAll = False, inverted = False):*
46
    * *def get_note_events(self):*
47
    * *def longest_NE(self):*
48
    * *def get_document(self, id):*
49
    * *def get_all_patient_document_ids(self, patientID):*
50
    * *def list_all_patient_ids(self):*
51
    * *def list_all_document_ids(self):*
52
    * *def get_document_sents(self, docID):*
53
    * *def get_abbreviations(self, doc_id):*
54
    * *def get_abbreviation_sent_ids(self, doc_id):*
55
    * *def get_documents_d(self, date):*
56
    * *def get_documents_q(self, query, n = -1):*
57
    * *def get_documents_icd9_alt(self,query):*
58
    * *def get_documents_icd9(self,code):*
59
    * *def get_prescription(self):*
60
    * *def extract_key_words(self, text):*
61
    * *def count_all_prescriptions(self):*
62
    * *def get_diagnoses(self):*
63
    * *def get_procedures(self):*
64
    * *def extract_patient_words(self, patientID):*
65
    * *def output_note_events_file_by_patients(self, directory):*
66
    * *def output_note_events_discharge_summary(self, directory):*
67
68
  * yet to refactor:
69
    * *def extract_key_words(self, text):*
70
    * *def get_abbreviations(self, doc_id):*
71
    * *def get_abbreviation_sent_ids(self, doc_id):*
72
  * unfinished:
73
    * *def docs_with_phrase(self, phrase):*
74
    * *def outputAbbreviation(self, directory):*
75
    * *def extract_phrases(self, docID):*