Skip to content

Commit

Permalink
Merge pull request #4 from chop-dbhi/dev
Browse files Browse the repository at this point in the history
Add organization subject id label
  • Loading branch information
Tyler Rivera authored Nov 3, 2016
2 parents ba6239b + 057826f commit 2776833
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ehb_client/requests/subject_request_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand All @@ -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
}
Expand Down

0 comments on commit 2776833

Please sign in to comment.