Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions doctoshotgun.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ def get_patients(self):

return self.page.get_patients()

def get_patient_age(self):
birthdate = datetime.datetime.strptime(
self.patient['birthdate'], '%Y-%m-%d').date()
today = datetime.date.today()
return today.year - birthdate.year - ((today.month, today.day) < (birthdate.month, birthdate.day))

@classmethod
def normalize(cls, string):
nfkd = unicodedata.normalize('NFKD', string)
Expand Down Expand Up @@ -822,6 +828,17 @@ def main(self, cli_args=None):
else:
motives.append(docto.KEY_ASTRAZENECA)

if docto.get_patient_age() < 18:
# Removing moderna based on eligibility rules
log('Including only Pfizer vaccines as patient is under 18', color='yellow')
inclusions = (docto.KEY_PFIZER_SECOND, docto.KEY_PFIZER, docto.KEY_PFIZER_THIRD)
motives = [motive for motive in motives if motive in inclusions]
elif docto.get_patient_age() < 30:
# Removing moderna based on eligibility rules
log('Excluding Moderna vaccine as patient is under 30', color='yellow')
exclusions = (docto.KEY_MODERNA_SECOND, docto.KEY_MODERNA, docto.KEY_MODERNA_THIRD)
motives = [motive for motive in motives if motive not in exclusions]

vaccine_list = [docto.vaccine_motives[motive] for motive in motives]

if args.start_date:
Expand Down