From 057826fd070e27e6a83ad7db83b763234d6ceac8 Mon Sep 17 00:00:00 2001 From: Tyler Rivera Date: Thu, 3 Nov 2016 12:50:55 -0400 Subject: [PATCH] Add organization subject id label --- ehb_client/requests/subject_request_handler.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ehb_client/requests/subject_request_handler.py b/ehb_client/requests/subject_request_handler.py index 4dcc2e8..4c230c0 100644 --- a/ehb_client/requests/subject_request_handler.py +++ b/ehb_client/requests/subject_request_handler.py @@ -6,11 +6,13 @@ class Subject(IdentityBase): def __init__(self, first_name=None, last_name=None, organization_id=-1, - organization_subject_id=-1, dob=-1, modified=None, created=None, id=-1): + organization_subject_id=-1, organization_id_label='MRN', + dob=-1, modified=None, created=None, id=-1): self.first_name = first_name self.last_name = last_name self.organization_id = organization_id # eHB id of the associated Organization object self.organization_subject_id = organization_subject_id # id used by the Organization for this subject + self.organization_id_label = organization_id_label self.dob = dob self.modified = modified self.created = created @@ -37,13 +39,16 @@ def identity_from_jsonObject(jsonObj): ln = jsonObj.get('last_name') org_id = int(jsonObj.get('organization')) org_subj_id = jsonObj.get('organization_subject_id') + org_id_label = jsonObj.get('organization_id_label') dob = RequestBase.dateFromString(jsonObj.get('dob')) lm = RequestBase.dateTimeFromJsonString(jsonObj.get('modified')) c = RequestBase.dateTimeFromJsonString(jsonObj.get('created')) id = int(jsonObj.get('id')) - return Subject(first_name=fn, last_name=ln, organization_id=org_id, - organization_subject_id=org_subj_id, dob=dob, - modified=lm, created=c, id=id) + sub = Subject(first_name=fn, last_name=ln, organization_id=org_id, + organization_subject_id=org_subj_id, + organization_id_label=org_id_label, dob=dob, + modified=lm, created=c, id=id) + return sub @staticmethod def identity_from_json(subjectJsonString): @@ -61,6 +66,7 @@ def json_from_identity(subject): 'group_name': subject.group_name, 'organization_subject_id': subject.organization_subject_id, 'organization': subject.organization_id, + 'organization_id_label': subject.organization_id_label, 'dob': RequestBase.stringFromDate(subject.dob), 'id': subject.id }