# Merging Ontologies and Data from Electronic Health Records
## 4 Description of Our Approach
### Data Acquisition
Each processed file contained several clinical keywords that our tool matched to concepts in the HDO ontology, allowing to build a new enhanced health record, embedding clear and precise semantic explanations of all the clinical terms and notions used in the original document. Table 1 reports a short list of terms, showing some example keywords and terms which have been actually subject to this embedding process during the tests along with their original reference IDs. Typology is determined according to the derived JSON. Name defines a subclass concept related to the corresponding type and IRI is the univocal id present on the ontology which belongs to the area of the domain which matches the name and the typology (an IRI would need to have the prefix [[http://purl.obolibrary.org/obo/](http://purl.obolibrary.org/obo/)]([http://purl.obolibrary.org/obo/](http://purl.obolibrary.org/obo/)) (accessed on 10 January 2024)). After processing, the whole original health record has been reformatted as a reduced set of self-contained, easier-to-read JSON-encoded documents, carefully preserving (and improving on) the original medical data content. We illustrate this in detail with an actual enhanced health record extracted from the set of processed documents obtained from the original CDA document (partially) shown in Figure 1. The original XML CDA file describes the patient's allergy to penicillin (among others) and the severity of the allergic reaction. Processing the hard-to-read XML medical record, a simplified version is created in JSON, where it can be more easily deduced that she is allergic to the drug penicillin and that she had anaphylaxis as a severe allergic reaction. Specifically, two keywords have been extracted, penicillin and anaphylaxis, and they were semantically defined as part of the knowledge domain of the HDO ontology. As shown in Figures 4 and 5, the ontological data records for those two keywords are detailed and rich and allow additional semantic knowledge to be extracted from those records and embedded into to the medical record. The resulting new health record is represented in Figure 6, as shown with a basic JSON file reader and merged in one clearly readable data structure (shown in the centre of the figure). All of the original information about not only that one allergy cited above, but about all three types of allergies that the patient was suffering were included. In fact, those allergies' data were originally split on separate CDA files that were cluttered with XML syntactical artefacts and alphanumeric codes and tags. It also enriched the overall allergies data record with textual descriptions of the terms for related diseases and symptoms, following the semantic connections in the associated ontology (lollipops on the sides of Figure 6). This will help the doctor remember additional drug- and allergy-related concepts, having a handy and valid help to accordingly make a more aware and correct diagnosis. In the centre of Figure 6, there is a table representing the JSONs coming from three HL7 CDA files, each relating to a visit \begin{table}
\begin{tabular}{c c c} \hline \hline
**Typology** & **Name** & **IRI** \\ \hline Allergy & Egg & DOID \_4377 \\ Allergy & Latex & DOID \_0060532 \\ Allergy & Penicillin & DOID \_0060520 \\ Diagnosis & Congestive heart failure & DOID \_6000_ \\ Diagnosis & Pneumonia & DOID \_582_ \\ Reactions & Anaphylaxis & SYMP \_0000895_ \\ Reactions & Rash & SYMP \_0000487_ \\ Reactions & Ventricular tachycardia & SYMP \_0000827_ \\ Reactions & Nausea & SYMP\_0000458_ \\ Reactions & Uticaria & DOID\_1555_ \\ \hline \hline \end{tabular}
\end{table} 
Table 1: List of some terms present in the processed HL7 format files for which a match has been found in the HDO. made by the patient, whereas inside the coloured boxes there are data taken from the HDO ontology, offering additional support to the doctor. Figure 4: A representation of the class penicillin allergy found in HDO. Figure 5: A representation of the class anaphylactic shock found in HDO.