Ejemplo n.º 1
0
 def setup(self, unused_timeout=15):
     '''
     create a ConceptExtractor and initialize the patient status
     the list here is the complete list
     '''
     '''
     self.ce1 = CE.ConceptExtractor("Concept_List_1.csv")
     self.ce1.StatusInit()
     self.ce2 = CE.ConceptExtractor("Concept_List_2.csv")
     self.ce2.StatusInit()
     '''
     vcl = pd.read_csv(self.exlist)
     blackboard = Blackboard()
     self.sce = CE.CEWithoutMM(self.slist, self.intlist,\
     AllinOne_SS = self.aio_ss, AllinOne_Int = self.aio_int,\
      neg_res = self.neg_res, WDistance = self.WDistance, aio_only = self.aio_only)
     self.sce.StatusInit()
     for item in vcl:
         self.sce.SpecificInit(item)
     self.vce = CE.ConceptExtractor(self.vlist)
     #self.vce.StatusInit()
     #self.ice = CE.ConceptExtractor(self.intlist)
     #self.ice.StatusInit()
     if self.inC:
         self.vce.ConceptWrapper(self.inC)
     blackboard.Signs = self.sce.Status
     blackboard.Vitals = self.vce.Status
     blackboard.Inters = self.sce.Interventions
     blackboard.ConcLog = []
     return True
Ejemplo n.º 2
0
 def setup(self, unused_timeout = 15):
     '''
     create a ConceptExtractor and initialize the patient status
     the list here is the complete list
     '''
     '''
     self.ce1 = CE.ConceptExtractor("Concept_List_1.csv")
     self.ce1.StatusInit()
     self.ce2 = CE.ConceptExtractor("Concept_List_2.csv")
     self.ce2.StatusInit()
     '''
     vcl = pd.read_csv(self.exlist)
     blackboard = Blackboard()
     self.sce = CE.ConceptExtractor(self.slist)
     self.sce.StatusInit()
     for item in vcl:
         self.sce.SpecificInit(item)
     self.vce = CE.ConceptExtractor(self.vlist)
     #self.vce.StatusInit()
     self.ice = CE.ConceptExtractor(self.intlist)
     self.ice.StatusInit()
     if self.inC:
         self.vce.ConceptWrapper(self.inC)
     blackboard.Signs = self.sce.Status
     blackboard.Vitals = self.vce.Status
     blackboard.Inters = self.ice.Status
     blackboard.ConcLog = []
     return True
Ejemplo n.º 3
0
    def setup(self, unused_timeout=15):
        '''
        create a ConceptExtractor and initialize the patient status
        the list here is the complete list
        '''
        '''
        self.ce1 = CE.ConceptExtractor("Concept_List_1.csv")
        self.ce1.StatusInit()
        self.ce2 = CE.ConceptExtractor("Concept_List_2.csv")
        self.ce2.StatusInit()
        '''
        vcl = pd.read_csv(self.exlist)
        blackboard = Blackboard()
        # Signs and Symptoms Concept Extractor
        self.sce = CE.ConceptExtractor(self.slist)
        self.sce.StatusInit()
        for item in vcl:
            self.sce.SpecificInit(item)
# Vital Signs Concept Extractor
        self.vce = CE.ConceptExtractor(self.vlist)
        #self.vce.StatusInit()
        # Interventions Concept Extractor
        self.ice = CE.ConceptExtractor(self.intlist)
        self.ice.StatusInit()
        self.vce.StatusInit()
        if self.inC:
            self.vce.ConceptWrapper(self.inC)
# The list of vital signs we support (from RAA data)
        pool = ['Pulse', 'Resp', 'BP', 'GCS', 'Glucose', 'SPO2', 'Pain', 'EKG']
        for item in pool:
            self.vce.SpecificInit(item)
        blackboard.Signs = self.sce.Status
        blackboard.Vitals = self.vce.Status
        blackboard.Inters = self.ice.Status
        blackboard.ConcLog = []
        return True
Ejemplo n.º 4
0
    def Vital2Symptom(self):
        '''
        pulse-85  tachy > 100 extreme tachy >150 bradicardia <= 50
        resp-16  8 - 24 fast slow normal
        bp-164/101  hyper age + 100 hypo < 70 normal mbp =  (sbp + 2*dbp)/3 
        gcs-15 decreased mental status <= 14
        glucose-101  hyper >300 hypo <60
        spo2-100 94 - 99 
        pain-9 pain severity
        '''
        # pulse to bradycardia or tachycardia
        if len(self.vce.Status['pulse'].content) > 0:
            if self.vce.Status['pulse'].value and self.vce.Status['pulse'].value.isdigit():
                pr = int(self.vce.Status['pulse'].value)

                if pr > 100:
                    self.sce.Status['tachycardia'] = CE.PatientStatus('tachycardia',True,str(pr),'pulse')
                    self.sce.Status['tachycardia'].score = self.vce.Status['pulse'].score
                elif pr <= 50:
                    self.sce.Status['bradycardia'] = CE.PatientStatus('bradycardia',True,str(pr),'pulse')
                    self.sce.Status['bradycardia'].score = self.vce.Status['pulse'].score
        # resp rate symptoms
        if len(self.vce.Status['resp'].content) > 0:
            if self.vce.Status['resp'].value and self.vce.Status['resp'].value.isdigit():
                rr = int(self.vce.Status['resp'].value)
                if rr > 24:
                    self.sce.Status['tachypnea'] = CE.PatientStatus('tachypnea',True,str(rr),'resp')
                    self.sce.Status['tachypnea'].score = self.vce.Status['resp'].score
                elif rr < 8:
                    self.sce.Status['bradypnea'] = CE.PatientStatus('bradypnea',True,str(rr),'resp')
                    self.sce.Status['bradypnea'].score = self.vce.Status['resp'].score
                
        # blood pressure symptoms
        if len(self.vce.Status['bp'].content) > 0:
            if self.vce.Status['bp'].value and '/' in self.vce.Status['bp'].value:
                temp = self.vce.Status['bp'].value.strip().split('/')
                if temp[0] and temp[1] and temp[0].isdigit() and temp[1].isdigit():
                    bp = [int(temp[0]), int(temp[1])]
                    mbp = (bp[0] + 2 * bp[1])/3
                    if bp[0] >= 140 or bp[1] >= 90:
                        self.sce.Status['hypertension'] = CE.PatientStatus('hypertension',True,str(bp[0]),'bp')
                        self.sce.Status['hypertension'].score = self.vce.Status['bp'].score
                    elif mbp < 70:
                        self.sce.Status['hypotension'] = CE.PatientStatus('hypotension',True,str(mbp),'bp')
                        self.sce.Status['hypotension'].score = self.vce.Status['bp'].score
                    
        # gcs symptoms
        if len(self.vce.Status['gcs'].content) > 0:
            if self.vce.Status['gcs'].value and self.vce.Status['gcs'].value.isdigit():
                gcs = int(self.vce.Status['gcs'].value)
                if gcs < 15:
                    self.sce.Status['decreased mental status'] = CE.PatientStatus('decreased mental status',True,str(gcs),'gcs')
                    self.sce.Status['decreased mental status'].score = self.vce.Status['gcs'].score
                
        # glucose symptoms
        if len(self.vce.Status['glucose'].content) > 0:
            if self.vce.Status['glucose'].value and self.vce.Status['glucose'].value.isdigit():
                glu = int(self.vce.Status['glucose'].value)
                if glu > 300:
                    self.sce.Status['hyperglycemia'] = CE.PatientStatus('hyperglycemia',True,str(glu),'glucose')
                    self.sce.Status['hyperglycemia'].score = self.vce.Status['glucose'].score
                elif glu < 60:
                    self.sce.Status['hypoglycemia'] = CE.PatientStatus('hypoglycemia',True,str(glu),'glucose')
                    self.sce.Status['hypoglycemia'].score = self.vce.Status['glucose'].score
                
        # spo2 symptoms
        if len(self.vce.Status['spo2'].content) > 0:
            if self.vce.Status['spo2'].value and self.vce.Status['spo2'].value.isdigit():
                spo2 = int(self.vce.Status['spo2'].value)
                if spo2 < 94:
                    self.sce.Status['hypoxemia'] = CE.PatientStatus('hypoxemia',True,str(spo2),'spo2')
                    self.sce.Status['hypoxemia'].score = self.vce.Status['spo2'].score
                
        # pain
        if len(self.vce.Status['pain'].content) > 0:
            if self.vce.Status['pain'].value and self.vce.Status['pain'].value.isdigit():
                ps = int(self.vce.Status['pain'].value)
                self.sce.Status['pain severity'] = CE.PatientStatus('pain severity',True,str(ps),'pain')
                self.sce.Status['pain severity'].score = self.vce.Status['pain'].score
        
        # ekg symptoms
        if len(self.vce.Status['ekg'].content) > 0:
            ekg = self.vce.Status['ekg'].value
            if "Sinus_Arrhythmia" in ekg:
                self.sce.Status['dysrhythmia'] = CE.PatientStatus('dysrhythmia',True,ekg,'ekg')
                self.sce.Status['dysrhythmia'].score = self.vce.Status['ekg'].score
            else:
                self.sce.Status['dysrhythmia'] = CE.PatientStatus('dysrhythmia',False,ekg,'ekg')
                self.sce.Status['dysrhythmia'].score = self.vce.Status['ekg'].score
            if "_Bradycardia" in ekg:
                self.sce.Status['bradycardia'] = CE.PatientStatus('bradycardia',True,ekg,'ekg')
                self.sce.Status['bradycardia'].score = self.vce.Status['ekg'].score
            if "_Tachycardia" in ekg:
                self.sce.Status['tachycardia'] = CE.PatientStatus('tachycardia',True,ekg,'ekg')
                self.sce.Status['tachycardia'].score = self.vce.Status['ekg'].score
  
        return True
Ejemplo n.º 5
0
    def Vital2Symptom(self):
        '''
	Rules for checking the values of vitals and transform them into signs and symptoms.
        Pulse-85  tachy > 100 extreme tachy >150 bradicardia <= 50
        Resp-16  8 - 24 fast slow normal
        BP-164/101  hyper age + 100 hypo < 70 normal mbp =  (sbp + 2*dbp)/3 
        GCS-15 decreased mental status <= 14
        Glucose-101  hyper >300 hypo <60
        SPO2-100 94 - 99 
        Pain-9 pain severity
        '''
        # Pulse to bradycardia or tachycardia
        if len(self.vce.vtLog['Pulse']) > 0:
            for v in self.vce.vtLog['Pulse']:
                pr = int(v)
                if pr > 100:
                    self.sce.Status['tachycardia'] = CE.PatientStatus(
                        'tachycardia', True, str(pr), 'Pulse')
                    self.sce.Status['tachycardia'].score = 1000.
                elif pr <= 50:
                    self.sce.Status['bradycardia'] = CE.PatientStatus(
                        'bradycardia', True, str(pr), 'Pulse')
                    self.sce.Status['bradycardia'].score = 1000.
        # Resp rate symptoms
        if len(self.vce.vtLog['Resp']) > 0:
            for v in self.vce.vtLog['Resp']:
                rr = int(v)
                if rr > 24:
                    self.sce.Status['tachypnea'] = CE.PatientStatus(
                        'tachypnea', True, str(rr), 'Resp')
                    self.sce.Status['tachypnea'].score = 1000.
                elif rr < 8:
                    self.sce.Status['bradypnea'] = CE.PatientStatus(
                        'bradypnea', True, str(rr), 'Resp')
                    self.sce.Status['bradypnea'].score = 1000.

        # blood pressure symptoms
        if len(self.vce.vtLog['BP']) > 0:
            for v in self.vce.vtLog['BP']:
                if '/' not in v:
                    continue
                bp = [int(n) for n in v.strip().split('/')]
                mbp = (bp[0] + 2 * bp[1]) / 3
                if bp[0] > 140 and bp[1] > 90:
                    self.sce.Status['hypertension'] = CE.PatientStatus(
                        'hypertension', True, str(bp[0]), 'BP')
                    self.sce.Status['hypertension'].score = 1000.
                elif mbp < 70:
                    self.sce.Status['hypotension'] = CE.PatientStatus(
                        'hypotension', True, str(mbp), 'BP')
                    self.sce.Status['hypotension'].score = 1000.

        # GCS symptoms
        if len(self.vce.vtLog['GCS']) > 0:
            for v in self.vce.vtLog['GCS']:
                gcs = int(v)
                if gcs < 15:
                    self.sce.Status[
                        'decreased mental status'] = CE.PatientStatus(
                            'decreased mental status', True, str(gcs), 'GCS')
                    self.sce.Status['decreased mental status'].score = 1000.

        # glucose symptoms
        if len(self.vce.vtLog['Glucose']) > 0:
            for v in self.vce.vtLog['Pulse']:
                glu = int(v)
                if glu > 300:
                    self.sce.Status['hyperglycemia'] = CE.PatientStatus(
                        'hyperglycemia', True, str(glu), 'Glucose')
                    self.sce.Status['hyperglycemia'].score = 1000.
                elif glu < 60:
                    self.sce.Status['hypoglycemia'] = CE.PatientStatus(
                        'hypoglycemia', True, str(glu), 'Glucose')
                    self.sce.Status['hypoglycemia'].score = 1000.

        # spo2 symptoms
        if len(self.vce.vtLog['SPO2']) > 0:
            for v in self.vce.vtLog['SPO2']:
                spo2 = int(v)
                if spo2 < 94:
                    self.sce.Status['hypoxemia'] = CE.PatientStatus(
                        'hypoxemia', True, str(spo2), 'SPO2')
                    self.sce.Status['hypoxemia'].score = 1000.

        # pain
        if len(self.vce.vtLog['Pain']) > 0:
            for v in self.vce.vtLog['Pain']:
                ps = int(v)
                self.sce.Status['pain severity'] = CE.PatientStatus(
                    'pain severity', True, str(ps), 'Pain')
                self.sce.Status['pain severity'].score = 1000.

        # EKG symptoms
        if len(self.vce.vtLog['EKG']) > 0:
            for v in self.vce.vtLog['Pulse']:
                ekg = v
                if "Sinus_Arrhythmia" in ekg:
                    self.sce.Status['dysrhythmia'] = CE.PatientStatus(
                        'dysrhythmia', True, ekg, 'EKG')
                    self.sce.Status['dysrhythmia'].score = 1000.
                else:
                    self.sce.Status['dysrhythmia'] = CE.PatientStatus(
                        'dysrhythmia', False, ekg, 'EKG')
                    self.sce.Status['dysrhythmia'].score = 1000.
                if "_Bradycardia" in ekg:
                    self.sce.Status['bradycardia'] = CE.PatientStatus(
                        'bradycardia', True, ekg, 'EKG')
                    self.sce.Status['bradycardia'].score = 1000.
                if "_Tachycardia" in ekg:
                    self.sce.Status['tachycardia'] = CE.PatientStatus(
                        'tachycardia', True, ekg, 'EKG')
                    self.sce.Status['tachycardia'].score = 1000.

        return True