Implement CRMI $validate operation#1023
Conversation
|
Formatting check succeeded! |
|
c-schuler
left a comment
There was a problem hiding this comment.
I have some concerns with the collision with HAPI's built-in $validate operation. I have been discussing with the committer through other channels. Despite that, the code looks pretty good - just a few suggested changes.
|
|
||
| public FhirValidatorRegistry(DaoRegistry daoRegistry) { | ||
| this.daoRegistry = daoRegistry; | ||
| packagesToLoad.add(new String[] {"hl7.fhir.us.ecr", "2.1.2"}); |
There was a problem hiding this comment.
Hmm. This should be configurable or moved into an ecr-specific package instead of the generic cqf-fhir-cr-hapi module. Take the package list (or CrSettings) as a constructor / Spring property so consumers can supply their own.
| var vsmIG = new NpmPackageValidationSupport(ctx); | ||
| var chain = new ValidationSupportChain( | ||
| npm, | ||
| vsmIG, |
There was a problem hiding this comment.
npm and vsmIG aren't doing anything, right? They are created, but nothing is ever loaded into them... The loadPrePopulatedValidationSupport method is actually loading the eCR profiles. Maybe I am misreading this?
| } | ||
|
|
||
| @Test | ||
| void validate_verify_operation() { |
There was a problem hiding this comment.
Would like to see this test actually assert behavior - e.g. inspect the returned operation outcome. I would also like to see tests for the FhirValidatorRegistry.
| public IBaseOperationOutcome validate(IBaseBundle resource, String mode, String profile) { | ||
| var processor = validateProcessor != null | ||
| ? validateProcessor | ||
| : new ValidateProcessor(FhirContext.forVersion(fhirVersion)); |
There was a problem hiding this comment.
Just use repository.fhirContext() instead of a fresh context per call.



Added $validate operation processors
Added the operation to the R4 CR config
Added FhirValidatorRegistry, which stores version specific validators, configured with an Npm Loaded ValidationSupportChain. This prevents running the expensive validator configuration process for each incoming request.
Tests to follow
Issue tracking operation migration process: DBCG/aphl-vsm#604