ccda_to_omop.find_paths module

ccda_to_omop.find_paths.get_base_elements(metadata: dict) dict[source]

Fetches keys of elements that are fetched from XML. The types of these keys are FIELD, PK. The keys are returned as config, field pairs.

config_key –> field_key –>
{ ‘type’: ‘constant’,

‘arg’ : path | constant | FK field key , ‘order’ : n

ccda_to_omop.find_paths.get_derived_fields(metadata: dict) dict[source]

Fetches functions and arguments (field names) of elements that are derived from base fields. The types of these keys are DERIVED and DOMAIN. Only DERIVED are fetched here because DOMAIN are part of denying fields that are in the wrong domain. TODO.

Returns for each config_key, field_key a dictionary with ‘function’ and ‘args’ keys and associated values.

config_key –> field_key –> {‘type’: function name,

‘args’ : [ field names ], ‘order’ : int }

# DERIVED config_key –> field_key –>

{ ‘type’: function-name,

‘args-dict’ : { arg_name_1: struct_1, …arg_name_n: struct_n } ‘order’ : n

}

# FK config_key –> field_key –>

{ ‘type’: ‘FK’,

‘args-dict’ : { FK_field_key : struct_1 } ‘order’ : n

}

ccda_to_omop.find_paths.get_hash_fields(metadata: dict, derived_field_dict: dict) dict[source]
‘measurement_id_hash’: {

‘config_type’: ‘HASH’, ‘fields’ : [ ‘measurement_id_root’, ‘measurement_id_extension’ ],

config_key –> field_key –>
{ ‘function’: ‘hash’,

‘values-dict’ : { arg_name_1: struct_1, …arg_name_n: struct_n } ‘order’ : n

ccda_to_omop.find_paths.main() None[source]
ccda_to_omop.find_paths.merge_second_level_dict(dest_dict: dict, additional_dict: dict) None[source]

Merge additional_dict into dest_dict, combining second-level dicts with | for shared keys.

ccda_to_omop.find_paths.print_data_hash(data_hash: dict) None[source]

Print a human-readable view of the nested field path/type/order structure produced by get_*_fields().

ccda_to_omop.find_paths.strip_detail(input_string: str) str[source]

strips namespaces and conditionals out of an XPath