Sleep Apnea Experienced by Patients

Synopsis

This query searches for mentions of sleep apnea in patient records using multi-concept search and returns only those experienced by the patient. This query demonstrates how to use experiencer relations to exclude those entities that were experienced by persons other than the patient themselves (such family members).

Processing Requirements

This query assumes that at least the following emtellipro-db-client processing options were enabled:

  • --feature experiencer-relation, snomed-ontology
  • --store-sections-and-sentences

For this query, Clinical notes were processed with the following document type:

  • --category Clinical
  • --subcategory generic (or more specific report types such as Discharge Summary, SOAP Note, CCD as applicable)

Clinical Context

This query is similar to the multi-concept query on sleep apnea except that it uses a CTE to identify cases where the experiencer of the sleep apnea concept is either implicitly or explicitly labeled as being the patient, rather than a family member or other person. This query can have the experiencer concepts in it modified to find mentions of the concepts of clinical concern that apply to other persons, for example a 72705000 |Mother (person)| or 65616008 |Son (person)|.

Multi-concept query for:

  • 78275009 |Obstructive sleep apnea syndrome (disorder)|
  • 73430006 |Sleep apnea (disorder)|
  • 55442000 |Paroxysmal nocturnal dyspnea (finding)|
  • 62744007 |Orthopnea (finding)|
  • 47545007 |Continuous positive airway pressure ventilation treatment (regime/therapy)|

SQL query

-- Combining concept search with experiencer relation
WITH explicitpatients_ers AS (SELECT er.id AS expid
FROM experiencerrelation er
JOIN entity e
ON er.experiencer_id = e.id -- NOTE: find experience(r) entities
JOIN foundentity fe
ON fe.id = e.entity_id -- IMPORTANT: e.entity_id not e.id
JOIN foundentityconcept fec
ON fe.id = fec.found_entity_id
JOIN concept c
ON c.concept_id = fec.concept_id AND c.ontology = fec.concept_ontology
WHERE c.ontology = 'snomed'
AND e.type_ = 'found' -- IMPORTANT: this condition is required.
AND c.concept_id = '116154003'), -- SNOMED CT concept id for patient
implicitpatients_ers AS (SELECT er.id AS expid
FROM entity e
JOIN experiencerrelation er
ON er.experiencer_id = e.id -- NOTE: experience(r) entities
JOIN assumedentity ae
ON ae.id = e.entity_id
WHERE e.type_ = 'assumed'
AND ae.value = 'patient'),
patient_ers AS ( -- experiencer relations where subject is patient
SELECT expid
FROM implicitpatients_ers
UNION
SELECT expid
FROM explicitpatients_ers
)
SELECT c.concept_id As concept_id,
c.description AS concept_description,
fe.section_name,
fe.text AS annotated_text,
sl.text AS sentence
FROM patient_ers
JOIN experiencerrelation er ON patient_ers.expid = er.id
JOIN entity e ON er.experienced_id = e.id -- NOTE: experience(d) entities
JOIN foundentity fe ON fe.id = e.entity_id AND e.type_ = 'found'
JOIN foundentityconcept fec ON fe.id = fec.found_entity_id
JOIN concept c ON c.concept_id = fec.concept_id AND c.ontology = fec.concept_ontology
JOIN foundentitylocation fel ON fe.id = fel.found_entity_id
JOIN location l
ON fel.location_id = l.id AND l.type_ = 'sentence' -- IMPORTANT: check that location type is 'sentence'
JOIN sentencelocation sl ON sl.id = l.location_id
WHERE c.ontology = 'snomed'
AND er.polarity = 'asserted'
AND c.concept_id IN ('78275009', '73430006', '55442000', '62744007', '47545007')
AND fe.polarity = 'asserted'
AND fe.uncertainty = 'certain';
concept_idconcept_descriptionsection_nameannotated_textsentence
47545007Continuous positive airway pressure ventilation treatment (regime/therapy)SUBJECTIVECPAPMr. Sidney is a 50-year-old man who returns to discuss his still moderate-to- sleep apnea, and to review his response to CPAP.
47545007Continuous positive airway pressure ventilation treatment (regime/therapy)ASSESSMENTCPAPI recommend he continues CPAP indefinitely.
47545007Continuous positive airway pressure ventilation treatment (regime/therapy)SUBJECTIVECPAPHe estimates that he uses the CPAP approximately 4-6 nights per week, and on occasion takes it off and does not replace the mask when he awakens spontaneously in the middle of the night.
47545007Continuous positive airway pressure ventilation treatment (regime/therapy)SUBJECTIVECPAPAs noted, the patient is not snoring on CPAP.
47545007Continuous positive airway pressure ventilation treatment (regime/therapy)SUBJECTIVECPAPHe was found to have moderate-to-severe sleep apnea, and was treated with nasal CPAP for the past few months.
47545007Continuous positive airway pressure ventilation treatment (regime/therapy)ASSESSMENTCPAPIf this continues, we can consider a new sleep study to determine whether he still needs CPAP.
73430006Sleep apnea (disorder)ASSESSMENTsleep apneaModerate-to-severe sleep apnea.
73430006Sleep apnea (disorder)SUBJECTIVEsleep apneaHe was found to have moderate-to-severe sleep apnea, and was treated with nasal CPAP for the past few months.
78275009Obstructive sleep apnea syndrome (disorder)PAST MEDICAL HISTORYOSAOSA
78275009Obstructive sleep apnea syndrome (disorder)DISCHARGE DIAGNOSISOSAOSA