fhirbase / fhirbase-plv8

[DEPRECATED] Fhirbase 2.0 is an FHIR relational storage
https://health-samurai.io/fhirbase
Other
105 stars 39 forks source link

fhir_search for SQL keyword named resource fails #88

Closed alexandertakacs closed 8 years ago

alexandertakacs commented 8 years ago

Search for Order with unquoted resourceType fails,

SELECT fhir_search('{"resourceType": "Order", "queryString": ""}'); 
ERROR:  Error: syntax error at or near "order"
DETAIL:  plv8_init() LINE 167:     return plv8.execute.call(plv8, q[0], q.slice(1));

Quoting the resource name works (though fails if any queryString parameters are added).

SELECT fhir_search('{"resourceType": "\"Order\"", "queryString": ""}');
daya commented 8 years ago

Yeah it appears that Order resource is not implemented

select column_name, data_type
from information_schema.columns where
table_name='order';

returns Empty result here http://fhirbase.github.io/demo/index.html#/ and also order_response does not seem to be implemented. So I am not sure which of the resources listed in Hl7 FHIR spec are implemented, but somehow this list on hl7 says all resources are implemented.

May be @danil, @mlapshin, @niquola or @yogthos can answer this

niquola commented 8 years ago

On fresh installation tables are created only for meta- resources (StructureDefinition, SearchParameter etc). You have to execute fhir_create_storage('{"resourceType": "Order"}') to create tables for order resources. This issue is related to quoting identifiers, because order is reserved keyword in postgresql. I hope, we will fix this issue (if not yet) on Monday.

danil commented 8 years ago

@alexandertakacs, @daya please try v0.0.1-beta.17 (order search test https://github.com/fhirbase/fhirbase-plv8/blob/v0.0.1-beta.17/test/postgresql_reserved_keywords_spec.coffee#L178)

danil commented 8 years ago

consider it fixed, if not, feel free to reopen