Closed Henry6789 closed 2 years ago
Hi @Henry6789 ,
what is the type of patient.reference
?
Could you try to use patient.to_reference()
there?
Another way suggested by @ruscoder is to just use subject=patient
:
device = client.resource(
"Device",
identifier={
"type": {
'coding': [
{
"system": 'https://hl7.org/fhir/ValueSet/identifier-type',
"code": 'SNO'
}
]
},
"value": sn
},
subject=patient
)
@mkizesov Type of patient.reference is str, which is ok as far as I know. It's content is like "Patient/100". Saving observations with the same patient reference works, which means the issue is device related. The alternative by @ruscoder is very nice (will use this from now on), but the resulting reference is not saved either. Maybe the issue is caused by the HAPI FHIR server (version 4.1.0) that I'm talking to. Can you try if you can save a device with patient reference? Thanks in advance!
Problem solved. The FHIR server that I'm using (mentioned above) supports FHIR standard R4.0.1. R4.0.1 uses the 'patient' field to refer to a patient, while later FHIR releases (like 4.6.0) use the 'subject' field. Sorry for raising an issue here, and thx for the support!
You are welcome. Also had a thought that it could be a server-related issue. So I close this issue.
Hi all,
Just before execution of the last line (device.save) the variable 'device' contains the field 'subject' as specified, but immediately after execution of that line the subject field is gone. Anyone an idea why? The device is stored successfully, but without reference to a patient.