forked from uwcirg/helloworld-confidential-client-sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration to recalculate the next-outgoing extension for all active
patients.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Migration script generated for recalculate-next-outgoing-times | ||
revision = '17f3b60d-0777-4d0e-bb32-82e670b573a7' | ||
down_revision = 'None' | ||
|
||
import logging | ||
from isacc_messaging.models.fhir import next_in_bundle | ||
from isacc_messaging.models.isacc_patient import IsaccPatient as Patient | ||
|
||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') | ||
|
||
|
||
def upgrade(): | ||
# iterate over active patients; confirm/set next-outgoing extension | ||
active_patients = Patient.active_patients() | ||
for json_patient in next_in_bundle(active_patients): | ||
patient = Patient(json_patient) | ||
patient.mark_next_outgoing(persist_on_change=True) | ||
logging.info('corrected next-outgoing-times') | ||
|
||
|
||
def downgrade(): | ||
# Nothing to undo | ||
logging.info('downgraded') | ||
|