FHIR - Patient - How to upload and retrieve patient photo - hl7-fhir

FHIR Patient Resource has a photo variable:
photo 0..* Attachment Image of the patient
Questions: Are there examples for each:
How do upload a patient photo (what format are supported etc).
How to retrieve a patient photo?
This post How to Get FHIR Photo for Patient from a URL seems to be old.

The post you've mentioned might be a bit older, but it is still valid. You have several ways to store binary data, depending on the capabilities of your system.
You could store the base64 encoded data in the Patient.photo.data field.
You could also store the data somewhere else and then point to it with the Patient.photo.url field. So for example you store the photo on your [base]/Binary, which will give you the technical id for it. Then set Patient.photo.url to [base]/Binary/[id]. The advantage of this approach is that you can retrieve the normal patient data without the payload of the image. Disadvantage is that you might need a separate call to retrieve the image.

Patient.photo is an Attachment which contains Attachment.data, which is a base64Binary. So you just base64 encode the image and set the proper contentType.
I uploaded you a patient with photo here:
http://fhirtest.uhn.ca/baseDstu3/Patient/70691

Related

Store Google Places "place_id" and refresh them

I've just spent a long time reading documentation about the Google API Places, and there's some information I don't quite understand.
I need to build an application that can record a travel plan for a user, so a sequence of places.
For this, I need a very simple form, with a "destination" input, which will use "Autocomplete Places".
This endpoint return a place_id for the selected location, which is the only thing I'm allowed to store in a database, according to Google's terms and conditions.
So in my idea, I'll store this id, and a itinerary would be made of a sequence of place_id, without the need to store the place name or anything else. To display the user's itinerary, I'd just have to make Place Details queries, with the identifier.
But the documentation specifies that these ids can change over time, so they advise to redo queries "periodically" to refresh the place_id.
But how can I redo queries if I haven't stored any information about the place, other than the place_id ? Do I need to store the name of the place (and do I have the right to do that?) to be able to retrieve its ID, or am I missing something?
Another thing: I didn't find, or didn't understand, in the terms of use, if I was allowed to store data generated by my site beside Google IDs, for example, to store comments about places.
Sorry if I make language mistakes, im not fluent in english.
Thanks !

How to retrieve only certain data from Parse?

I am working with parse to save user data. I am saving every user that signs up in a parse table. I can run my app and see data from all the users who signed up; but I dont want that. What I want is to display information only from users in a friends list. Thats my problem. Should I create and query through a list of user ids or emails that I save internally in the device as JSON or raw data to upload in a new class in parse? Should I save these friend contacts directly in my current ALL USERS Parse table and get the data somehow without having the entire parse table provide all users data? I hope this makes sense to anyone. Any guidance would be really helpful. Thanks for your time.

Create a new Patient resource referencing user id

I'm trying to create a new FHIR resource Patient using the RESTful API using the XML format. I want to store patient information using the Create method, but in my patient health record I also reference a user (composed of id, username and password) to a patient in the database.
How can I link the id of the user to the Patient resource I'm creating via REST? Is there an XML field where I should place such information?
Is it a good practice to actually use an extension?
It's perfectly reasonable to use an extension for this purpose. If you need the data to be stored in the Patient record, you don't really have a choice. That said, be very cautious about storing password information in the Patient resource - as Patient is going to be sent all over the place. It might be cleaner to store the references to Patient/Practitioner/etc. in your user representation than it is to store security information in your Patient structure. (You can represent the notion of "user" in FHIR using Basic, but we encourage use of non-healthcare-specific standards in this space.)

Finding product name from UPC/EAN

Is there any way to get the product name from UPC/EAN barcode scanned from Google API?
There is no general registry of UPC product codes. You can find a list of the country codes at the beginning of the number easily, and with some legwork possibly get the national organization for a few countries that you're particularly interested in to give you a list of their secondary allocations.
But in order to get all the way down to "Banana chips, bag of 200 g, reduced trans fat formulation, Danish/Swedish/Finnish text on packaging" there's only the particular manufacturer to ask. That, or own a supermarket and register the UPC numbers of new items when you start stocking them.
Allegedly the gtin field holds the UPC/EAN code, if you restrict the search to values in that field you should only get responses where the gtin matches your barcode.
For example if you scanned your barcode and got an EAN-8 code of 05001234 then in the query string of your API call you could set
https://www.google.com/search&q=05001234&restrictBy=gtin=05001234
I have often seen multiple products returned for a single code so I guess the UPC/EAN are not globally unique or some providers have not been uploading their products under the right code.
In the response from Google are fields which hold the product title and description, you just need to parse the JSON or ATOM response.
I found another API https://market.mashape.com/mignify/gtin2product. It's pretty good. You can get products information from UPC/EAN/GTIN. It can return products description in different language.
You can use Rapid API https://rapidapi.com/search/ean. Here you get lot of API like Amazon API, Google Shopping, Barcode Lookup

MongoDB GridFS one-to-one query effeciency in Ruby

I'm using MongoDB w/ Sinatra for an iPhone app.
I have a users MongoDB collection and a picture GridFS collection. Each user has one picture, so, initially, I just set the ObjectId for the picture to be the same as the corresponding user. That made it easy to, given the user's ObjectId, get the picture of that user with just one query. Then, I was planning to store the MD5 hash of the picture in the user object so that the iPhone would know to download the picture only if the MD5 hash had changed. This would work, but I had to modify the Grid Ruby class to get the MD5
But then, Kyle Banker suggested that I just store the picture_id, instead of the MD5, in the user object. But, if I do that, given a user ObjectId, I'd have to first query the picture_id from the user, and then query the picture (2 queries). Is there a way, in one query, to get the picture given a user's ObjectId? Reading up on GridFS indexes, I think there's a way to store the user's ObjectId in the meta data of the picture and then set an index on that field. That way, I could do it in one query. If that's correct, what's the code look like to do that in Ruby?
Alas, should I even bother? I could just as easily use the picture_id to query the picture, which is what I'll do for now, but it'd also be nice, from a syntactical perspective, to be able to query the picture (in one indexed/fast query) by the user_id. Kinda like Facebook's graph api lets you do, e.g., http://graph.facebook.com/mattdipasquale/picture.
Sure. Like you suggest, just store the user_id somewhere in the picture's file object, and build an an index on that field.

Resources