-
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-3440: Add IG entity and repository, integrated into Evaluate task #573
Conversation
3269b0d
to
eb0fa6d
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #573 +/- ##
==========================================
+ Coverage 84.22% 84.29% +0.06%
==========================================
Files 272 274 +2
Lines 11584 11663 +79
Branches 1279 1302 +23
==========================================
+ Hits 9757 9831 +74
- Misses 1817 1822 +5
Partials 10 10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Tests all passed, and Thor CLI integration looks good.
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.
This doesn't seem like it will really be useable outside of the CLI unless IGs are stored in a repository.
An IG seems like an entity, so I think it should live in lib/inferno/entities
and have an id. Then you can also add a basic in memory repository to go along with it. It doesn't have to be done as part of this PR, but I think ideally this would also check for IGs in ~/.fhir
to avoid repeatedly downloading them.
f150cd0
to
9ad449e
Compare
e345225
to
5b469a5
Compare
@@ -25,12 +25,12 @@ def load_ig(ig_input, idx = nil, thor_config = { verbose: true }) | |||
else | |||
raise StandardError, <<~FAILED_TO_LOAD | |||
Could not find implementation guide: #{ig_input} | |||
Put its package.tgz file directly in #{ig_path} |
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.
Note I deleted this line because it makes things a lot more complicated when using this with the evaluate rake task. Since we're just downloading to a temp folder in that case, I don't want to say "Put its package.tgz in /var/folders/l1/d3cs21v54hb4djpb1yjnlzm40000gn/T/inferno-core/" or whatever a temp folder path looks like, because doing that and trying the same thing wouldn't work. I'm open to wordsmithing and adding more params if we want to keep a note like this in the error message
lib/inferno/entities/ig.rb
Outdated
Zlib::GzipReader.open(ig_path) | ||
) | ||
|
||
ig = IG.new({}) |
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 think if you make the constructor take **params
instead of just *params
you should be able to do a plain IG.new
without passing an empty hash.
lib/inferno/entities/ig.rb
Outdated
|
||
file_name = relative_path.split('/').last | ||
|
||
# TODO: consider making these regexes we can iterate over in a single loop |
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 don't think we need a TODO here.
91f2fad
to
252796f
Compare
Summary
This PR changes the following
IG
entity class (and corresponding repository) that parses a TGZ file or directory and stores important components from it. This was partly based on existing code in test kits such as https://github.com/inferno-framework/us-core-test-kit/blob/main/lib/us_core_test_kit/generator/ig_loader.rbEvaluate
task to read an IG from a file on disk, or by identifier (for instance "[email protected]"). The download logic is handled by the existingIgDownloader
, but the Evaluate task had to be modified slightly so that it would workIgDownloader
to take a path to write its file to. This allows it to write a downloaded IG to a temporary file instead of alwaysigs/package.tgz
Some notes:
~/.fhir/packages
but I'm hesitant to write to itTesting Guidance
Since the evaluator loads the IG but doesn't do anything useful yet, I suggest adding a little debug note like the following at the bottom of
inferno-core/lib/inferno/apps/cli/evaluate.rb
and running some examples in the evaluator task such as the following (which should all produce identical results):
bundle exec inferno evaluate [email protected]
bundle exec inferno evaluate ./spec/fixtures/uscore311.tgz
(the last two will only work if you already have the package cached via another utility such as the validator cli)
bundle exec inferno evaluate "hl7.fhir.us.core#3.1.1"
bundle exec inferno evaluate "~/.fhir/packages/hl7.fhir.us.core\#3.1.1"