API for searching WITHIN a Bundle?

Is there an API call to search within a Bundle?

My client is running on docker, and for some reason, it’s very slow to make any server calls to my FHIR server. So I want it to grab a lot of similar data in one call, and then parse out the results locally.

FHIR is about interacting with data on a different system. Once the data is in your own space, you can search it however you like. You can manipulate it in memory. You can persist it and manipulate it from there. You have full access to the capabilities of your software language - there’s no need for an API.

1 Like

As @lloyd mentioned, the answer you need is very much dependent on the platform/language you are using to consume the FHIR resource(s).

If the bundle is in JSON format, this stackoverflow example can give you an idea of how you could search the JOSN tree returned using jQuery or even with vanilla javascript:

var json = {
    "people": {
        "person": [{
            "name": "Peter",
            "age": 43,
            "sex": "male"},
            "name": "Zara",
            "age": 65,
            "sex": "female"}]
$.each(json.people.person, function(i, v) {
    if (v.name == "Peter") {   /* <---- you could use a regex here as well or have multiple conditions */

Source: https://stackoverflow.com/questions/5288833/how-to-search-json-tree-with-jquery
Hope that helps.

1 Like

Thank you both for your answers. I am working with C#, so I was wondering if there is a search shortcut within Hl7.Fhir.Model.Bundle I am just not finding, hopefully using similar query parameters as the FHIR search. It looks like there isn’t one, so I’ll use some other way to do this.

Your best bet for asking questions about the .NET API is on the chat.fhir.org stream: https://chat.fhir.org/#narrow/stream/15-dotnet

1 Like

Thank you! I didn’t know about this, but this looks great.