Stream: graphql
Topic: help with Query
João Almeida (Nov 03 2021 at 08:26):
Hello everyone, I am not very acquainted with graphql language, but i am trying to expand my knowledge regarding more complex queries than the ones on the fhir page. Is there some kind of page of resource for that?
stuff I am trying at the moment: search resources and filter by an complex object for example (based on the one on the fhir page):
{
Condition(clinical_Status: active ) { id, clinicalStatus{coding{system code}} }
}
but this one is not working on hapi.fhir at the moment
Grahame Grieve (Nov 03 2021 at 09:01):
have you tried it on test.fhir.org?
João Almeida (Nov 03 2021 at 10:17):
I tried it now. With clinical_Status or clinicalStatus returns "Unknown/invalid parameter"
POST /r4/$graphql HTTP/1.1
Host: test.fhir.org
Content-Type: application/json
Content-Length: 118
{"query":"{ \n Condition(clinical_Status: active ) { id, clinicalStatus{coding{system code}} } \n }","variables":{}}
Jose Costa Teixeira (Nov 03 2021 at 11:06):
I believe the search parameter should be clinical-status
Jose Costa Teixeira (Nov 03 2021 at 11:08):
From the documentation I don't know if system-level graphql is supported.
Jose Costa Teixeira (Nov 03 2021 at 11:08):
I think so, also judging from the operation definition. But the text says
A System level query. The query must start by selecting a resource type and some search criteria, as defined below.
João Almeida (Nov 03 2021 at 11:15):
about the clinical-status, i doubt it since it says on the page "the parameter's names are changed by replacing '-' in the name with '_' (for graphql syntax requirements) (FHIR defines parameters starting with _ but will never define search parameters starting with '-')"
Jose Costa Teixeira (Nov 03 2021 at 11:38):
ok i didn't see that
Grahame Grieve (Nov 04 2021 at 23:23):
@João Almeida I thnk you want ConditionList(
not Condition(
João Almeida (Nov 05 2021 at 08:34):
That was it! It worked!
POST /r4/$graphql HTTP/1.1
Host: test.fhir.org
Content-Type: application/json
Content-Length: 122
{"query":"{ \n ConditionList(clinical_status: active ) { id, clinicalStatus{coding{system code}} } \n }","variables":{}}
For the record, this one on HAPI returns error.
POST /baseR4/$graphql HTTP/1.1
Host: hapi.fhir.org
Content-Type: application/json
Content-Length: 122
{"query":"{ \n ConditionList(clinical_status: active ) { id, clinicalStatus{coding{system code}} } \n }","variables":{}}
I believe it could be helpful to expand the tutorial on FHIR website with more complex queries! I could give an hand if needed
Last updated: Apr 12 2022 at 19:14 UTC