Named question about pod
My procedures
Read from the view alone, as an app would, newest first by the date as written, so a year follows its months and days, with how many records each entry joins, its code IRI, the first in code point order when it states several, the text each record's source wrote for it, such as the finding beside a screening (none when no record has one), and each record it joins with the document it was derived from, when that was retrieved, and the hospitals that wrote it and that keep it, in order, separated by U+001F, its own parts by ", ". Times written with a zone are ordered by their wall time as written, not as instants: 23:00-05:00 sorts before 01:00Z the next day, though it is later.
The query
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX pav: <http://purl.org/pav/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?performed ?procedure ?procedureCode ?status ?narrativeTexts (COUNT(?record) AS ?records) ?entry ?entryLabel ?sources
WHERE {
{ SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT ?narrativeLine; separator=""), "\u001F$", "") AS ?said)
WHERE {
{ SELECT ?entry ?narrativeLine
WHERE {
?entry a cascade:MedicalProcedure ; cascade:memberCurrentValues ?values .
?values cascade:valuesOfMember ?member .
OPTIONAL { ?values cascade:narrativeText ?memberNarrativeText }
BIND (IF(BOUND(?memberNarrativeText), CONCAT(STR(?member), " ", ?memberNarrativeText, "\u001F"), "") AS ?narrativeLine)
}
ORDER BY ?entry ?narrativeLine }
}
GROUP BY ?entry }
{ SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT CONCAT(?sourceText, "\u001F"); separator=""), "\u001F$", "") AS ?sources)
WHERE {
{ SELECT ?entry ?sourceText
WHERE {
{ SELECT ?entry ?sourceRecord ?document ?retrievedOn
(REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?hospital, ", "), ""); separator=""), ", $", "") AS ?hospitals)
WHERE {
{ SELECT ?entry ?sourceRecord ?document ?retrievedOn ?hospital
WHERE {
?entry a cascade:MedicalProcedure ; cascade:entryMember ?sourceRecord .
OPTIONAL { ?sourceRecord cascade:currentRevision/prov:wasDerivedFrom ?document .
OPTIONAL { ?document pav:retrievedOn ?retrievedOn }
OPTIONAL { ?document prov:wasGeneratedBy/prov:qualifiedAssociation ?association .
?association prov:hadRole ?hospitalRole ; prov:agent ?agent
FILTER (?hospitalRole IN (cascade:AuthorRole, cascade:CustodianRole))
OPTIONAL { ?agent rdfs:label ?agentLabel }
OPTIONAL { ?agent pav:hasCurrentVersion/foaf:name ?agentName }
BIND (CONCAT(IF(?hospitalRole = cascade:AuthorRole, "written by ", "kept by "),
COALESCE(?agentLabel, ?agentName)) AS ?hospital) } }
}
ORDER BY ?entry ?sourceRecord ?document ?hospital }
}
GROUP BY ?entry ?sourceRecord ?document ?retrievedOn }
BIND (CONCAT(STR(?sourceRecord), COALESCE(CONCAT(" from ", STR(?document)), ""),
COALESCE(CONCAT(", retrieved ", STR(?retrievedOn)), ""),
IF(?hospitals = "", "", CONCAT(", ", ?hospitals))) AS ?sourceText)
}
ORDER BY ?entry ?sourceText }
}
GROUP BY ?entry }
?entry a cascade:MedicalProcedure ; cascade:entryMember ?record .
OPTIONAL { ?entry cascade:procedureDate ?performed }
OPTIONAL { ?entry cascade:procedureName ?procedure }
OPTIONAL {
?entry cascade:procedureCode ?procedureCode .
FILTER NOT EXISTS {
?entry cascade:procedureCode ?earlier .
FILTER (STR(?earlier) < STR(?procedureCode))
}
}
OPTIONAL { ?entry cascade:workflowStatus ?status }
OPTIONAL { ?entry rdfs:label ?entryLabel }
BIND (IF(?said = "", ?nothing, ?said) AS ?narrativeTexts)
}
GROUP BY ?entry ?performed ?procedure ?procedureCode ?status ?narrativeTexts ?entryLabel ?sources
ORDER BY DESC(COALESCE(STR(?performed), "")) ?procedure ?entry
Terms it reads
cascade:AuthorRole · cascade:CustodianRole · cascade:MedicalProcedure · cascade:currentRevision · cascade:entryMember · cascade:memberCurrentValues · cascade:narrativeText · cascade:procedureCode · cascade:procedureDate · cascade:procedureName · cascade:valuesOfMember · cascade:workflowStatus · pav:hasCurrentVersion · pav:retrievedOn · prov:agent · prov:hadRole · prov:wasGeneratedBy · rdfs:label
Rules and decision notes that name it
No rule or decision note writes its path.
Its rows on Alex Rivera's pod
2 rows, as Alex Rivera's explorer shows them.
| performed | procedure | procedureCode | status | records | entry | sources |
|---|---|---|---|---|---|---|
| 2026-08-19 | Colonoscopy | http:/ | completed | 2 | Procedure entry · Colonoscopy · 2026-08-19 | urn:uuid:7a11ba0d-eaa3-881d-a511-1f2ee8b8b0e9 from ni:/ |
| 2025-02-18 | Colonoscopy | http:/ | completed | 1 | Procedure entry · Colonoscopy · 2025-02-18 | urn:uuid:c6f34248-0b58-8e8a-8e52-f426d1a8be5c from ni:/ |