You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create an ImagingStudy resource associated with a patient (already created with fhir.resources) and then transform the resource into a JSON/XML object. I get the following error:
Traceback (most recent call last):
File "C:\Users\\PycharmProjects\pythonProject1\Prova_json_imagingstudy.py", line 13, in <module>
study = ImagingStudy()
File "C:\Users\\anaconda3\envs\pythonProject1\lib\site-packages\fhir\resources\core\fhirabstractmodel.py", line 105, in __init__
BaseModel.__init__(__pydantic_self__, **data)
File "pydantic\main.py", line 342, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for ImagingStudy
__root__ -> status
field required (type=value_error.missing)
My simple code is:
### from fhir.resources.imagingstudy import ImagingStudy
from fhir.resources.coding import Coding
from Prova_json_patient import my_patient
import uuid
# Create a new study object
study = ImagingStudy()
# Set the study resource fields
study.subject = 'Patient/' + my_patient.id
study.modality = Coding()
study.modality.code = 'CT'
study.modality.system = 'https://dicom.nema.org/resources/ontology/DCM'
study.id = 'urn:oid:' + str(uuid.uuid4())
study.status = 'available'
print(study.json())
Validation error with ImagingStudy resource
I am trying to create an ImagingStudy resource associated with a patient (already created with fhir.resources) and then transform the resource into a JSON/XML object. I get the following error:
How can this be solved and why does it happen?
@nazrulworld @mmabey @chgl @simonvadee
The text was updated successfully, but these errors were encountered: