Exemple #1
0
    def set_result(self, result):
        """Extends superclass for convenience

        Keyword arguments:
        result -- the results
        """

        if result:
            for test in result:
                if RUN_FLASK:
                    uri = url_for('obs_record', log_id=test.id)
                else:
                    uri = dumb_url_generate(['Observation', test.id])
                display = test.rec_name
                ref=supermod.ResourceReference()
                ref.display = supermod.string(value=display)
                ref.reference = supermod.string(value=uri)
                super(health_DiagnosticReport, self).add_result(ref)

            # No data = useless
            if len(self.get_result()) == 0:
                raise ValueError('No data')

        else:
            # No data = useless
            raise ValueError('No data')
Exemple #2
0
 def __set_gnu_medication(self):
     if self.medication_statement:
         med = attrgetter(self.map['medication'])(self.medication_statement)
         if RUN_FLASK:
             uri = url_for('med_record', log_id=med.id)
         else:
             uri = dumb_url_generate(['Medication', med.id])
         display = med.active_component
         ref = supermod.ResourceReference()
         ref.display = supermod.string(value=display)
         ref.reference = supermod.string(value=uri)
         self.set_medication(ref)
Exemple #3
0
 def __set_gnu_patient(self):
     """Set the patient info"""
     if self.medication_statement:
         patient = attrgetter(self.map['patient'])(
             self.medication_statement)
         if RUN_FLASK:
             uri = url_for('pat_record', log_id=patient.id)
         else:
             uri = dumb_url_generate(['Patient', patient.id])
         display = patient.rec_name
         ref = supermod.ResourceReference()
         ref.display = supermod.string(value=display)
         ref.reference = supermod.string(value=uri)
         self.set_patient(ref)
    def set_asserter(self, asserter):
        """Extends superclass for convenience

        Keyword arguments:
        asserter -- the practitioner (Health model)
        """

        if asserter:
            if RUN_FLASK:
                uri = url_for('hp_record', log_id=asserter.id)
            else:
                uri = dumb_url_generate(['Practitioner', asserter.id])
            display = asserter.rec_name
            ref = supermod.ResourceReference()
            ref.display = supermod.string(value=display)
            ref.reference = supermod.string(value=uri)
            super(health_Condition, self).set_asserter(ref)
    def set_subject(self, subject):
        """Extends superclass for convenience

        Keyword arguments:
        subject -- patient (Health model)
        """

        if subject:
            if RUN_FLASK:
                uri = url_for('pat_record', log_id=subject.id)
            else:
                uri = dumb_url_generate(['Patient', subject.id])
            display = subject.rec_name
            ref = supermod.ResourceReference()
            ref.display = supermod.string(value=display)
            ref.reference = supermod.string(value=uri)
            super(health_Condition, self).set_subject(ref)
Exemple #6
0
    def set_performer(self, performer):
        """Extends superclass for convenience

        Keyword arguments:
        performer -- the lab performer (Health model)
        """

        if performer:
            if RUN_FLASK:
                uri = url_for('hp_record', log_id=performer.id)
            else:
                uri = dumb_url_generate(['Practitioner', performer.id])
            display = performer.name.rec_name
            ref=supermod.ResourceReference()
            ref.display = supermod.string(value=display)
            ref.reference = supermod.string(value=uri)
            super(health_DiagnosticReport, self).set_performer(ref)
    def set_careProvider(self, care_provider):
        """Extends superclass for convienience

        Set patient's care provider

        Keyword arguments:
        care_provider -- health professional model
        """

        if care_provider:
            if RUN_FLASK:
                uri = url_for('hp_record', log_id=care_provider.id)
            else:
                uri = dumb_url_generate(['Practitioner', care_provider.id])
            display = care_provider.rec_name
            ref = supermod.ResourceReference()
            ref.display = supermod.string(value=display)
            ref.reference = supermod.string(value=uri)
            super(health_Patient, self).set_careProvider([ref])
Exemple #8
0
    def set_subject(self, subject):
        """Extends superclass for convenience

        Keyword arguments:
        subject -- the patient (Health model)
        """

        if subject:
            patient = attrgetter(self.map['subject'])(self.diagnostic_report)
            if RUN_FLASK:
                uri = url_for('pat_record', log_id=subject.id)
            else:
                uri = dumb_url_generate(['Patient', subject.id])
            display = subject.rec_name
            ref=supermod.ResourceReference()
            ref.display = supermod.string(value=display)
            ref.reference = supermod.string(value=uri)
            super(health_DiagnosticReport, self).set_subject(ref)

        else:
            # Without subject, useless information
            raise ValueError('No subject')
    def set_subject(self, subject):
        """Extends superclass for convenience

        Set subject (usually patient); mandatory

        Keyword arguments:
        subject -- the subject (Health model)
        """

        if subject:
            try:
                if RUN_FLASK:
                    uri = url_for('pat_record', log_id=subject.id)
                else:
                    uri = dumb_url_generate('/Patient', str(subject.id))
                display = subject.name.rec_name
                ref = supermod.ResourceReference()
                ref.display = supermod.string(value=display)
                ref.reference = supermod.string(value=uri)
            except:
                raise
            else:
                super(health_Observation, self).set_subject(ref)
    def set_performer(self, performer):
        """Extends superclass for convenience

        Set who/what captured the observation

        Keyword arguments:
        performer -- who performed the observation (Health model)
        """

        if performer:
            try:
                if RUN_FLASK:
                    uri = url_for('hp_record', log_id=performer.id)
                else:
                    uri = dumb_url_generate('/Practitioner', str(performer.id))
                display = performer.name.rec_name
                ref = supermod.ResourceReference()
                ref.display = supermod.string(value=display)
                ref.reference = supermod.string(value=uri)
            except:
                # Not absolutely needed, so continue execution
                pass
            else:
                super(health_Observation, self).set_performer([ref])