Skip to content

Commit

Permalink
Add support for itemConstraint. Add support for collections
Browse files Browse the repository at this point in the history
Closes #90
  • Loading branch information
ruscoder committed Dec 4, 2024
1 parent 77c0174 commit f0def31
Show file tree
Hide file tree
Showing 10 changed files with 313 additions and 79 deletions.
8 changes: 8 additions & 0 deletions sdc-qrf/src/converter/__tests__/fce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import fce_allergies from './resources/questionnaire_fce/allergies.json';
import fce_beverages from './resources/questionnaire_fce/beverages.json';
import fce_choice_answer_option from './resources/questionnaire_fce/choice_answer_option.json';
import fce_consent from './resources/questionnaire_fce/consent.json';
import fce_constraint from './resources/questionnaire_fce/constraint.json';
import fce_cqf_examples from './resources/questionnaire_fce/cqf-examples.json';
import fce_enable_when from './resources/questionnaire_fce/enable_when.json';
import fce_encounter_create from './resources/questionnaire_fce/encounter_create.json';
Expand All @@ -31,12 +32,14 @@ import fce_practitioner_role_create from './resources/questionnaire_fce/practiti
import fce_public_appointment from './resources/questionnaire_fce/public_appointment.json';
import fce_review_of_systems from './resources/questionnaire_fce/review_of_systems.json';
import fce_source_queries from './resources/questionnaire_fce/source_queries.json';
import fce_unit_option from './resources/questionnaire_fce/unit-option.json';
import fce_vitals from './resources/questionnaire_fce/vitals.json';
// fhir questionnaire
import fhir_allergies from './resources/questionnaire_fhir/allergies.json';
import fhir_beverages from './resources/questionnaire_fhir/beverages.json';
import fhir_choice_answer_option from './resources/questionnaire_fhir/choice_answer_option.json';
import fhir_consent from './resources/questionnaire_fhir/consent.json';
import fhir_constraint from './resources/questionnaire_fhir/constraint.json';
import fhir_cqf_examples from './resources/questionnaire_fhir/cqf-examples.json';
import fhir_enable_when from './resources/questionnaire_fhir/enable_when.json';
import fhir_encounter_create from './resources/questionnaire_fhir/encounter_create.json';
Expand All @@ -55,6 +58,7 @@ import fhir_practitioner_role_create from './resources/questionnaire_fhir/practi
import fhir_public_appointment from './resources/questionnaire_fhir/public_appointment.json';
import fhir_review_of_systems from './resources/questionnaire_fhir/review_of_systems.json';
import fhir_source_queries from './resources/questionnaire_fhir/source_queries.json';
import fhir_unit_option from './resources/questionnaire_fhir/unit-option.json';
import fhir_vitals from './resources/questionnaire_fhir/vitals.json';
// fce questionnaire response
import fce_allergies_inprogress_qr from './resources/questionnaire_response_fce/allergies_inprogress.json';
Expand Down Expand Up @@ -114,6 +118,8 @@ describe('Questionanire and QuestionnaireResponses transformation', () => {
[fhir_consent, fce_consent],
[fhir_enable_when, fce_enable_when],
[fhir_cqf_examples, fce_cqf_examples],
[fhir_constraint, fce_constraint],
[fhir_unit_option, fce_unit_option],
])(
'Each FHIR Questionnaire should convert to FCE',
async (fhir_questionnaire, fce_questionnaire) => {
Expand Down Expand Up @@ -147,6 +153,8 @@ describe('Questionanire and QuestionnaireResponses transformation', () => {
[fce_consent, fhir_consent],
[fce_enable_when, fhir_enable_when],
[fce_cqf_examples, fhir_cqf_examples],
[fce_constraint, fhir_constraint],
[fce_unit_option, fhir_unit_option],
])(
'Each FCE Questionnaire should convert to FHIR',
async (fce_questionnaire, fhir_questionnaire) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"resourceType": "Questionnaire",
"id": "constraint",
"meta": {
"profile": ["https://beda.software/beda-emr-questionnaire"]
},
"status": "active",
"item": [
{
"type": "string",
"linkId": "email",
"itemConstraint": [
{
"key": "first",
"requirements": "Req first",
"severity": "error",
"human": "Human first",
"expression": "false"
},
{
"key": "second",
"requirements": "Req second",
"severity": "error",
"human": "Human second",
"expression": "true"
}

]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"resourceType": "Questionnaire",
"id": "unit-option",
"meta": {
"profile": ["https://beda.software/beda-emr-questionnaire"]
},
"status": "active",
"item": [
{
"type": "quantity",
"linkId": "height",
"unitOption": [
{
"code": "foot",
"system": "http://unitsofmeasure.org",
"display": "ft"
},
{
"code": "inch",
"system": "http://unitsofmeasure.org",
"display": "in"
},
{
"code": "cm",
"system": "http://unitsofmeasure.org",
"display": "cm"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"item": [
{
"type": "string",
"linkId": "email",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-constraint",
"extension": [
{
"url": "key",
"valueId": "first"
},
{
"url": "human",
"valueString": "Human first"
},
{
"url": "severity",
"valueCode": "error"
},
{
"url": "expression",
"valueString": "false"
},
{
"url": "requirements",
"valueString": "Req first"
}
]
},
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-constraint",
"extension": [
{
"url": "key",
"valueId": "second"
},
{
"url": "human",
"valueString": "Human second"
},
{
"url": "severity",
"valueCode": "error"
},
{
"url": "expression",
"valueString": "true"
},
{
"url": "requirements",
"valueString": "Req second"
}
]
}
]
}
],
"meta": {
"profile": ["https://beda.software/beda-emr-questionnaire"]
},
"status": "active",
"resourceType": "Questionnaire",
"id": "constraint"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"item": [
{
"type": "quantity",
"linkId": "height",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
"valueCoding": {
"code": "foot",
"system": "http://unitsofmeasure.org",
"display": "ft"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
"valueCoding": {
"code": "inch",
"system": "http://unitsofmeasure.org",
"display": "in"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
"valueCoding": {
"code": "cm",
"system": "http://unitsofmeasure.org",
"display": "cm"
}
}
]
}
],
"meta": {
"profile": ["https://beda.software/beda-emr-questionnaire"]
},
"status": "active",
"id": "unit-option",
"resourceType": "Questionnaire"
}
Loading

0 comments on commit f0def31

Please sign in to comment.