Skip to content

Validation#70

Merged
lmd59 merged 7 commits into
mainfrom
validation
May 27, 2026
Merged

Validation#70
lmd59 merged 7 commits into
mainfrom
validation

Conversation

@lmd59

@lmd59 lmd59 commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Validation for $collect-data, subjectGroup and subject Group reference support, and various other small fixes

New behavior

  • $collect-data request sends appropriate HTTP code responses for invalid input
  • Can do $collect-data operation for groups of patients

Some bug fixes:

  • Returns a Parameters resource (rather than array of bundles)
  • Uses valueReference for patient references (for $collect-data subject but also for $export patient parameter)
  • Does not allow underscores in patient ids (see https://hl7.org/fhir/R4/datatypes.html#id)
  • More consistent handling of parameter presence to allow for boolean and 0 values (paramPresent function)

Code changes

  • Reorganizes validation logic into a util file
  • Adds collectDataPatientIds to manage finding patient ids from different parameters sources
  • Moves handling of valueReference.reference to serviceUtils to make parameters consistent between GET and POST
  • Expands validateCollectDataParams to validate recognized, supported, required, and single cardinality parameters for $collect-data according to https://hl7.org/fhir/uv/deqm/2026May/en/OperationDefinition-collect-data.html and checks for availability of expected resources (Patient or Group) on the server. Also enforces exclusivity of subject vs subjectGroup which is anticipated to be clarified in the spec (see https://jira.hl7.org/browse/FHIR-57066 ).

Testing guidance

{
"resourceType": "Parameters",
"parameter": [
   {
   	"name": "periodStart",
   	"valueDate": "2023-01-01"
   },
   {
   	"name": "periodEnd",
   	"valueDate": "2023-12-31"
   },
   {
   	"name": "measureUrl",
   	"valueCanonical": "https://madie.cms.gov/Measure/CMS145FHIRCADBetaBlockerTherapyPriorMIorLVSD|0.4.000"
   },
   {
   	"name": "measureUrl",
   	"valueCanonical": "https://madie.cms.gov/Measure/CMS125FHIRBreastCancerScreening"
   },
   {
   	"name": "subjectGroup",
   	"resource": {
			"resourceType": "Group",
			"type": "person",
			"actual": "true",
			"member": [
				{
					"entity": {"reference": "Patient/f6dafa7e-15a9-4fec-baea-59d43201caf8"}
				},
				{
					"entity": {"reference": "Patient/c58acff5-248b-49c9-b18d-69e4a84a08d9"}
				}
			]
		}
   }
  ]
}

@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.31% (+1.18% 🔼)
769/982
🟡 Branches
70.71% (+2.56% 🔼)
309/437
🟡 Functions
76.97% (+1.33% 🔼)
127/165
🟡 Lines
78.53% (+1.08% 🔼)
750/955
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / validationUtils.js
85.83% 82.72% 93.75% 85.48%

Test suite run success

120 tests passing in 8 suites.

Report generated by 🧪jest coverage report action from f77cb74

POST-based test when using Group parameter

@elsaperelli elsaperelli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small comment but not necessary for merging so I will approve!! Nice!!!

Comment thread src/util/validationUtils.js
@lmd59
lmd59 requested a review from elsaperelli May 27, 2026 13:04

@elsaperelli elsaperelli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@lmd59
lmd59 merged commit 27dcf80 into main May 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants