Skip to content

Commit

Permalink
WIP: fixing cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
Filienko committed Dec 1, 2023
1 parent 6fea39f commit acc8449
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
13 changes: 4 additions & 9 deletions isacc_messaging/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,13 @@ def update_patient_extensions(dry_run):
patient.mark_followup_extension(persist_on_change=not dry_run)


@base_blueprint.cli.command("maintenance-update-patient-param")
@click.option('-param_to_update', default='active', help='Parameter to update for the patient')
@click.option('-value', default='True', help='Value to set for the parameter')
def update_patient_params(param_to_update, value):
@base_blueprint.cli.command("maintenance-reinstate-patients-with-param")
def update_patient_params():
"""Iterate through all patients, update any the parameter values for all of them"""
if value.lower() in ('true', 'false'):
value = value.lower() in ('true') # Convert to boolean

from isacc_messaging.models.fhir import next_in_bundle
from isacc_messaging.models.isacc_patient import IsaccPatient as Patient
all_patients = Patient.all_patients()
for json_patient in next_in_bundle(all_patients):
patient = Patient(json_patient)
patient.update({param_to_update:value})

patient.active = True
patient.persist()
10 changes: 0 additions & 10 deletions isacc_messaging/models/isacc_patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,3 @@ def persist(self):
resource=self.as_json())
return response


def update(self, params):
"""Update self params at FHIR store"""
response = HAPI_request(
method="PUT",
resource_type=self.resource_type,
resource_id=self.id,
resource=self.as_json(),
params=params)
return response

0 comments on commit acc8449

Please sign in to comment.