FHIR Chat · Batch bundle via JavaScript client? · smart

Stream: smart

Topic: Batch bundle via JavaScript client?


view this post on Zulip Paul Lynch (Jun 13 2019 at 20:41):

If I get a patient-restricted fhir.js client via smart.patient.api (looking at http://docs.smarthealthit.org/clients/javascript/), and I use fhir.js' "transaction" API (not documented but found it in the source code) to submit a batch of requests to search for Observations, will the API handle restricting those queries in the Bundle to the patient?

view this post on Zulip Josh Mandel (Jun 14 2019 at 22:12):

Don't think so -- though you're asking about undocumented behavior, so the source code is probably more reliable than I am. (Incidentally you may be interested to know that @Vladimir Ignatov is working on a "v2" library overhaul at https://github.com/smart-on-fhir/client-js .

view this post on Zulip Paul Lynch (Nov 19 2020 at 19:03):

With the new v2 JavaScript client-js library, (http://docs.smarthealthit.org/client-js/client.html), is there a way to submit a batch of requests? I have code that creates a bundle of a QuestionnaireResponse and derived (extracted) Observations which reference the QuestionnaireResponse's id, and would like to create them all in a single request. Potentially, there could be a lot of requests to create extracted Observations if I have to do them individually.

view this post on Zulip Paul Lynch (Nov 19 2020 at 21:10):

It turns out one can use the "request" function and pass in options to get it submit a bundle, like:

client.request({url: '', method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify(bundle)}).then(...

Last updated: Apr 12 2022 at 19:14 UTC