I was trying out this library and I faced an issue while creating a subscription object from a json request. You may see the code and the error below.
code :
`
from fhir.resources.DSTU2.subscription import Subscription
data = {
"resourceType": "Subscription",
"id": "1882f571-520c-4c07-ba41-9b83fdb4eb3d",
"criteria": "ReferralRequest?_practitioner=Beck,Rachel MD&_encounter=Encounter/27300-AM0000120709",
"reason": "callback",
"channel": {
"type": "rest-hook",
"endpoint": "TBD",
"payload": "application/json"
}
}
sub = Subscription(**data)
error:
ValidationError Traceback (most recent call last)
in
----> 1 sub = Subscription(**data)
~/.local/lib/python3.9/site-packages/fhir/resources/DSTU2/fhirabstractmodel.py in init(pydantic_self, **data)
134 )
135 if errors:
--> 136 raise ValidationError(errors, pydantic_self.class)
137
138 BaseModel.init(pydantic_self, **data)
ValidationError: 1 validation error for Subscription
resource_type
Wrong ResourceType: fhir.resources.DSTU2.subscription.Subscription expects resource type Substance, but got Subscription. Make sure resource type name is correct and right ModelClass has been chosen. (type=value_error.wrong.resource_type; error=fhir.resources.DSTU2.subscription.Subscription expects resource type Substance, but got Subscription. Make sure resource type name is correct and right ModelClass has been chosen.)
Hi,
I was trying out this library and I faced an issue while creating a subscription object from a json request. You may see the code and the error below.
code :
error:
`