-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct OPT path computation to include archetype ids.
Add a new report for missing coding in templates.
- Loading branch information
1 parent
cda879a
commit f1dc766
Showing
24 changed files
with
611 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
note | ||
component: "openEHR ADL Tools" | ||
description :"Extract missing LOINC codes and missing value-sets for all templates" | ||
keywords: "ADL, archetype, compiler, command line" | ||
author: "Thomas Beale <[email protected]>" | ||
support: "http://www.openehr.org/issues/browse/AWB" | ||
copyright: "Copyright (c) 2024- Graphite Health <http://www.GraphiteHealth.io>" | ||
license: "Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>" | ||
|
||
class | ||
TEMPLATES_MISSING_CODING | ||
|
||
inherit | ||
CLI_COMMAND | ||
rename | ||
make as make_cli | ||
end | ||
|
||
create | ||
make | ||
|
||
feature -- Initialization | ||
|
||
make (an_output_dir: STRING; report_std_out_agt, report_std_err_agt: PROCEDURE [ANY, TUPLE[STRING]]; an_error_reported_agt: FUNCTION[ANY, TUPLE[], BOOLEAN]) | ||
do | ||
make_cli (report_std_out_agt, report_std_err_agt, an_error_reported_agt) | ||
|
||
output_dir := an_output_dir | ||
if not file_system.is_absolute_pathname (output_dir) then | ||
output_dir := file_system.pathname (file_system.current_working_directory, output_dir) | ||
end | ||
file_system.recursive_create_directory (output_dir) | ||
if not file_system.directory_exists (output_dir) then | ||
report_std_err (get_msg ({ADL_MESSAGES_IDS}.ec_invalid_output_directory, <<output_dir>>)) | ||
end | ||
end | ||
|
||
feature -- Commands | ||
|
||
execute | ||
-- export all term bindings into one files per terminology namespace | ||
-- Each file is a CSV file of the form | ||
-- archetype_id, archetype_node_id, binding_value | ||
local | ||
out_file: KI_TEXT_OUTPUT_FILE | ||
output_filename: STRING | ||
fac: JSON_SERIALIZATION_FACTORY | ||
conv: JSON_SERIALIZATION | ||
do | ||
report_std_out ("--------- Exporting templates missing coding to " + output_dir + "---------") | ||
|
||
current_library.do_for_all_templates (agent tpl_get_missing_codes) | ||
|
||
output_filename := file_system.pathname (output_dir, "Template_missing_codes.json") | ||
out_file := file_system.new_output_file (output_filename) | ||
|
||
out_file.open_write | ||
-- out_file.put_string (row_str) | ||
|
||
conv := fac.smart_serialization | ||
conv.set_pretty_printing | ||
conv.context.serializer_context.set_is_type_name_included (False) | ||
|
||
if attached conv.to_json_string (missing_codes_reports) as s then | ||
out_file.put_string (s) | ||
end | ||
|
||
out_file.close | ||
|
||
-- report_std_out (" Exported " + binding_count.out + " " + namespace + " bindings%N") | ||
end | ||
|
||
feature {NONE} -- Implementation | ||
|
||
output_dir: STRING | ||
|
||
missing_codes_reports: STRING_TABLE [STRING_TABLE [ARCHETYPE_MISSING_CODES_REPORT]] | ||
-- reports of archetypes missing coding, keyed by template id | ||
attribute | ||
create Result.make(0) | ||
end | ||
|
||
tpl_get_missing_codes (aci: ARCH_LIB_TEMPLATE) | ||
local | ||
missing_codes_visitor: MISSING_CODES_VISITOR | ||
c_iterator: OG_CONTENT_ITERATOR | ||
do | ||
if aci.is_valid then | ||
create missing_codes_visitor | ||
missing_codes_visitor.initialise (aci.opt) | ||
create c_iterator.make (aci.opt.definition.representation, missing_codes_visitor) | ||
c_iterator.do_all | ||
missing_codes_visitor.finalise | ||
|
||
missing_codes_reports.put (missing_codes_visitor.missing_codes_report, aci.id.as_string) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
96 changes: 96 additions & 0 deletions
96
components/archetype_repository/src/reporting/archetype_missing_codes.e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
note | ||
component: "openEHR ADL Tools" | ||
description: "Record missing codes for a templated archetype" | ||
keywords: "export, archetype, ADL" | ||
author: "Thomas Beale <[email protected]>" | ||
support: "openEHR AWB project <http://www.openehr.org/issues/browse/AWB>" | ||
copyright: "Copyright (c) 2024 Graphite Health" | ||
license: "Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>" | ||
|
||
class ARCHETYPE_MISSING_CODES | ||
|
||
inherit | ||
ADL_2_TERM_CODE_TOOLS | ||
export | ||
{NONE} all | ||
end | ||
|
||
create | ||
make | ||
|
||
feature -- Initialisation | ||
|
||
make (an_archetype_root: C_COMPLEX_OBJECT; an_archetype_id, a_template_id, a_template_path: STRING) | ||
do | ||
archetype_root := an_archetype_root | ||
archetype_id := an_archetype_id | ||
template_id := a_template_id | ||
template_path := a_template_path | ||
|
||
create missing_id_code_bindings_table.make(0) | ||
create missing_value_sets_table.make(0) | ||
|
||
create missing_id_code_bindings.make(0) | ||
create missing_value_sets.make(0) | ||
end | ||
|
||
feature -- Access | ||
|
||
archetype_root: C_COMPLEX_OBJECT | ||
|
||
archetype_id: STRING | ||
|
||
template_id: STRING | ||
|
||
template_path: STRING | ||
|
||
missing_id_code_bindings: STRING_TABLE [STRING] | ||
-- nodes with missing id-code bindings, keyed by id-code | ||
|
||
missing_value_sets: STRING_TABLE [TUPLE [c_terminology_node_ac_code: STRING; value_set: detachable ARRAYED_LIST[STRING]]] | ||
-- coded nodes with missing value-set bindings, keyed by id-code of owning object | ||
|
||
add_missing_id_code_binding (a_c_node: C_OBJECT; a_term_desc: STRING) | ||
do | ||
missing_id_code_bindings_table.put ([a_c_node, a_term_desc], a_c_node.path_to_node (archetype_root)) | ||
missing_id_code_bindings.put (a_term_desc, a_c_node.path_to_node (archetype_root)) | ||
end | ||
|
||
add_missing_value_set (a_c_terminology_node: C_TERMINOLOGY_CODE; identified_parent: C_COMPLEX_OBJECT; a_terminology: ARCHETYPE_TERMINOLOGY) | ||
local | ||
value_set_terms: ARRAYED_LIST[STRING] | ||
identified_parent_term_desc: STRING | ||
do | ||
identified_parent_term_desc := a_terminology.term_definition (default_language, identified_parent.node_id).text | ||
if a_terminology.value_sets.has (a_c_terminology_node.constraint) and attached a_terminology.value_sets.item (a_c_terminology_node.constraint) as vset then | ||
create value_set_terms.make (0) | ||
across vset.members as vset_csr loop | ||
value_set_terms.extend (annotated_code (vset_csr.item, a_terminology.term_definition (a_terminology.default_language, vset_csr.item).text, "")) | ||
end | ||
end | ||
missing_value_sets_table.put ([a_c_terminology_node, identified_parent_term_desc, value_set_terms], identified_parent.node_id) | ||
missing_value_sets.put ([annotated_code (a_c_terminology_node.constraint, a_terminology.term_definition (default_language, a_c_terminology_node.constraint).text, ""), value_set_terms], | ||
annotated_code (identified_parent.node_id, identified_parent_term_desc, "")) | ||
end | ||
|
||
as_report: ARCHETYPE_MISSING_CODES_REPORT | ||
do | ||
create Result.make (Current) | ||
end | ||
|
||
feature -- Status Report | ||
|
||
is_empty: BOOLEAN | ||
do | ||
Result := missing_id_code_bindings_table.is_empty and missing_value_sets_table.is_empty | ||
end | ||
|
||
feature {NONE} -- Implementation | ||
|
||
missing_id_code_bindings_table: STRING_TABLE [TUPLE [c_node: C_OBJECT; term_desc: STRING]] | ||
-- nodes with missing id-code bindings, keyed by id-code | ||
|
||
missing_value_sets_table: STRING_TABLE [TUPLE [c_terminology_node: C_TERMINOLOGY_CODE; term_desc: STRING; value_set: detachable ARRAYED_LIST[STRING]]] | ||
-- coded nodes with missing value-set bindings, keyed by id-code of owning object | ||
|
||
end |
34 changes: 34 additions & 0 deletions
34
components/archetype_repository/src/reporting/archetype_missing_codes_report.e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
note | ||
component: "openEHR ADL Tools" | ||
description: "Record missing codes for a templated archetype" | ||
keywords: "export, archetype, ADL" | ||
author: "Thomas Beale <[email protected]>" | ||
support: "openEHR AWB project <http://www.openehr.org/issues/browse/AWB>" | ||
copyright: "Copyright (c) 2024 Graphite Health" | ||
license: "Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html>" | ||
|
||
class ARCHETYPE_MISSING_CODES_REPORT | ||
|
||
create | ||
make | ||
|
||
feature -- Initialisation | ||
|
||
make (source: ARCHETYPE_MISSING_CODES) | ||
do | ||
archetype_id := source.archetype_id | ||
missing_id_code_bindings := source.missing_id_code_bindings | ||
missing_value_sets := source.missing_value_sets | ||
end | ||
|
||
feature -- Access | ||
|
||
archetype_id: STRING | ||
|
||
missing_id_code_bindings: STRING_TABLE [STRING] | ||
-- nodes with missing id-code bindings, keyed by id-code | ||
|
||
missing_value_sets: STRING_TABLE [TUPLE [c_terminology_node_ac_code: STRING; value_set: detachable ARRAYED_LIST[STRING]]] | ||
-- coded nodes with missing value-set bindings, keyed by id-code of owning object | ||
|
||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.