Open juliangruendner opened 2 months ago
Since we decided to overhaul the query endpoint after the q4 release, here are some of my thoughts (not yet in a structured way) as a basis for discussion. I am quite sure that there are things I missed (or just do not know for now).
Queries will always be saved with the criteria and at least a label. There is no longer a distinction between "query" "saved query" and the dreaded "template". The proposed "split" between cohorts and data extraction only refers to the backend side. This does not have to be that way in the frontend.
Cohorts are similar to our current "query", but they can not have results at any time. They must however have a label and may or may not have a description. In my opinion, we do not need to impose any limits on cohorts. Let users save as many as they want. Maybe we can offer an option to archive them or mark as favorites?
Queries are a combination of CCDL query, DEQ query + label + description + results
Either a CRTDL with an empty DEQ part or some other format?
CRTDL with filled DEQ part + label + description + results
Extend API to save and load cohort and dataselection.
The API should be extended to allow the saving and loading of a cohort selection (CCDL) and a dataselection (dataExtraction part CRTDL).
Further it should be possible to save a CRTDL, which combines the cohort seleection and dataselection parts.
For this the endpoint POST /query/{queryId}/saved should be changed to POST /query/saved and accept the following body:
Response: analogous to current saved Reponse, but with additional Id of saved query
IMPORTANT: It should also be possible to POST a query with a query ID from a query not in /cohort-selection, but in /query (as in a query that has been sent) Further the endpoint /query/by-user/{userId} should still return the totalNumberOfPatients if a query has been previously saved with a query from query instead of cohort-selection
This future post from the UI will then require a ccdlID and a dataExtractionId to be supplied.
For this two new endpoints should be created, one to post each part to the backend.
POST /cohort-selection Body: = CCDL (equivalent to what is currently send to query)
Response: analogous to current template endpoint, if successfull 201OK with Location Header and link to successfully stored cohort-selection
POST /data-selection Body: the dataExtraction part of the CRTDL = https://github.com/medizininformatik-initiative/clinical-resource-transfer-definition-language example:
Response: analogous to current template endpoint, if successfull 201OK with Location Header and link to successfully stored data-selection