diff --git a/fhir_utils/fhir/patient/resource.py b/fhir_utils/fhir/patient/resource.py index 8e91a56..d681e01 100644 --- a/fhir_utils/fhir/patient/resource.py +++ b/fhir_utils/fhir/patient/resource.py @@ -13,7 +13,7 @@ import logging -@dataclass +@dataclass() class Patient: source : str name : str @@ -316,7 +316,7 @@ def merge(self, new_resource, force_invalid_merge: False): def to_fhir(self): - # BUILD MORE COMPLEX STRUCTURES + # BUILD MORE COMPLEX DATA STRUCTURES # Identifier identifier = [] @@ -340,8 +340,8 @@ def to_fhir(self): identifier.append(cns) # Name - name = {"use": "official", - "text": self.name} + name = [{"use": "official", + "text": self.name}] # Extensions extension = [] diff --git a/tests/unit/fhir/resource/test_data/patient_data.json b/tests/unit/fhir/resource/test_data/patient_data.json index 34bd6f3..7d40fc3 100644 --- a/tests/unit/fhir/resource/test_data/patient_data.json +++ b/tests/unit/fhir/resource/test_data/patient_data.json @@ -28,10 +28,12 @@ } ], "active": true, - "name": { + "name": [ + { "use": "official", "text": "John Doe" - }, + } + ], "telecom": [ { "system": "phone",