# Merging Ontologies and Data from Electronic Health Records
## 3 Background
### Health Level Seven (HL7)  
HL7 association deals with the management of health standards and makes documents available in the HL7 format. Such a format allows for the analysis and study of the various clinical documents. Hence, the term HL7 is used both as a name for the organisation and as a set of messaging standards [31]. It is probably the most widely used standard in the world for the electronic exchange of clinical information and it was created with the aim of providing a standard for the exchange, integration, sharing, and retrieval of electronic health information. For several years, the HL7 standard has been also criticized, highlighting its complexity, inconsistency, the documentation, and the high cost of integration with other existing software [32; 33]. In this study, we focused on the analysis of medical documents in the CDA standard, which is an XML-based markup standard specifying the encoding, structure, and semantics of clinical documents for exchange, issued by HL7 in year 2000 [34]. A CDA document is an XML document that consists of a header and body. It is presented in this format:  
* Header: includes patient information, author, creation date, document type, provider, etc. * Body: includes clinical details, diagnosis, medications, follow-up, etc. Presented as free and/or structured text in one or multiple sections and may optionally include coded entries, too. Due to the different sections containing different information, each document has a different body and tag which makes its consultation complex. Among the main existing sections ([[https://github.com/HL7/C-CDA-Examples/tree/master](https://github.com/HL7/C-CDA-Examples/tree/master)]([https://github.com/HL7/C-CDA-Examples/tree/master](https://github.com/HL7/C-CDA-Examples/tree/master)), last accessed on 10 November 2023), there are the following:  
1. Allergies Document: type that contains all the information on the allergies detected in the patient and any adverse reactions;
2. Encounters Document: type that contains information relating to the meetings sustained by the patient with the various health professionals;
3. Family History Document: type that contains information relating to the pathologies diagnosed in the patient's family members;
4. Immunizations Document: type that contains information relating to the vaccines carried out by the patient;
5. Interventions Document: type that contains the details relating to all the interventions carried out by the patient;
6. Problems Document: type that contains all the information relating to the health problems diagnosed to the patient. A CDA XML document is made up of several sections, each differing from another according to the medical field treated. For each XML tag present, it is possible to find attributes relating to codes of external dictionaries and/or tags encoding how to read and understand each section that has been populated; it follows that such documents are particularly complex to generate and read. Figure 1 shows a fragment of XML code in a CDA document in which its inner structural complexity can be easily observed. In point (1): the \"root\" tag indicates the unique identifier of a populated section, following immediately below. Each section differs in the type of its contents and the standard used to populate it. In fact, in order to become acquainted with the actual content of the various sections, you need to access and download all the used types of data structures' definitions, available from the remote url: [[https://hlr.org/cda/stds/ccda/draft1/downloads.html](https://hlr.org/cda/stds/ccda/draft1/downloads.html)]([https://hlr.org/cda/stds/ccda/draft1/downloads.html](https://hlr.org/cda/stds/ccda/draft1/downloads.html)), last accessed on 10 January 2024. Point (2), and specifically the \"codeSystem\" attribute within the \"code\" tag, shows which dictionary of codes has been used for the labels present in the section, which in this case is the Logical Observation Identifiers Names and Codes (LOINC) dictionary.