Skip to content

Commit

Permalink
Fixup: No reason get_or_create_patient shouldn't have a docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmiller committed Dec 21, 2022
1 parent d169f07 commit 7e5c1c4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions intrahospital_api/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,22 @@ def _load_patient(patient, patient_load):


def get_or_create_patient(mrn, episode_category, run_async=None):
"""
Given an MRN, either return a Patient alredy in elCID with that
identifier, or create a new patient.
Creates an episode of EPISODE_CATEGORY for this patient if they
do not already have one.
Like Django `.get_or_create` this function returns a tuple of
(object, bool) where BOOL is whether or not this patient has
been created, or already existed.
As some MRNs are inactive but still exist within the system, it
is possible that this function returns a patient with a different
primary identifier (`Demographics.hospital_number`) to the value
passed in as MRN.
"""
patient = Patient.objects.filter(
demographics__hospital_number=mrn
).first()
Expand Down

0 comments on commit 7e5c1c4

Please sign in to comment.