Definition
The MKB Mapping Attributes model provides consolidated information about mappings between local and national codes and SNOMED concepts, specifically for language codes and sexual orientation codes. Can be joined to the patient table to identify language and sexual orientation demographics for individual patients.
Constraints and Notes
Section titled “Constraints and Notes”Soft deletion: Whenis_deletedis true, data fields may be nullified in upstream transformations and should be excluded from most analytical queries. Primary keys and foreign keys are preserved so deleted linked records can be identified
Examples
Section titled “Examples”Active language mappings
Section titled “Active language mappings”SELECT code_id, snomed_concept_id, data_dictionary_national_code, attribute_type, organisation, transform_datetimeFROM hive.explorer_open_safely.mkb_mapping_attributesWHERE is_deleted = FALSE AND attribute_type = 'language'ORDER BY data_dictionary_national_codeSexual orientation mappings
Section titled “Sexual orientation mappings”SELECT code_id, snomed_concept_id, data_dictionary_national_code, attribute_type, transform_datetimeFROM hive.explorer_open_safely.mkb_mapping_attributesWHERE attribute_type = 'sex_orientation'ORDER BY is_deleted, -- Show active mappings first data_dictionary_national_codeMapping statistics by type
Section titled “Mapping statistics by type”SELECT attribute_type, COUNT(*) AS total_mappings, SUM(CASE WHEN is_deleted = FALSE THEN 1 ELSE 0 END) AS active_mappings, SUM(CASE WHEN snomed_concept_id IS NOT NULL THEN 1 ELSE 0 END) AS mappings_with_snomed, MIN(transform_datetime) AS earliest_update, MAX(transform_datetime) AS latest_updateFROM hive.explorer_open_safely.mkb_mapping_attributesGROUP BY attribute_typeORDER BY attribute_type