-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FI-2233: New validation module for HL7 validator wrapper #401
Conversation
1d65476
to
2fa3541
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #401 +/- ##
==========================================
+ Coverage 77.00% 77.05% +0.04%
==========================================
Files 214 215 +1
Lines 10708 10804 +96
Branches 991 1008 +17
==========================================
+ Hits 8246 8325 +79
- Misses 1884 1901 +17
Partials 578 578
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
I would really like access to the machine-readable contents of the IG from within the tests. That way, I could succinctly do something like this simply based on the published capability statement in the ig (vs duplicating it in the suite).
(not quite exactly like that, but having the DSL actually be able to do things a bit more dynamically based on the content of an IG 'at load time' would make Inferno's value prop much higher in my opinion). Given that feature request eventually, would it make sense to put this ig definition at the suite level, and not within the 'validation' section? The IG has a lot more information than just 'profile validation' that we could leverage. Just a thought. I understand the desire to keep the change minimal but also once this gets changed i don't see us having a ton of patience for another iteration. |
I'm not opposed to the idea of moving the We have an upcoming task (FI-2236) to implement the other configuration items that get mapped into the |
I think that is a level of polish that should wait until later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# hl7_validator_service: | ||
# image: markiantorno/validator-wrapper | ||
# # Update this path to match your directory structure | ||
# volumes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the hl7 wrapper need this volume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone wants to load an IG into the validator from a file instead of from a published version, then this is necessary. To reference the IG you can provide a filename:
fhir_resource_validator do
igs ['igs/30-us.core-3.1.1.tgz']
...
end
@@ -28,3 +28,10 @@ services: | |||
volumes: | |||
- ./data/redis:/data | |||
command: redis-server --appendonly yes | |||
# hl7_validator_service: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config/nginx.background.conf
will need an entry for this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an entry plus comments linking the two since it's necessary to enable both at the same time. Note I set the timeout to 600s both in the nginx conf and the actual HTTP call, I know that's way too long but until we get session-startup-magic working it needs to be fairly high.
4bffdf6
to
8ff081b
Compare
When it works, it persist the session ID and re-use it for re-runs. You should see something like
in the I am seeing more 500s than I remember in my testing so I'll keep looking into that before I mark this ready for re-review. |
Re-tested this today and I'm not seeing any 500s, and with some extra debug print statements I confirmed the session ID is re-used, so I'm marking this ready for re-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice that the validator service is loading IGs for extensions that it finds within resources. I expect we will want that to default to off to prevent memory usage from exploding.
That isn't something that needs to be done as part of this ticket, but I'm assuming that's part of the cliContext
so could be done as part of the work to integrate that.
|
||
# @private | ||
def default_validator_url | ||
ENV.fetch('VALIDATOR_URL') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this FHIR_RESOURCE_VALIDATOR_URL
and add it to .env
so both services can be used at the same time without any risk of conflicts.
}, | ||
filesToValidate: [ | ||
{ | ||
fileName: 'manually_entered_file.json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this something like ResourceType/id.json
?
def operation_outcome_from_hl7_wrapped_response(response) | ||
res = JSON.parse(response) | ||
|
||
@session_id = res['sessionId'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a ticket to handle this across processes. It will need to support multiple worker processes like we have in prod, and I expect the web process will need access too in order to display the validator status in the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created FI-2311 for this
Added a note about loading IGs and making sure we have the right cliContext defaults in FI-2236 (in the current sprint). At a glance the 2 things our validator does that aren't replicated here are set |
We'll definitely need to investigate that as I think it could be a show stopper. |
Just so nobody panics on a Friday I did a little more digging, the right settings should be set if we use use these two fields in cliContext. I didn't do a full test to compare results but we can do that as part of FI-2236 "doNative": false,
"extensions": ["any"], |
Summary
This PR introduces a new
Inferno::DSL::FHIRResourceValidation
module which is a clone ofInferno::DSL::FHIRValidation
, modified to support the HL7 validator wrapper. The code is largely the same as the proof of concept in #396 but reworked to be a separate module. The main entry point to use the HL7 wrapper isfhir_resource_validator
which is the replacement of thevalidator
method.The key differences are as follows:
If the IG isn't published yet, then you can pass in a filename here and it will work just fine. (See https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Validator#UsingtheFHIRValidator-LoadinganimplementationGuide for what's accepted) Filenames appear to be relative to the base directory of the HL7 validator wrapper but we will probably need to test different deployment scenarios to confirm.
Testing Guidance
To have test suites actually use the HL7 validator wrapper instead of the inferno wrapper:
hl7_validator_service
indocker-compose.background.yml
fhir_resource_validator
instead ofvalidator
and make sure it points tohttp://localhost:3500
(either as a literal or an env var). An easy place to do this is in the demo suitedev_suites/dev_demo_ig_stu1/demo_suite.rb
:Resouce validation is invoked in Demo Group Instance 1, 1.1.0.7: