Skip to content

FHIR Seach and Query String/Params #2555

Closed

Description

@tripott

Environment details

  • OS: macOS Mojave 10.14.6
  • Node.js version: v12.18.2
  • npm version: 6.14.5
  • googleapis version: ^60.0.1

How do you query the FHIR store using a query string after the FHIR resource name? This produces an OperationOutcome that states the resource type is invalid.

const parent = `projects/${PROJECT_ID}/locations/${CLOUD_REGION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID}`
const medDispResourceType = `MedicationDispense?subject=Patient/${patientId}&status=completed`
const medDispResources = await googleFhirClient.search({
    parent,
    requestBody: {
      resourceType: medDispResourceType
      }
   } )

Activity

  1. changed the title [-]FHIR Seach and Query String/Para,ms[/-] [+]FHIR Seach and Query String/Params[/+] on Mar 18, 2021
  2. added
    type: questionRequest for information or clarification. Not an issue.
    on Mar 18, 2021
  3. JustinBeckwith commented on Mar 28, 2021

    @JustinBeckwith
    Contributor

    @tripott forgive me, I'm not terribly familiar with the FHIR API. The resourceType you're trying to pass - is it common for it to include querystring parameters like that? There's a lot of weird here, as compared to other googleapis. I'm reading this doc:
    https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.fhirStores.fhir/search

    It's usually a good idea to try getting your query to work first in the API explorer on that page, just to make sure we have an apples to apples comparison.

    Based on the way we're generating the API, it looks like we default to POST, which means it doesn't expect to get the resourceType in the path... which makes passing querystring parameters along with it even weirder. One idea is to try manually overriding the querystring parameters, something like:

    const parent = `projects/${PROJECT_ID}/locations/${CLOUD_REGION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID}`
    const res = await googleFhirClient.search({
      parent,
      requestBody: {
        resourceType: 'MedicationDispense'
      }
    }, {
      params: {
        subject: `Patient/${patientId}`,
        status: 'completed',
      }
    })

    Let us know how it goes!

  4. kaylakantola commented on Nov 9, 2021

    @kaylakantola

    I ran into a similar issue while trying to use this api to build complex FHIR searches.

    Specifically, I am trying to retrieve all patients that reference a specific managingOrganization.

    Using the code snippet above as a jumping off point, here's something I have working right now:

    const res = await googleFhirClient.search({
          parent: fhirStoreUrl,
          resourceType: "Patient",
          organization: `Organization/${someOrgId}`
        })

    When I inspect res.request, I get this back (some values replaced for security):

    {
      responseURL: 'https://healthcare.googleapis.com/v1/projects/our-project-id/locations/our-location/datasets/our_dataset/fhirStores/our_fhir_store/fhir/_search?resourceType=Patient&organization=Organization%2FsomeOrgId'
    }
    

    This is what I was hoping to build, so I am happy for now, though I do wish there was better documentation for handling search params using this api.

  5. github-actions commented on Sep 21, 2024

    @github-actions

    This has been closed since a request for information has not been answered for 15 days. It can be reopened when the requested information is provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoThis issue needs more information from the customer to proceed.type: questionRequest for information or clarification. Not an issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions