-
Notifications
You must be signed in to change notification settings - Fork 2
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
save image as binary resource #169
Conversation
# and saves it as a Binary resource. It returns the id of the Binary resource if | ||
# successful and 0 if failed | ||
def save_image(image_source_url): | ||
headers = {"Authorization": "Bearer " + config.product_access_token} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumption here is that these images are coming from a different source that requires different authorization from the fhir server
"request": { | ||
"method": "PUT", | ||
"url": "Binary/" + resource_id, | ||
"ifMatch": "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll make the version and id configurable her when we add the final piece of code that calls this function when adding products so that edits also work
importer/main.py
Outdated
"resource": { | ||
"resourceType": "Binary", | ||
"id": resource_id, | ||
"contentType": "image/png", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how we use this contentType here or how important it is... from the current examples available as a source, there is no way to deduce this information, so just have this png
here as a placeholder for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be able to look at the binary date to figure this out, here's first hit, https://stackoverflow.com/questions/43580/how-to-find-the-mime-type-of-a-file-in-python, worth looking a bit more to see if there's something better
importer/main.py
Outdated
"resource": { | ||
"resourceType": "Binary", | ||
"id": resource_id, | ||
"contentType": "image/png", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be able to look at the binary date to figure this out, here's first hit, https://stackoverflow.com/questions/43580/how-to-find-the-mime-type-of-a-file-in-python, worth looking a bit more to see if there's something better
f568e35
to
68c4be0
Compare
IMPORTANT: Where possible all PRs must be linked to a Github issue
Fixes #160
Engineer Checklist
./gradlew spotlessApply
to check my code follows the project's style guide