-
Notifications
You must be signed in to change notification settings - Fork 35
Conversation
… start building a Codesystem/-code framework
when %r{application\/.*xml} | ||
return [status, { 'Content-Type' => 'application/fhir+xml' }, resource.to_xml] | ||
else | ||
return [status, { 'Content-Type' => 'application/fhir+json' }, resource.to_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.
can be combined with when %r{application/.*json}
"title" : "Provenance participant type", | ||
"status" : "draft", | ||
"experimental" : false, | ||
"date" : "2023-05-12T00:00:00+10:00", |
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.
really?
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.
Hah; didn't notice this. This file is straight from HL7-- https://www.hl7.org/fhir/codesystem-provenance-agent-type.json.html
set :prefix, '/fhir' | ||
Inferno::Terminology.register_umls_db('umls.db') | ||
Inferno::Terminology.load_valuesets_from_directory('resources', true) | ||
set :logger, Logger.new('terminology_misses.log') |
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.
Why not use Inferno.logger
?
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 could do that, yeah. I wanted this to log to a separate log file to keep them separated, and because I expect this logger to go away once we've been able to add more code systems and valuesets.
lib/app/endpoint/terminology.rb
Outdated
set :logger, Logger.new('terminology_misses.log') | ||
|
||
get '/metadata', provides: ['application/fhir+json', 'application/fhir+xml'] do | ||
if params[:mode] == 'terminology' |
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.
It would be really nice if our business logic didn't live in our endpoints.
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.
Fair. I'll see how much of this I can get into another class as possible.
end | ||
|
||
def respond_with_type(resource, accept, status = 200) | ||
accept.each do |type| |
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 block looks like it always returns, so the iteration doesn't seem necessary.
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.
True. It's complicated because accept
is an array, but we could just take the first item in the array (or search the array for either of the return types we care about before returning the default type).
return respond_with_type(FHIR::OperationOutcome.new(issue: issue), request.accept, 400) | ||
end | ||
|
||
def valueset_validates_code(parameters, id_param = nil) |
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.
These non-endpoint methods also seem like something that could potentially be useful outside of the context of an http request, so it would be nice if they lived somewhere else.
unless @valueset_ids | ||
@valueset_ids = {} | ||
@known_valuesets.each_pair do |k, v| | ||
@valueset_ids[v&.valueset_model&.id] = k |
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.
What do k
and v
actually represent? This makes @valueset_ids
look like a hash whose keys are ids
, but what are its values?
b6ed89f
to
68ac26e
Compare
All but stylistic comments incorporated, incorporating into the next update. |
This Pull Request adds a terminology endpoint to Inferno, to provide the
CodeSystem/$validate-code
andValueSet/$validate-code
operations tofhir-validator-wrapper
. The endpoint also defines ametadata
url, to provideCapabilityStatement
andTerminologyCapabilities
resources for the validator as well.The Terminology Endpoint is part of Inferno, which means it runs on the same base URL and port as Inferno. It is served up at
<inferno_host>:<inferno_port>/fhir
, which must be added tofhir-validator-wrapper
for the time being.This PR also adds some additional valuesets and codesystems to the
resources
directory, but this is not an exhaustive list. Missing valuesets and codesystems are logged toterminology_misses.log
.NOTE: Needs work to fix one test suite for
CodeSystem/$validate-code
.Submitter:
Reviewer 1:
Name:
where appropriate, and accomplishes the task's purpose
Reviewer 2:
Name:
where appropriate, and accomplishes the task's purpose