# Merging Ontologies and Data from Electronic Health Records
## 4 Description of Our Approach
### Data Acquisition
```
{  \"name\": \"[PERSON]\",  \"birthTime\": \"1982\",  \"relationship\": \"Brother\",  \"deceased\": false,  \"deceasedTime\": null,
``` <%xmlversion=\"1.0\"encoding\"utf-8\"> <%xml-stylesheettype=\"text/xml\"href=\"CDA.xml\"> <ClinicIdDocumentxmlxmlxmlxml=\"[[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)]([http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance))\" xml=\"urn:hl7-org:v3\"xml=\"urn:hl7-org:v3\"xml=\"urn:hl7-org:idc\"> xml=\"urn:hl7-org:idc\">...<!--listoftagsrelatedtothexmlencodingcodes--> <recordTarget> <patentNode> <idextension=\"4442222222\"root=\"2.16.840.1.113883.4.1\" /> <telecomvalue=\"tel:+1(555)55-2003\"use=\"HP\" /> <patient> <nameuse=\"L\"> <given>Evec/given> <familyqualifier=\"SP\"Betterhalf</family> </name> <administrativeGenderCode=\"F\"displayName=\"Female\" codesystem=\"2.16.840.1.113883.5.1\" codesystemName=\"AdministrativeGender\" /> <birthTimevalue=\"19750501\" /> <maritalStatusCodecode=\"M\"displayName=\"Married\" codesystem=\"2.16.840.- codesystemName=\"Married\" <religuousAffiliationCodecode=\"1013\" displayName=\"Christian(non-Catholic,non-specific)\" codesystem=\"2.16.840.1.113883.5.1076\" codesystemName=\"HL7 BeligousAffiliation\" />...<!--patientpersonalinformation--> </patient> </patientRole> </recordTarget> <component> <structuredBody> <component> <section> <templateIdroot=\"2.16.840.1.113883.\"/> <templateIdroot=\"2.16.840.1.113883.\"extension=\"2015-08-01\"/> <codecode=\"48765-2\"codeSystem=\"2.16.840.1.113883.6.1\"/> <title>Allergies,AdverseReactionsandAlerts</title> <text> <table> <thed><tr> <th>Allergen</th><th>Reaction</th><th>ReactionSeverity</th> <th>DocumentationDate</th><th>StartDate</th> </tr></head> <th></tr></head> <th></tr></tr></head> <th></tr></tr></tr></head> <th></tr><  
has been processed for data acquisition, a set of labels has been already extracted from it. Those are standardized medical keywords used to unambiguously refer to specific diseases, symptoms, drugs, allergic reactions, etc., that describe the medical story of the patient: the reason for the check, the name and type of the problem encountered, its severity, reactions, date of examinations, etc. Such data can be further enriched with the use of appropriate ontologies. Specifically, we match data extracted from the CDA document with appropriate semantic data extracted from related existing medical ontologies, facilitating doctors' work, e.g., by offering them readable descriptions of the keyword terms and advice and/or suggestions on further related pathologies, i.e., further allergies, diseases, vaccines, etc. While there is no limitation on the variety of ontologies that could be leveraged, in this work we mainly describe the matches found within HDO, also referred as DOID, which is a well-known comprehensive ontology of human diseases including their descriptions, synonyms, antonyms, etc. Other ontologies used in our experiments were OBIB, IDO, and OHD; however, a much smaller number of ontology classes could be found to match clinical data compared to HDO. In more detail, in order to match the relevant semantic data to the data extracted from a CDA, the following steps are performed. * Data extrapolation: for each medical keyword, among the whole set of its associated key-value data pairs we filter only those corresponding to Type and Name keys (see e.g., lines 19 and 23 in Listing 4). This task is easily accomplished thanks to the previous CDA XML data conversion into a more easily processed JSON file, from where it is easier to extrapolate the most relevant keywords. * Data cleaning: in order to make the extracted data actually suitable, data cleaning has to be carried out: that is, elimination of special characters and making all characters lowercase. * Data filtering: a further reduced set of keywords is obtained by selecting only the keywords whose corresponding values has a string length with a maximum of three words.