fhirbase-plv8
fhirbase-plv8 copied to clipboard
Code and codable concept sorting differently respects casing
Both are good, on the other hand it would be best just to be consistent
SELECT fhir_drop_storage('{"resourceType": "Encounter"}'); SELECT fhir_create_storage('{"resourceType": "Encounter"}');
SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id1","type":{"coding":[{"code":"ATest"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id2","type":{"coding":[{"code":"btest"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id3","type":{"coding":[{"code":"BTest"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id4","type":{"coding":[{"code":"cTest"}, {"code":"ATestButSecond"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id5","type":{"coding":[{"code":"CTest"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id6","type":{"coding":[{"code":"DT est"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id7","type":{"coding":[{"code":"DTest"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id8","type":{"text": "abc", "coding":[{"code":"ETest"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id9","type":{"coding":[{"code":"FTest"}]},"length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id10","length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}');
SELECT fhir_search('{"resourceType": "Encounter", "queryString": "length=eq1&_sort=type"}'); -- ignores casing: ATest, aTest, then bTest etc SELECT fhir_search('{"resourceType": "Encounter", "queryString": "length=eq1&_sort:asc=type"}'); SELECT fhir_search('{"resourceType": "Encounter", "queryString": "length=eq1&_sort:desc=type"}');
SELECT fhir_drop_storage('{"resourceType": "Encounter"}'); SELECT fhir_create_storage('{"resourceType": "Encounter"}');
-- code sorting SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id1","status":"arrived","length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id2","status":"Arrived","length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id3","status":"Canceled","length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id4","status":"canceled","length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id5","status":"in progress","length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id6","status":"in-progress","length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType":"Encounter","id":"id7","length":{"value":1,"unit":"minutes","system":"http://snomed.info/sct","code":"258701004"}}}');
SELECT fhir_search('{"resourceType": "Encounter", "queryString": "length=eq1&_sort=status"}'); --nok -- code sorting is case sensitive whereas codableConcept.coding[0].code is not -- results: Arrived, Canceled, then arrived etc -- otherwise no issues SELECT fhir_search('{"resourceType": "Encounter", "queryString": "length=eq1&_sort:asc=status"}'); SELECT fhir_search('{"resourceType": "Encounter", "queryString": "length=eq1&_sort:desc=status"}');
What's the status on this issue ?