Global Questionnaire Information & Data Linking Standard
This document defines the architectural standard for handling Questionnaires and their corresponding Responses. To ensure data integrity and version persistence across different environments, all links must follow a Canonical Referencing pattern rather than relying on internal database IDs.
1. Questionnaire Identity & Versioning
A Questionnaire is identified by a combination of two specific fields that define its unique "schema identity":
- URL (
url): A globally unique URI (e.g.,https://system-domain.com/Questionnaire/patient-intake).- Note: The URL identifies the "type" of form but is not unique on its own, as multiple versions may exist under the same URL.
- Version (
version): A user-defined String (e.g.,"1.0.4","2024-alpha", or"v2").
The Unique ID vs. Canonical URL
While every Questionnaire has a technical ID that is unique within its specific database instance, this ID is not used as the primary reference in a Response. This is because internal IDs can change during data migrations or environment syncs.
The "source of truth" for a link is the Canonical URL:
Canonical Reference = [URL] + "|" + [Version]
2. Technical Logic Flows
The following flows describe the internal logic for synchronizing these resources. This process ensures that the correct Questionnaire and Response are paired before any data is processed or displayed.
Flow A: Resource Initialization (No Response exists)
- Select Questionnaire: The system identifies the target Questionnaire.
- Initialize Response: A
QuestionnaireResponseis created programmatically. - Establish Link: The Questionnaire’s
urlandversionare written into the Response’squestionnairereference field. - Sync-Reload: The Questionnaire is re-loaded based on the reference stored in the Response. This step ensures that the system is operating on the exact versioned instance linked to the newly created data object.
Flow B: Resource Loading (Response already exists)
- Load Response: The system fetches the existing
QuestionnaireResponse. - Extract Canonical: The system parses the
urlandversionfrom the Response’s reference field. - Load Versioned Questionnaire: The system fetches the specific Questionnaire that matches both the URL and the Version String.
- Resolution: The two resources are now correctly paired for rendering or data processing, ensuring the structure (Questionnaire) matches the data (Response).