Stream: implementers
Topic: Compartment Search URL
Muhammad Abubakar Ikram (May 16 2018 at 12:18):
In this section https://www.hl7.org/fhir/http.html#vsearch
The two URL patterns are defined for compartment based search which is following
1. GET [base]/[Compartment]/[id]/{*?[parameters]{&_format=[mime-type]}}
2. GET [base]/[Compartment]/[id]/[type]{?[parameters]{&_format=[mime-type]}}
I am confused about this "[id]/{*" part of the first URL pattern.
Questions:
Q1. What I understood about asterisk * that there would be multiple parameters. correct me if I am wrong? I am curious because it is the only place where the asterisk * is appearing in the URL pattern in search sections of spec.
Q2. If I am right at Q1 then why not simply "[id]{?[parameters]" as "parameters" is written, which is also referring to multiple parameters?
Q3. Why there is an extra forward slash "/" after "[id]" why not like this "[id]{?[parameters]"
Grahame Grieve (May 16 2018 at 12:24):
Typo. Should be:
1. GET [base]/[Compartment]/[id]/*{?[parameters]{&_format=[mime-type]}}
2. GET [base]/[Compartment]/[id]/[type]{?[parameters]{&_format=[mime-type]}}
can you make a task to fix?
Grahame Grieve (May 16 2018 at 12:24):
'*' is special in this place - it means 'resources of all types '
Muhammad Abubakar Ikram (May 16 2018 at 12:29):
@Grahame Grieve
Ok alright. I can make a task to fix it. but I don't know where to make the task. kindly tell me I'll make it.
What about the extra "/" after "[id]" is it also a typo mistake? because there is no need to have "/" before query strings?
Christiaan Knaap (May 16 2018 at 12:37):
Is the '' meant to be in the url literally? I ask because in a normal search system wide search is not denoted with a ''.
And the extra / at the end of the path distinguishes it from a regular read of [Compartment]/[id]. Compare:
- [base]/Patient/123?_format=json -> will return just the latest version of Patient 123, in json
- [base]/Patient/123/?_format=json -> will return all resources in the compartment of Patient 123, in json
Grahame Grieve (May 16 2018 at 12:38):
no the last URL is not correct
Christiaan Knaap (May 16 2018 at 12:39):
And the correct way is?
Grahame Grieve (May 16 2018 at 12:41):
- [base]/Patient/123/*?_format=json -> will return all resources in the compartment of Patient 123, in json
Christiaan Knaap (May 16 2018 at 12:42):
Aha. The reason being that /? is illegal in URL?
Muhammad Abubakar Ikram (May 16 2018 at 12:42):
@Christiaan Knaap /? it is not illegal but it is not a good practice, as far as practice is concerned check this http://wiki.marketruler.com/What_is_the_correct_syntax_for_query_strings%3F
because after / you go deeper in URL path conventionally. So if you are writing /?querystring1=someValue then you are not telling the last directory of the path on which the query strings has to be apply. But it works for the path before the last /.
Christiaan Knaap (May 16 2018 at 12:45):
Thanks, will correct that in Vonk
Michel Rutten (May 16 2018 at 12:48):
Hi @Muhammad Abubakar, thank you for catching this!
You can submit a FHIR change request on gForge:
https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemBrowse&tracker_id=677
Christiaan Knaap (May 16 2018 at 13:03):
Now I'm aware of the * it would have been nicely consistent to use it also for normal system wide search - even though it is not neccessary for a proper formatted url in that case. But it's too late for that I'm afraid.
Christiaan Knaap (May 16 2018 at 13:03):
Oh, and a link to gforge is in the footer of every page of the specification: "propose a change"
Muhammad Abubakar Ikram (May 16 2018 at 13:08):
@Christiaan Knaap I got the gforge link. It would be nice to have "propose a change" also on header because many pages are too long and one would merely reach footer every time.
Christiaan Knaap (May 16 2018 at 13:08):
You are doing a nice job of reading through to the end though :-)
Muhammad Abubakar Ikram (May 17 2018 at 09:04):
@Michel Rutten I have submitted the application for an account with the email leo9223@gmail.com. But didn't get approved yet.
Michel Rutten (May 17 2018 at 09:07):
Hi @Muhammad Abubakar, many FHIR community members are currently attending the WGM in Cologne, so they probably didn't have time to manage new applications. The meeting ends today, so you'll probably get approved soon.
@Lloyd McKenzie maybe you can approve Muhammad's gForge membership request?
Lloyd McKenzie (May 17 2018 at 09:09):
Done. Asking here suggests you know enough about HL7 you're unlikely to be a spammer :)
Muhammad Abubakar Ikram (May 17 2018 at 09:12):
@Christiaan Knaap As you said the URL in Vonk is [base]/Patient/123/?_format=json for returning resources in the compartment, you just have to add * between these /? two characters in your routes to comply with FHIR routing as @Grahame Grieve said. I don't think so it will be a big surgery.
Muhammad Abubakar Ikram (May 17 2018 at 09:14):
@Lloyd McKenzie Thanks.
Muhammad Abubakar Ikram (May 17 2018 at 09:29):
@Grahame Grieve here is the tracker. https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=17223&start=10825
Muhammad Abubakar Ikram (Sep 08 2018 at 11:53):
It is still not corrected in the spec https://www.hl7.org/fhir/http.html#vsearch
Lloyd McKenzie (Sep 08 2018 at 15:32):
It will never be fixed in the R3 version of the specification. Check for the fix in the draft of R4 at http://build.fhir.org
Last updated: Apr 12 2022 at 19:14 UTC