Closed themantalope closed 3 months ago
I know this is very late, but yes - that's the strategy for embedding data in a DocumentReference.
See the spec and how it marks data
as a base64Binary
field.
It is lightly annoying that you have to then encode that as a unicode string for fhirclient
's benefit, but that's the current workflow.
Hi all,
I'm very new to FHIR and I'm learning. Any help is much appreciated. I'm trying to attach a PDF file to a document reference for a patient. I'm using the following code:
When I try running this code, I get an error stating that
Expecting property "data" on <class 'fhirclient.models.attachment.Attachment'> to be <class 'str'>, but is <class 'bytes'>
. How should the binary data be stored?I could do something like:
Where now
pdf_b64_m
is a UTF-8 encoded string. Is this the correct way to store the data? I would then be able to re-encode it back to binary, but I want to make sure that this is correct so other programs that download the data from the server can interpret the PDF correctly.