Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling Binary - read raw json file #67

Open
ageryck opened this issue Jul 8, 2024 · 2 comments
Open

Handling Binary - read raw json file #67

ageryck opened this issue Jul 8, 2024 · 2 comments

Comments

@ageryck
Copy link
Collaborator

ageryck commented Jul 8, 2024

Currently, the gateway expects an encoded JSON file with the data attribute holding the raw JSON details, this requires that the json is posted to HAPI when encoded already into base64 file, gateway then hits the resource URI to get the encoded json and use it to decode then read the appid.
The android client on the other hand accesses the binary files using the endpoint /Binary to get all the binaries it requires from the server, the challenge comes when the binary is posted as an encoded json the HAPI (v7.2.0) re-encodes it again when access using the /Binary endpoint as opposed to individual resource URI, this means that for the android client to get a singly encoded json we must post non-encoded json.

This issue is to make gateway read the raw json file it gets so as not to throw this error below;
{ "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "processing", "diagnostics": "HAPI-1359: Failed to parse response from server when performing GET to URL

@dubdabasoduba
Copy link
Member

@ageryck @lincmba here is some additional context

Performing a PUT with application/fhir+json as the Content-Type stops the FHIR server from encoding the body which is already a Binary resource.

Performing a GET/{{uuid}} with application/fhir+json as the Content-Type stops the FHIR server from decoding the response from the server.

Performing a GET/{{uuid}} with application/json as Content-Type allows the FHIR server to decode the response. The response is the actual image.

Performing a GET all with application/json as Content-Type does not trigger decoding on the server response. This is what the mobile application uses. Hence the need to decode using code.

Screenshots

Screenshot 2024-06-19 at 23 50 19

Screen.Recording.2024-06-19.at.23.50.40.mov

@ageryck
Copy link
Collaborator Author

ageryck commented Jul 9, 2024

@dubdabasoduba the PUT with headers application/fhir+json only helps with get all as the binary is not re-encoded however a get by ID decodes the binary resource irrespective of which headers are used.
When the encoded binary is posted using the application/json it works okay for the get-by ID but re-encodes when you get all irrespective of the header
The ultimate solution will be to still have the gateway consume the raw JSON and not encoded one IMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants