Hello community,
This PR introduces Questionnaire pr dedicated database tables for Questionnaire, QuestionnaireItem, QuestionnaireItemInitial, QuestionnaireAnswerOption, QuestionnaireResponse, QuestionnaireResponseItem, and QuestionnaireResponseAnswer within OpenELIS.
Instead of retrieving Questionnaire and QuestionnaireResponse data from the external/co-resident FHIR store, OpenELIS now persists and queries these resources directly from its own database.
Why This Change?
Previously, OpenELIS is relying on the co-resident HAPI FHIR store for Questionnaire and QuestionnaireResponse persistence and retrieval. While functional, this introduced several limitations:
1. Reduce Dependency on the FHIR Store
Questionnaire and QuestionnaireResponse are will now be core OpenELIS entities. Storing them in the application database removes the requirement to make external FHIR API calls for routine operations and reduces dependence on the availability of the FHIR store.
2. Improve Query Performance
FHIR QuestionnaireResponse resources contain deeply nested structures (item, answer, nested item hierarchies) that are expensive to search and index efficiently in a generic FHIR repository. The FHIR specification itself notes the complexity of indexing and searching QuestionnaireResponse content.
Using relational tables allows OpenELIS to:
-
Execute direct SQL queries.
-
Filter responses efficiently.
-
Support pagination and search without FHIR resource traversal.
-
Reduce serialization/deserialization overhead.
3. Simplify OpenELIS Business Logic
The questionnaire workflow is will now be managed entirely within OpenELIS:
This removes the need to convert between database objects and FHIR resources during normal application operations.
4. Better Support for LIS Workflows
Questionnaires and responses are frequently used as operational data within OpenELIS. Storing them in relational tables enables:
5. Preserve FHIR Compatibility
Although the data now now be stored in OpenELIS tables, the structure closely mirrors the FHIR model:
| OpenELIS Table |
FHIR Element |
| questionnaire |
Questionnaire |
| questionnaire_item |
Questionnaire.item |
| questionnaire_item_initial |
Questionnaire.item.initial |
| questionnaire_answer_option |
Questionnaire.item.answerOption |
| questionnaire_response |
QuestionnaireResponse |
| questionnaire_response_item |
QuestionnaireResponse.item |
| questionnaire_response_answer |
QuestionnaireResponse.item.answer |
This allows OpenELIS to continue exposing FHIR-compliant resources while using a more efficient persistence mechanism internally.
Result
Questionnaire and QuestionnaireResponse data will now be :
-
Stored directly in the OpenELIS database.
-
Queried through OpenELIS services and DAOs.
-
No longer dependent on the co-resident FHIR store for routine CRUD operations.
-
Still capable of being represented as FHIR resources when exposed through the FHIR API.
This provides improved performance, reduced system complexity, and better alignment with OpenELIS workflow requirements.
CC @Moses_Mutesasira , @mherman22