Skip to content

Commit

Permalink
WIP: reinstating abilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Filienko committed Dec 1, 2023
1 parent 56dd2c9 commit d33de4f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions patientsearch/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def post_resource(resource_type):
resource = new_resource_hook(resource)
method = request.method
params = request.args
# params["active"] = True

audit_HAPI_change(
user_info=current_user_info(token),
method=method,
Expand Down Expand Up @@ -533,10 +533,9 @@ def external_search(resource_type):
resource_type=resource_type,
resource=patient,
)
patient["active"] = True
local_fhir_patient = HAPI_request(
token=token, method=method, resource_type="Patient", resource=patient, params={
"active": True
})
token=token, method=method, resource_type="Patient", resource=patient)
except (RuntimeError, ValueError) as error:
return jsonify_abort(status_code=400, message=str(error))
audit_entry(
Expand Down
12 changes: 6 additions & 6 deletions patientsearch/models/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def different(src, dest):

params = patient_as_search_params(internal_patient)
# Ensure it is active
params["active"] = True
internal_patient["active"] = True
return HAPI_request(
token=token,
method="PUT",
Expand All @@ -215,7 +215,7 @@ def different(src, dest):
internal_patient["identifier"] = src_patient["identifier"]
params = patient_as_search_params(internal_patient)
# Ensure it is active
params["active"] = True
internal_patient["active"] = True
return HAPI_request(
token=token,
method="PUT",
Expand Down Expand Up @@ -311,20 +311,20 @@ def sync_patient(token, patient):

# No match, insert and return
patient = new_resource_hook(resource=patient)
patient["active"] = True
return HAPI_request(
token=token, method="POST", resource_type="Patient", resource=patient, params={
"active": True
}
token=token, method="POST", resource_type="Patient", resource=patient,
)


def restore_patient(token, patient):
"""Restore single internal patient resource"""
# Set patient to active
patient["active"] = True

return HAPI_request(
token=token,
method="PUT",
params={"active": True},
resource_type="Patient",
resource=patient,
resource_id=patient["id"],
Expand Down

0 comments on commit d33de4f

Please sign in to comment.