Skip to content

Fixup FHIR compliance; add missing resource nesting #1045

Fixup FHIR compliance; add missing resource nesting

Fixup FHIR compliance; add missing resource nesting #1045

GitHub Actions / Black failed Nov 19, 2024 in 0s

2 errors

Black found 2 errors

Annotations

Check failure on line 175 in /home/runner/work/cosri-patientsearch/cosri-patientsearch/patientsearch/models/sync.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/cosri-patientsearch/cosri-patientsearch/patientsearch/models/sync.py#L164-L175

         raise ValueError(f"Expected bundle; can't process {bundle.get('resourceType')}")
 
     for entry in bundle.get("entry"):
         # Restrict to what is expected for now
         if entry["resource"]["resourceType"] != "Patient":
-            raise ValueError(f"Can't sync resourceType {entry['resource']['resourceType']}")
+            raise ValueError(
+                f"Can't sync resourceType {entry['resource']['resourceType']}"
+            )
 
         patient = sync_patient(token, entry["resource"], consider_active)
         # TODO handle multiple external matches (if it ever happens!)
         # currently returning first
         return patient

Check failure on line 638 in /home/runner/work/cosri-patientsearch/cosri-patientsearch/patientsearch/api.py

See this annotation in the file changed.

@github-actions github-actions / Black

/home/runner/work/cosri-patientsearch/cosri-patientsearch/patientsearch/api.py#L627-L638

     # TODO: handle multiple patient results
     if external_match_count > 1:
         audit_entry("multiple patients returned from PDMP", extra=extra, level="warn")
 
     if external_match_count:
-        external_search_bundle["entry"][0]["resource"].setdefault("id", local_fhir_patient["id"])
+        external_search_bundle["entry"][0]["resource"].setdefault(
+            "id", local_fhir_patient["id"]
+        )
 
     message = "PDMP found match" if external_match_count else "fEMR found match"
     audit_entry(message, extra=extra)
     return jsonify(external_search_bundle)