A NestJS-based FHIR SDC Adaptive Questionnaire server that implements the PHQ-2/PHQ-9 depression screening workflow.
This server implements the adaptive questionnaire pattern where:
- Patient starts with PHQ-2 (2 questions)
- Server calculates the PHQ-2 score
- If score > 2, the server returns PHQ-9 (9 questions) for further assessment
- If score <= 2, the assessment is complete
The easiest way to run the entire stack (Aidbox + Adaptive Forms Server) with pre-loaded questionnaires:
docker-compose up -dThis will start:
- Aidbox at http://localhost:8888 (admin/password)
- Adaptive Forms Server at http://localhost:3000
- PostgreSQL database
- Pre-loaded PHQ-2 Questionnaire (via init-bundle)
Wait 30-60 seconds for services to initialize, then verify the questionnaire was loaded:
curl -u basic:secret http://localhost:8888/fhir/Questionnaire/phq-2To stop:
docker-compose downThis implementation follows the FHIR SDC (Structured Data Capture) Adaptive Questionnaire specification:
- Implements
$next-questionoperation - Accepts QuestionnaireResponse
- Returns next Questionnaire based on adaptive logic
- Uses standard LOINC codes for answers