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

How to use a new FIHR server? #51

Open
sohrabhejazi opened this issue May 15, 2019 · 10 comments
Open

How to use a new FIHR server? #51

sohrabhejazi opened this issue May 15, 2019 · 10 comments

Comments

@sohrabhejazi
Copy link

Hi,

I created an FHIR server and I want to connect to this server through your app and use my own data.
Is it possible? If yes, could you please guide me and tell me how?

LG
Sohrab

@vlad-ignatov
Copy link
Contributor

Yes, it should be possible. The simplest way would be to:

  1. Host the PGC app somewhere. For example npm start will start small http server and then the app will be available at http://127.0.0.1:9000/
  2. In the launch.html file at https://github.com/smart-on-fhir/growth-chart-app/blob/master/launch.html#L10-L11 add a patientId option. The value should be the ID of the patient (on your FHIR server) that you want to launch with.
  3. Then load your launch.html file and pass a fhirServiceUrl parameter like so: http://127.0.0.1:9000/launch.html?fhirServiceUrl=http://my.fhir.server

@usmanbahadur
Copy link

@vlad-ignatov hi that works fine as long as you testing hapi fhir servers but if your fhir server requires Oauth Porcess i can get a token and patient data using POSTMAN, my next step is that i want to plugin my FHIR Server to test Growth Chart App but for that i need to get access token first within your app.?

@vlad-ignatov
Copy link
Contributor

Hi @usmanbahadur,

That was just an example of how to work-around SMART/Oauth. If you have an Oauth server, then you can register a client there and use the client_id in the launch.html file and launch as usual.

@usmanbahadur
Copy link

hi @vlad-ignatov
so i have done the following this autheitcates the app against fhir server but how do we actually search a patient?
image

@vlad-ignatov
Copy link
Contributor

It is a responsibility of the server to offer you a patient selection UI if you have stated that you need it using the launch/patient scope. You can also bypass that by adding a patientId option to the authorize call in your launch.html, but that will "fix" your app to always use that patient.

@usmanbahadur
Copy link

usmanbahadur commented Sep 3, 2019

hi @vlad-ignatov

i have tried by providing static patientId when launching as stand alone patient app, the error is patient not found.
image

image

image

@vlad-ignatov
Copy link
Contributor

Does that patient exist on the server you are launching against?

BTW, the scope looks weird. Try "patient/*.read launch/patient".

@usmanbahadur
Copy link

@vlad-ignatov the patient exist in server, Azure FHIR Server does not like "patientId : smart-77777703"
so i had to convert patient id
var launchContext = {patient: patientId};
var launchContextString = encodeURIComponent(btoa(JSON.stringify(launchContext)));

https://github.com/microsoft/fhir-server-samples/blob/master/src/FhirDashboardJS/js/PatientModule.js

@hexicalsystems
Copy link

Hello, I'm trying to connect to our FHIR server as well. Did you finish using the growth chart app with your own FHIR server ? I could use any help or samples to get started in this. Please let me know.

@usmanbahadur
Copy link

@hexicalsystems Use the following in launch.html file of the project, you would need client_id, patientid etc from your fhir service provider, a redirect_uri is also very important this is where you will see the patient data pulled out of your fhir service.
BW
FHIR.oauth2.authorize({
"scope": "patient$*.read",
"iss": "https://name-of-your-fhir-server.com",
"patientId": "patient-id-that-exist-in-your-fhir-server",
"client_id": "id-given-by-your-server",
"redirect_url": "uri-where-you-want-to-redirect-this-app"
)}

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

4 participants