Skip to content
Alpha: see what works today →
Menu

Matcher rule

same-note-or-document-master-identifier

Two notes match when their current versions carry one master identifier, the identifier of one version of one document, as FHIR's DocumentReference.masterIdentifier and a C-CDA document's ClinicalDocument/id give it: an unstructured document imported as C-CDA and pulled as a DocumentReference to it is one note, whatever the two are typed and whether either holds text. An identifier is compared as the term it is, its value typed by its system, so one a FHIR source writes and one a C-CDA source mapped to FHIR's form are one; an identifier with no system, a plain string, is never compared, since nothing says who issued it. From any sources. Each ordered pair is a row.

The query

PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pav: <http://purl.org/pav/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?record ?other
WHERE {
  ?record pav:hasCurrentVersion ?version .
  ?version cascade:noteOrDocumentMasterIdentifier ?identifier .
  FILTER (isLiteral(?identifier) && DATATYPE(?identifier) != xsd:string)
  ?otherVersion cascade:noteOrDocumentMasterIdentifier ?identifier .
  ?other pav:hasCurrentVersion ?otherVersion .
  FILTER (?other != ?record)
}

Terms it reads

cascade:noteOrDocumentMasterIdentifier · pav:hasCurrentVersion

Rules and decision notes that name it

queries/matcher/same-note-or-document-master-identifier.rq on GitHub ↗