---- .search not working
Google is not returning data from a search call. The Parent string is valid. the auth is valid. What’s incorrect about this? This should return Practitioners in the db as a bundle. I get {}
const parent = projects/${PROJECT_ID}/locations/${LOCATION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID};
const searchobj = {
parent: parent,
resourceType: “Practitioner”,
auth: auth,
};
const response = await healthcare.projects.locations.datasets.fhirStores.fhir.search(searchobj);
response is {“config”:{“url”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/_search?resourceType=Practitioner”,“method”:“POST”,“apiVersion”:“”,“userAgentDirectives”:[{“product”:“google-api-nodejs-client”,“version”:“7.2.0”,“comment”:“gzip”}],“headers”:{“x-goog-api-client”:“gdcl/7.2.0 gl-node/20.14.0”,“Accept-Encoding”:“gzip”,“User-Agent”:“google-api-nodejs-client/7.2.0 (gzip)”,“Authorization”:“Bearer --”},“params”:{“resourceType”:“Practitioner”},“retry”:true,“responseType”:“unknown”},“data”:{},“headers”:{“alt-svc”:“h3=":443"; ma=2592000,h3-29=":443"; ma=2592000”,“content-length”:“5951”,“content-type”:“application/fhir+json;charset=utf-8”,“date”:“Sun, 08 Sep 2024 23:48:45 GMT”,“server”:“ESF”,“vary”:“Origin, X-Origin, Referer”,“x-content-type-options”:“nosniff”,“x-frame-options”:“SAMEORIGIN”,“x-xss-protection”:“0”},“status”:200,“statusText”:“OK”,“request”:{“responseURL”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/_search?resourceType=Practitioner”}}
-------- POST not working
yikes, POST for searching the Google FHIR store also does not return any data.
const parent = projects/${PROJECT_ID}/locations/${LOCATION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID};
const searchurl = [https://healthcare.googleapis.com/v1/${parent}/fhir/PractitionerRole/_search](https://healthcare.googleapis.com/v1/${parent}/fhir/PractitionerRole/_search);
// const params = { ‘practitioner’: ‘30904792-995a-4551-b185-657d8e4ea08e’ }; // attempt to limit response to Roles of one Practitioner
const params ={}; //attempt to retrieve all PractionerRoles
const client = await auth.getClient();
const response = await client.request({
url: searchurl, // The URL must be passed as ‘url’
method: ‘POST’, // Use POST method for _search
params: params, // Pass the search parameters
headers: {
‘Content-Type’: ‘application/fhir+json’, // Set header for FHIR
}
});
no data in the response :
{“config”:{“url”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole/_search”,“method”:“POST”,“params”:{},“headers”:{“Content-Type”:“application/fhir+json”,“Authorization”:“Bearer --”,“User-Agent”:“google-api-nodejs-client/9.14.1”,“x-goog-api-client”:“gl-node/20.14.0”},“responseType”:“unknown”},“data”:{},“headers”:{“alt-svc”:“h3=":443"; ma=2592000,h3-29=":443"; ma=2592000”,“content-length”:“6150”,“content-type”:“application/fhir+json;charset=utf-8”,“date”:“Mon, 09 Sep 2024 00:47:33 GMT”,“server”:“ESF”,“vary”:“Origin, X-Origin, Referer”,“x-content-type-options”:“nosniff”,“x-frame-options”:“SAMEORIGIN”,“x-xss-protection”:“0”},“status”:200,“statusText”:“OK”,“request”:{“responseURL”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole/_search”}}
— GET not working either.
Note that this search string works in the Google Healthcare FHIR viewer , also note that there is no _search in this… (?)
https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole?practitioner=30904792-995a-4551-b185-657d8e4ea08e
So therefor a GET request should work…
so.. refactoring to :
const practitionerId = ‘30904792-995a-4551-b185-657d8e4ea08e’;
const searchUrl = [https://healthcare.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID}/fhir/PractitionerRole?practitioner=${practitionerId](https://healthcare.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID}/fhir/PractitionerRole?practitioner=${practitionerId)};
const client = await auth.getClient();
const response = await client.request({
url: searchUrl, // The URL with query parameters
method: ‘GET’, // Use GET method for search with query parameters
headers: {
‘Accept’: ‘application/fhir+json’, // Request FHIR in JSON format
}
});
response has no data (ugh)
, even though the url is exactly like the one that works in the Google FHIR store explorer:
[https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-centr[…](https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-centr[…)]erRole?practitioner=30904792-995a-4551-b185-657d8e4ea08e
{“config”:{“url”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole?practitioner=30904792-995a-4551-b185-657d8e4ea08e”,“method”:“GET”,“headers”:{“Accept”:“application/fhir+json”,“Authorization”:“Bearer --”,“User-Agent”:“google-api-nodejs-client/9.14.1”,“x-goog-api-client”:“gl-node/20.14.0”},“responseType”:“unknown”},“data”:{},“headers”:{“alt-svc”:“h3=":443"; ma=2592000,h3-29=":443"; ma=2592000”,“content-length”:“2455”,“content-type”:“application/fhir+json;charset=utf-8”,“date”:“Mon, 09 Sep 2024 01:08:23 GMT”,“server”:“ESF”,“vary”:“Origin, X-Origin, Referer”,“x-content-type-options”:“nosniff”,“x-frame-options”:“SAMEORIGIN”,“x-xss-protection”:“0”},“status”:200,“statusText”:“OK”,“request”:{“responseURL”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole?practitioner=30904792-995a-4551-b185-657d8e4ea08e”}}
something else must be wrong…