Skip to content
Alpha: see what works today →
Menu

Martin Okafor

How this pod is laid out

A pod is a person's own store of data on a Solid server, at an address of its own: this one is at https://pod.martin-okafor.example/. It is a tree of files, and every file but the stored documents is Turtle, statements of the form subject property value. Everything on this site was asked of those files with SPARQL, and every section shows the question it asked: open The query under any answer to read it, and run it yourself.

records/
What each source told the pod, one folder per type. A record's own file says only what it is; each time its source sends it, a revision arrives in a file of its own, carrying a version, the content, in another.
provenance/
Where records came from: each source document, each import that brought documents in, and each time the person entered something themselves.
attachments/
The source documents' own bytes, such as a hospital's FHIR file, each named by the hash of its bytes.
judgments/
Decisions about records: that two are the same thing, that they differ, that one is wrong, or whose a patient profile is.
references/
The code tables the matcher compares codes with, one file per table and per version.
subject/
The person the pod is about.
clinical/
The views: one file per type, listing entries an app can show. The build writes them and can always write them again.
profile/, settings/, manifest.ttl
Solid's own files: the owner's profile, which names the pod's root and the preferences file; the preferences file, which names the type index; and the type index, which says which view lists each type. The build writes the type index from the pod's layout, beside the manifest, which says what built the pod.

Some folders have two-character folders inside them. Those only spread the files out, so no folder holds too many.

What each folder holds

65 rows

A file's folder is its address after the storage root the owner's profile names, and GRAPH ?file reads one file at a time. Each row is one folder, one type of thing its files describe, and how many of them. A two-character folder only spreads files out, so its files count toward the folder above it. A version states no type of its own, so in a records folder the row with no type stated is its versions. The labels file names nearly everything, and is left out here; so is a thing described in a folder other than its own, such as the owner in each judgment they made.

?folder?type?things
/pod manifest cascade:PodManifest1
/clinical/diagnostic report cascade:DiagnosticReport2
/clinical/genetic variant finding cascade:GeneticVariantFinding4
/clinical/medical procedure cascade:MedicalProcedure1
/clinical/patient profile cascade:PatientProfile1
/clinical/prescribed or reported medication cascade:PrescribedOrReportedMedication2
/clinical/problem or diagnosis cascade:ProblemOrDiagnosis2
/clinical/variant interpretation cascade:VariantInterpretation6
/clinical/view cascade:View8
/judgments/SoftwareAgent prov:SoftwareAgent1
/judgments/judgment cascade:Judgment4
/judgments/assertions/matcher judgment assertion cascade:MatcherJudgmentAssertion2
/profile/Person prov:Person1
/profile/foaf:Person1
/provenance/activities/Activity prov:Activity1
/provenance/activities/SoftwareAgent prov:SoftwareAgent1
/provenance/activities/matcher run cascade:MatcherRun1
/provenance/activities/snapshot cascade:Snapshot1
/provenance/documents/Entity prov:Entity2
/provenance/imports/Activity prov:Activity2
/provenance/imports/SoftwareAgent prov:SoftwareAgent1
/provenance/imports/document import cascade:DocumentImport2
/provenance/imports/snapshot cascade:Snapshot2
/records/conditions/FragmentSelector oa:FragmentSelector2
/records/conditions/problem or diagnosis cascade:ProblemOrDiagnosis2
/records/conditions/revision cascade:Revision2
/records/conditions/no type stated2
/records/medications/FragmentSelector oa:FragmentSelector2
/records/medications/prescribed or reported medication cascade:PrescribedOrReportedMedication2
/records/medications/revision cascade:Revision2
/records/medications/no type stated2
/records/organizations/FragmentSelector oa:FragmentSelector2
/records/organizations/organization cascade:Organization2
/records/organizations/revision cascade:Revision2
/records/organizations/no type stated2
/records/patient-profile/FragmentSelector oa:FragmentSelector2
/records/patient-profile/patient profile cascade:PatientProfile2
/records/patient-profile/revision cascade:Revision2
/records/patient-profile/no type stated2
/records/procedures/FragmentSelector oa:FragmentSelector1
/records/procedures/medical procedure cascade:MedicalProcedure1
/records/procedures/revision cascade:Revision1
/records/procedures/no type stated1
/records/reports/FragmentSelector oa:FragmentSelector2
/records/reports/diagnostic report cascade:DiagnosticReport2
/records/reports/revision cascade:Revision2
/records/reports/no type stated2
/records/servers/server cascade:Server2
/records/variant-interpretations/FragmentSelector oa:FragmentSelector6
/records/variant-interpretations/revision cascade:Revision6
/records/variant-interpretations/variant interpretation cascade:VariantInterpretation6
/records/variant-interpretations/no type stated6
/records/variants/FragmentSelector oa:FragmentSelector6
/records/variants/genetic variant finding cascade:GeneticVariantFinding6
/records/variants/revision cascade:Revision6
/records/variants/no type stated6
/references/dcat:Dataset1
/references/Entity prov:Entity2
/references/reference series cascade:ReferenceSeries2
/references/no type stated20
/settings/pim:ConfigurationFile1
/settings/Type index solid:TypeIndex1
/settings/Type Registration solid:TypeRegistration8
/settings/solid:UnlistedDocument1
/subject/subject cascade:Subject1

65 rows

The query: queries/questions/pod/What each folder holds.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pim: <http://www.w3.org/ns/pim/space#>

SELECT ?folder ?type (COUNT(DISTINCT ?thing) AS ?things)
WHERE {
  { SELECT DISTINCT ?file ?thing ?root
    WHERE {
      ?owner pim:storage ?root .
      GRAPH ?file { ?thing ?property ?value }
      FILTER (isIRI(?thing) && STRSTARTS(STR(?file), STR(?root)))
    } }
  OPTIONAL { GRAPH ?file { ?thing a ?stated } }
  BIND (CONCAT("/", REPLACE(STRAFTER(STR(?file), STR(?root)), "([0-9a-f]{2}/)?[^/]*$", "")) AS ?folder)
  BIND (COALESCE(?stated, "no type stated") AS ?type)
  FILTER (BOUND(?stated) || NOT EXISTS { ?file a cascade:View })
  FILTER (!STRSTARTS(STR(?thing), STR(?root)) || STRSTARTS(STR(?thing), CONCAT(STR(?root), SUBSTR(?folder, 2))))
}
GROUP BY ?folder ?type
ORDER BY ?folder ?type

The terms it uses: pim:storage, cascade:View.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/What each folder holds"

Or in GraphDB, open the saved query pod/What each folder holds in the repository martin-okafor.

The views

An app does not read records. It reads a view: one file per type, whose entries each join the records judged to be the same thing. How a view is built shows each step from records to views, and Not shown lists the records no view shows, and why.

Which view lists each kind

7 rows

An app finds a Solid pod's data through its type index: each registration names a type and the file that lists things of that type. Here each of those files is a view, and the entries are the things it lists. A view is never edited by hand; the build writes it from the records and the judgments.

7 rows

The query: queries/questions/pod/Which view lists each kind.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX solid: <http://www.w3.org/ns/solid/terms#>

SELECT ?title ?type ?view (COUNT(DISTINCT ?entry) AS ?entries)
WHERE {
  ?registration a solid:TypeRegistration ; solid:forClass ?type ; solid:instance ?view ; dct:title ?title .
  OPTIONAL { ?entry a ?type ; cascade:entryMember [] }
}
GROUP BY ?title ?type ?view
ORDER BY ?title ?view

The terms it uses: solid:TypeRegistration, solid:forClass, solid:instance, dct:title, cascade:entryMember.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/Which view lists each kind"

Or in GraphDB, open the saved query pod/Which view lists each kind in the repository martin-okafor.

Questions about the whole pod

Each record, entry, judgment and patient profile has a page of its own with the questions about it. These are the questions about the pod as a whole.

How many of each kind

31 rows

How many things of each type the pod's files state. Records and entries share a type, so an allergy or intolerance counts both the allergies each source sent and the entries the allergies view joins them into. GRAPH ?file reads one file at a time, and only files under the storage root count: a type only the derivations state, such as cascade:Record, is in the derived state's own graph and is left out.

31 rows

The query: queries/questions/pod/How many of each kind.rq on GitHub
PREFIX pim: <http://www.w3.org/ns/pim/space#>

SELECT ?type (COUNT(DISTINCT ?thing) AS ?things)
WHERE {
  GRAPH ?file { ?thing a ?type }
  ?owner pim:storage ?root .
  FILTER (STRSTARTS(STR(?file), STR(?root)))
}
GROUP BY ?type
ORDER BY ?type

The terms it uses: pim:storage.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/How many of each kind"

Or in GraphDB, open the saved query pod/How many of each kind in the repository martin-okafor.

My active allergies: none. The question

My active conditions

2 rows

Read from the view alone, as an app would: each entry whose status is active and not ruled out, so not one whose status was taken from a refuted record (`pod/My condition history` lists those), with its codes, its onset, each entry of a medication, procedure or vaccination a record of which was given for one of its records, once, as "<entry>, <name>" (the entry IRI alone when it has no name; the entry IRI holds no ", ", so the first ", " ends it and the name, which may hold anything, is the rest; none when no record names one; not an entry of a medication its source marked entered in error), in code point order of name (an entry with no name first), then entry, how many records it joins, and each record with the document it was derived from, when that was retrieved, and the hospitals that wrote it and that keep it. A list holds its values in order, separated by U+001F, a value's own parts by ", ". Its code is the code IRI the entry states, in whichever listed system, the first in code point order when it states several, so that each entry is one row.

?condition?conditionCode?onset?entriesForIt?records?entry?sources
Essential hypertensionSNOMED CT 383410032019-05-141Condition entry · Essential hypertension · 2019-05-14urn:uuid:86263524-631f-80dc-b742-80ff2d9597d5 from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital
HyperlipidemiaSNOMED CT 558220042021-09-301Condition entry · Hyperlipidemia · 2021-09-30urn:uuid:07bd7acd-f2b7-8d0c-846f-7fda112a3213 from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital

2 rows

The query: queries/questions/pod/My active conditions.rq on GitHub
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 ?condition ?conditionCode ?onset ?entriesForIt (COUNT(?record) AS ?records) ?entry ?entryLabel ?sources
WHERE {
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT ?forLine; separator=""), "\u001F$", "") AS ?forIt)
    WHERE {
      { SELECT ?entry ?forLine
        WHERE {
          ?entry a cascade:ProblemOrDiagnosis ; cascade:entryMember ?conditionRecord .
          OPTIONAL { ?forValues cascade:reasonCondition ?conditionRecord .
                     ?forEntry cascade:memberCurrentValues ?forValues .
                     OPTIONAL { ?forEntry cascade:drugName ?drugName }
                     OPTIONAL { ?forEntry cascade:procedureName ?procedureName }
                     OPTIONAL { ?forEntry cascade:vaccineName ?vaccineName }
                     FILTER NOT EXISTS { ?forEntry cascade:lifecycle cascade:MedicationEnteredInError } }
          BIND (COALESCE(?drugName, ?procedureName, ?vaccineName) AS ?forName)
          BIND (IF(BOUND(?forEntry), CONCAT(STR(?forEntry), COALESCE(CONCAT(", ", ?forName), ""), "\u001F"), "") AS ?forLine)
        }
        ORDER BY ?entry ?forName ?forEntry }
    }
    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:ProblemOrDiagnosis ; cascade:clinicalStatus "active" ; cascade:entryMember ?sourceRecord .
                  FILTER NOT EXISTS { ?entry cascade:verificationStatus "refuted" }
                  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:ProblemOrDiagnosis ; cascade:clinicalStatus "active" ;
         cascade:conditionName ?condition ; cascade:entryMember ?record .
  FILTER NOT EXISTS { ?entry cascade:verificationStatus "refuted" }
  OPTIONAL {
    ?entry cascade:conditionCode ?conditionCode .
    FILTER NOT EXISTS {
      ?entry cascade:conditionCode ?earlier .
      FILTER (STR(?earlier) < STR(?conditionCode))
    }
  }
  OPTIONAL { ?entry cascade:onsetDate ?onset }
  OPTIONAL { ?entry rdfs:label ?entryLabel }
  BIND (IF(?forIt = "", ?nothing, ?forIt) AS ?entriesForIt)
}
GROUP BY ?entry ?condition ?conditionCode ?onset ?entriesForIt ?entryLabel ?sources
ORDER BY ?condition ?entry

The terms it uses: cascade:ProblemOrDiagnosis, cascade:entryMember, cascade:reasonCondition, cascade:memberCurrentValues, cascade:drugName, cascade:procedureName, cascade:vaccineName, cascade:lifecycle, cascade:clinicalStatus, cascade:verificationStatus, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion, cascade:conditionName, cascade:conditionCode, cascade:onsetDate.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/My active conditions"

Or in GraphDB, open the saved query pod/My active conditions in the repository martin-okafor.

My active medications

2 rows

Read from the view alone, as an app would: each entry whose status is of the active lifecycle class (rule L1), so not one on hold, stopped, not taken or without a status, with its RxNorm code, when it started, the day its prescription was written, how many records it joins, each record's own status and the day it ended, the dosage text each record states with the day its prescription was written where it states one, in order of that day and the records stating none last (none when no record states one; a record that states a written day and no dosage text is not in it), the text each record's source wrote for it, such as a note beside the row (none when no record has one), what each record was given for: each condition it names, by the condition's entry and name, and each code of its reason, as "<record> for <entry>, <name>", "<record> for <code IRI>" and, for a code in a system the vocabulary lists none of, "<record> for <system IRI> <code>" (none when no record gives a reason, and no condition whose record is in no entry). Each item puts its IRIs first and its one free-text part last, so a reader takes its kind from the token after "for " up to the first space, never from the text: a pod IRI then "," is a condition entry (then its name, which may hold anything); otherwise a pod IRI alone is a condition entry with no name, an IRI that is not the pod's alone is a code in a listed system, and an IRI followed by a space and more text is a system IRI and its code (as written, which may hold spaces and commas). Items are in code point order of the name or code (a condition with no name first), then the entry or system, then the record, and each record with the document it was derived from, when that was retrieved, and the hospitals that wrote it and that keep it. An entry whose status was taken from a record that stopped it is not listed, even when another record says it is active: that record's status is in `pod/My medication history`. The code is RxNorm's IRI, or https://ns.cascadeprotocol.org/codes/rxnorm/ followed by the code as written, percent-encoded as ENCODE_FOR_URI does (rule M4c). It is the chosen RxNorm code, as the rule that joins medications by a shared code reads it: the code the source selected, when that is an RxNorm code; else the entry's one RxNorm code, even when the source selected an NDC; none when it states several and the source chose none. A pod holds no table, so it cannot tell a product from an ingredient among several, and no code stands in for the choice. A list holds its values in order, separated by U+001F, which no value holds; a value's own parts are ended by ", ".

?medication?code?started?written?statuses?dosages?narrativeTexts?reasons?records?entry?sources
Amlodipine 5 mg tabletRxNorm 1973612023-02-20urn:uuid:de97072d-47b6-81ac-8f7b-f2cc1be1a77b activeurn:uuid:de97072d-47b6-81ac-8f7b-f2cc1be1a77b Take 1 tablet by mouth once daily., written 2023-02-201Medication entry · Amlodipine 5 mg tablet · 2023-02-20urn:uuid:de97072d-47b6-81ac-8f7b-f2cc1be1a77b from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital
Atorvastatin 10 mg tabletRxNorm 6173122024-01-09urn:uuid:0bff1fbe-3434-826d-bbf4-aace24c066dc activeurn:uuid:0bff1fbe-3434-826d-bbf4-aace24c066dc Take 1 tablet by mouth at bedtime., written 2024-01-091Medication entry · Atorvastatin 10 mg tablet · 2024-01-09urn:uuid:0bff1fbe-3434-826d-bbf4-aace24c066dc from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital

2 rows

The query: queries/questions/pod/My active medications.rq on GitHub
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 ?medication ?code ?started ?written ?statuses ?dosages ?narrativeTexts ?reasons (COUNT(?record) AS ?records) ?entry
       ?entryLabel ?sources
WHERE {
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT CONCAT(?statusText, "\u001F"); separator=""), "\u001F$", "") AS ?statuses)
    WHERE {
      { SELECT ?entry ?statusText
        WHERE {
          ?entry a cascade:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive ;
                 cascade:memberCurrentValues ?values .
          ?values cascade:valuesOfMember ?member .
          OPTIONAL { ?values cascade:workflowStatus ?memberStatus }
          OPTIONAL { ?values cascade:medicationUseEndDate ?memberEnded }
          BIND (CONCAT(STR(?member), " ", COALESCE(?memberStatus, "with no status"),
                       COALESCE(CONCAT(", ended ", STR(?memberEnded)), "")) AS ?statusText)
        }
        ORDER BY ?entry ?statusText }
    }
    GROUP BY ?entry }
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT ?dosageText; separator=""), "\u001F$", "") AS ?stated)
    WHERE {
      { SELECT ?entry ?dosageText
        WHERE {
          ?entry a cascade:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive ;
                 cascade:memberCurrentValues ?values .
          ?values cascade:valuesOfMember ?member .
          OPTIONAL { ?values cascade:dosageInstructionText ?memberDosage }
          OPTIONAL { ?values cascade:prescriptionWrittenDate ?memberWritten }
          BIND (IF(BOUND(?memberDosage),
                   CONCAT(STR(?member), " ", ?memberDosage, COALESCE(CONCAT(", written ", STR(?memberWritten)), ""), "\u001F"), "") AS ?dosageText)
          BIND (COALESCE(STR(?memberWritten), "~") AS ?writtenKey)
        }
        ORDER BY ?entry ?writtenKey ?dosageText }
    }
    GROUP BY ?entry }
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT ?narrativeLine; separator=""), "\u001F$", "") AS ?said)
    WHERE {
      { SELECT ?entry ?narrativeLine
        WHERE {
          ?entry a cascade:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive ;
                 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 ?reasonLine; separator=""), "\u001F$", "") AS ?given)
    WHERE {
      { SELECT ?entry ?reasonLine
        WHERE {
          { ?entry a cascade:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive .
            BIND ("" AS ?reasonLine) }
          UNION
          { ?entry a cascade:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive ;
                   cascade:memberCurrentValues ?values .
            ?values cascade:valuesOfMember ?member ; cascade:reasonCondition ?conditionRecord .
            ?conditionEntry cascade:entryMember ?conditionRecord .
            OPTIONAL { ?conditionEntry cascade:conditionName ?conditionName }
            BIND (CONCAT(STR(?member), " for ", STR(?conditionEntry), COALESCE(CONCAT(", ", ?conditionName), ""), "\u001F") AS ?reasonLine)
            BIND (COALESCE(?conditionName, "") AS ?reasonKey)
            BIND (STR(?conditionEntry) AS ?reasonTail) }
          UNION
          { ?entry a cascade:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive ;
                   cascade:memberCurrentValues ?values .
            ?values cascade:valuesOfMember ?member ; cascade:reasonCode ?reasonCode .
            BIND (CONCAT(STR(?member), " for ", STR(?reasonCode), "\u001F") AS ?reasonLine)
            BIND (STR(?reasonCode) AS ?reasonKey)
            BIND ("" AS ?reasonTail) }
          UNION
          { ?entry a cascade:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive ;
                   cascade:memberCurrentValues ?values .
            ?values cascade:valuesOfMember ?member ; cascade:reasonCodeInOtherSystem ?otherCode .
            BIND (CONCAT(STR(?member), " for ", STR(DATATYPE(?otherCode)), " ", STR(?otherCode), "\u001F") AS ?reasonLine)
            BIND (STR(?otherCode) AS ?reasonKey)
            BIND (STR(DATATYPE(?otherCode)) AS ?reasonTail) }
        }
        ORDER BY ?entry ?reasonKey ?reasonTail ?member }
    }
    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:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive ;
                         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 }
  {
    SELECT ?entry (COUNT(DISTINCT ?candidate) AS ?candidates) (SAMPLE(?candidate) AS ?only)
    WHERE {
      ?entry a cascade:PrescribedOrReportedMedication .
      OPTIONAL {
        ?entry cascade:rxNormCode ?written .
        BIND (IF(isIRI(?written), ?written, IRI(CONCAT("https://ns.cascadeprotocol.org/codes/rxnorm/", ENCODE_FOR_URI(STR(?written))))) AS ?candidate)
      }
    }
    GROUP BY ?entry
  }
  ?entry a cascade:PrescribedOrReportedMedication ; cascade:lifecycle cascade:MedicationActive ;
         cascade:drugName ?medication ; cascade:entryMember ?record .
  OPTIONAL { ?entry cascade:userSelectedCode ?chosen }
  OPTIONAL { ?entry cascade:medicationUseStartDate ?started }
  OPTIONAL { ?entry cascade:prescriptionWrittenDate ?written }
  OPTIONAL { ?entry rdfs:label ?entryLabel }
  BIND (IF(?stated = "", ?nothing, ?stated) AS ?dosages)
  BIND (IF(?said = "", ?nothing, ?said) AS ?narrativeTexts)
  BIND (IF(?given = "", ?nothing, ?given) AS ?reasons)
  BIND (COALESCE(IF(STRSTARTS(STR(?chosen), "https://ns.cascadeprotocol.org/codes/rxnorm/"), ?chosen, ?nothing),
                 IF(?candidates = 1, ?only, ?nothing)) AS ?code)
}
GROUP BY ?entry ?medication ?code ?started ?written ?entryLabel ?statuses ?dosages ?narrativeTexts ?reasons ?sources
ORDER BY ?medication ?entry

The terms it uses: cascade:PrescribedOrReportedMedication, cascade:lifecycle, cascade:memberCurrentValues, cascade:valuesOfMember, cascade:workflowStatus, cascade:medicationUseEndDate, cascade:dosageInstructionText, cascade:prescriptionWrittenDate, cascade:narrativeText, cascade:reasonCondition, cascade:entryMember, cascade:conditionName, cascade:reasonCode, cascade:reasonCodeInOtherSystem, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion, cascade:rxNormCode, cascade:drugName, cascade:userSelectedCode, cascade:medicationUseStartDate.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/My active medications"

Or in GraphDB, open the saved query pod/My active medications in the repository martin-okafor.

My condition history

2 rows

Read from the view alone, as an app would: each condition entry whatever its status, with its codes, its status, when it started and when it ended, each record's own status, each entry given for it as `pod/My active conditions` lists them ("<entry>, <name>", the entry IRI alone when it has no name, in code point order of name, then entry, and with a medication entered in error left out), how many records it joins, and each record with the document it was derived from, when that was retrieved, and the hospitals that wrote it and that keep it. The status is "ruled out" when the record the entry took its status from is refuted, whatever its clinical status, so a condition that was considered and refuted is never read as one that resolved; otherwise it is that record's clinical status, or none when it states none, and an entry ruled out has no abatement day. The verification status is as the source writes it. The entries whose status is active and not ruled out are the ones `pod/My active conditions` lists. A record's own status is its clinical status, "ruled out" alone when it is refuted; the day it abated follows a clinical status, never "ruled out". A list holds its values in order, separated by U+001F; a value's own parts are ended by ", ". Its code is the code IRI the entry states, in whichever listed system, the first in code point order when it states several, so that each entry is one row.

?condition?conditionCode?status?verificationStatus?onset?abated?statuses?entriesForIt?records?entry?sources
Essential hypertensionSNOMED CT 38341003active2019-05-14urn:uuid:86263524-631f-80dc-b742-80ff2d9597d5 active1Condition entry · Essential hypertension · 2019-05-14urn:uuid:86263524-631f-80dc-b742-80ff2d9597d5 from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital
HyperlipidemiaSNOMED CT 55822004active2021-09-30urn:uuid:07bd7acd-f2b7-8d0c-846f-7fda112a3213 active1Condition entry · Hyperlipidemia · 2021-09-30urn:uuid:07bd7acd-f2b7-8d0c-846f-7fda112a3213 from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital

2 rows

The query: queries/questions/pod/My condition history.rq on GitHub
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 ?condition ?conditionCode ?status ?verificationStatus ?onset ?abated ?statuses ?entriesForIt
       (COUNT(?record) AS ?records) ?entry ?entryLabel ?sources
WHERE {
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT ?forLine; separator=""), "\u001F$", "") AS ?forIt)
    WHERE {
      { SELECT ?entry ?forLine
        WHERE {
          ?entry a cascade:ProblemOrDiagnosis ; cascade:entryMember ?conditionRecord .
          OPTIONAL { ?forValues cascade:reasonCondition ?conditionRecord .
                     ?forEntry cascade:memberCurrentValues ?forValues .
                     OPTIONAL { ?forEntry cascade:drugName ?drugName }
                     OPTIONAL { ?forEntry cascade:procedureName ?procedureName }
                     OPTIONAL { ?forEntry cascade:vaccineName ?vaccineName }
                     FILTER NOT EXISTS { ?forEntry cascade:lifecycle cascade:MedicationEnteredInError } }
          BIND (COALESCE(?drugName, ?procedureName, ?vaccineName) AS ?forName)
          BIND (IF(BOUND(?forEntry), CONCAT(STR(?forEntry), COALESCE(CONCAT(", ", ?forName), ""), "\u001F"), "") AS ?forLine)
        }
        ORDER BY ?entry ?forName ?forEntry }
    }
    GROUP BY ?entry }
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT CONCAT(?statusText, "\u001F"); separator=""), "\u001F$", "") AS ?statuses)
    WHERE {
      { SELECT ?entry ?statusText
        WHERE {
          ?entry a cascade:ProblemOrDiagnosis ; cascade:memberCurrentValues ?values .
          ?values cascade:valuesOfMember ?member .
          OPTIONAL { ?values cascade:clinicalStatus ?memberClinicalStatus }
          OPTIONAL { ?values cascade:verificationStatus ?memberVerificationStatus }
          OPTIONAL { ?values cascade:abatementDate ?memberAbated }
          BIND (BOUND(?memberVerificationStatus) && ?memberVerificationStatus = "refuted" AS ?memberRuledOut)
          BIND (CONCAT(STR(?member), " ",
                       IF(?memberRuledOut, "ruled out", COALESCE(?memberClinicalStatus, "with no status")),
                       IF(?memberRuledOut, "", COALESCE(CONCAT(", abated ", STR(?memberAbated)), ""))) AS ?statusText)
        }
        ORDER BY ?entry ?statusText }
    }
    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:ProblemOrDiagnosis ; 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:ProblemOrDiagnosis ; cascade:conditionName ?condition ; cascade:entryMember ?record .
  OPTIONAL { ?entry cascade:clinicalStatus ?clinicalStatus }
  OPTIONAL { ?entry cascade:verificationStatus ?verificationStatus }
  OPTIONAL {
    ?entry cascade:conditionCode ?conditionCode .
    FILTER NOT EXISTS {
      ?entry cascade:conditionCode ?earlier .
      FILTER (STR(?earlier) < STR(?conditionCode))
    }
  }
  OPTIONAL { ?entry cascade:onsetDate ?onset }
  OPTIONAL { ?entry cascade:abatementDate ?abated
             FILTER NOT EXISTS { ?entry cascade:verificationStatus "refuted" } }
  OPTIONAL { ?entry rdfs:label ?entryLabel }
  BIND (IF(BOUND(?verificationStatus) && ?verificationStatus = "refuted", "ruled out", ?clinicalStatus) AS ?status)
  BIND (IF(?forIt = "", ?nothing, ?forIt) AS ?entriesForIt)
}
GROUP BY ?entry ?condition ?conditionCode ?status ?verificationStatus ?onset ?abated ?entryLabel ?statuses ?entriesForIt ?sources
ORDER BY ?condition ?entry

The terms it uses: cascade:ProblemOrDiagnosis, cascade:entryMember, cascade:reasonCondition, cascade:memberCurrentValues, cascade:drugName, cascade:procedureName, cascade:vaccineName, cascade:lifecycle, cascade:valuesOfMember, cascade:clinicalStatus, cascade:verificationStatus, cascade:abatementDate, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion, cascade:conditionName, cascade:conditionCode, cascade:onsetDate.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/My condition history"

Or in GraphDB, open the saved query pod/My condition history in the repository martin-okafor.

My genetic variants

7 rows

Read from the view alone, as an app would: one row for each variant entry and each code it states, the codes a page looks a variant up by. ?variant is the entry's IRI, as the other pod questions give theirs; ?gene, ?hgvs and ?variation are the literals as the entry states them, an HGVS expression or a ClinVar VariationID on a row of its own. An entry that states no code has one row without either. The page turns a literal into its code system's IRI (rule M4c). Each row names each record the entry 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 ", ".

?variant?gene?hgvs?variation?sources
clinical/variants.ttl#09620feeb84e00cd438e6ac975c1dad00463f7cfa4cfa48654d045d5af3b7081MLH1NM_001258271.2:c.1111A>Turn:uuid:f737af56-cb3c-831a-9339-6b618f429b98 from ni:///sha-256;PoyKMPHUii6EQ-Cw9qXaHOcPhzm4bHQINk8uzzZKGt4, retrieved 2026-10-13T09:10:00Z, written by Harbourline Genetics
clinical/variants.ttl#1b1e91c6629bc211630eeb05fa6eb34c526f9e2e033d9010ec43ab76a6523844MSH68931urn:uuid:072bc795-3e58-8761-9c95-fda460ca7b1b from ni:///sha-256;PoyKMPHUii6EQ-Cw9qXaHOcPhzm4bHQINk8uzzZKGt4, retrieved 2026-10-13T09:10:00Z, written by Harbourline Geneticsurn:uuid:fc1d7f00-c8a8-8992-af16-5f59353f232a from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital
clinical/variants.ttl#1b1e91c6629bc211630eeb05fa6eb34c526f9e2e033d9010ec43ab76a6523844MSH6NM_000179.3:c.2633T>Curn:uuid:072bc795-3e58-8761-9c95-fda460ca7b1b from ni:///sha-256;PoyKMPHUii6EQ-Cw9qXaHOcPhzm4bHQINk8uzzZKGt4, retrieved 2026-10-13T09:10:00Z, written by Harbourline Geneticsurn:uuid:fc1d7f00-c8a8-8992-af16-5f59353f232a from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital
clinical/variants.ttl#5ce4cc59328ecac5827bd418008ac986b1b1082aaba54439503deed40d45cca3BRCA2NM_000059.4:c.7865A>Gurn:uuid:96b382c9-a0bc-82ff-a931-ffbee8395738 from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital
clinical/variants.ttl#bbebdd5d881707aab4c978f0c6b4b155fca44357325fbe6b5a83661f6885a149MLH190011urn:uuid:c75afec8-08d6-8438-893f-da794ec0a1ca from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospitalurn:uuid:f15c3e70-dda1-8b63-bf74-cdeeba5ffe3b from ni:///sha-256;PoyKMPHUii6EQ-Cw9qXaHOcPhzm4bHQINk8uzzZKGt4, retrieved 2026-10-13T09:10:00Z, written by Harbourline Genetics
clinical/variants.ttl#bbebdd5d881707aab4c978f0c6b4b155fca44357325fbe6b5a83661f6885a149MLH1NM_000249.3:c.2042C>Turn:uuid:c75afec8-08d6-8438-893f-da794ec0a1ca from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospitalurn:uuid:f15c3e70-dda1-8b63-bf74-cdeeba5ffe3b from ni:///sha-256;PoyKMPHUii6EQ-Cw9qXaHOcPhzm4bHQINk8uzzZKGt4, retrieved 2026-10-13T09:10:00Z, written by Harbourline Genetics
clinical/variants.ttl#bbebdd5d881707aab4c978f0c6b4b155fca44357325fbe6b5a83661f6885a149MLH1NM_000249.4:c.2042C>Turn:uuid:c75afec8-08d6-8438-893f-da794ec0a1ca from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospitalurn:uuid:f15c3e70-dda1-8b63-bf74-cdeeba5ffe3b from ni:///sha-256;PoyKMPHUii6EQ-Cw9qXaHOcPhzm4bHQINk8uzzZKGt4, retrieved 2026-10-13T09:10:00Z, written by Harbourline Genetics

7 rows

The query: queries/questions/pod/My genetic variants.rq on GitHub
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 DISTINCT ?variant ?gene ?hgvs ?variation ?sources
WHERE {
  { SELECT ?variant ?gene ?hgvs ?variation
    WHERE {
      { ?variant a cascade:GeneticVariantFinding ; cascade:entryMember [] ; cascade:hgvsCodingDnaExpression ?hgvs .
        OPTIONAL { ?variant cascade:geneSymbol ?gene } }
      UNION
      { ?variant a cascade:GeneticVariantFinding ; cascade:entryMember [] ; cascade:clinvarVariationId ?variation .
        OPTIONAL { ?variant cascade:geneSymbol ?gene } }
      UNION
      { ?variant a cascade:GeneticVariantFinding ; cascade:entryMember [] .
        OPTIONAL { ?variant cascade:geneSymbol ?gene }
        FILTER NOT EXISTS { ?variant cascade:hgvsCodingDnaExpression [] }
        FILTER NOT EXISTS { ?variant cascade:clinvarVariationId [] } }
    } }
  { SELECT ?variant (REPLACE(GROUP_CONCAT(DISTINCT CONCAT(?sourceText, "\u001F"); separator=""), "\u001F$", "") AS ?sources)
    WHERE {
      { SELECT ?variant ?sourceText
        WHERE {
          { SELECT ?variant ?sourceRecord ?document ?retrievedOn
                   (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?hospital, ", "), ""); separator=""), ", $", "") AS ?hospitals)
            WHERE {
              { SELECT ?variant ?sourceRecord ?document ?retrievedOn ?hospital
                WHERE {
                  ?variant a cascade:GeneticVariantFinding ; 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 ?variant ?sourceRecord ?document ?hospital }
            }
            GROUP BY ?variant ?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 ?variant ?sourceText }
    }
    GROUP BY ?variant }
}
ORDER BY ?variant ?hgvs ?variation

The terms it uses: cascade:GeneticVariantFinding, cascade:entryMember, cascade:hgvsCodingDnaExpression, cascade:geneSymbol, cascade:clinvarVariationId, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/My genetic variants"

Or in GraphDB, open the saved query pod/My genetic variants in the repository martin-okafor.

My immunizations: none. The question

My lab results: none. The question

My medication history

2 rows

Read from the view alone, as an app would: each medication entry whatever its status, with its RxNorm code, its status, the lifecycle class of that status (rule L1), when it started, the day its prescription was written, when it ended, each record's own status and the day it ended, so a stop one record states is shown beside another's "active" whichever the entry took, the dosage text each record states with the day its prescription was written where it states one, in order of that day and the records stating none last, so a dose changed reads in the order it was written (none when no record states one; a record that states a written day and no dosage text is not in it), the text each record's source wrote for it, such as a stop reason (none when no record has one), what each record was given for, as `pod/My active medications` gives it: "<record> for <entry>, <name>" for a condition (an entry with no name gives "<record> for <entry>"), "<record> for <code IRI>" for a code in a listed system and "<record> for <system IRI> <code>" for a code in another system, each read from the token after "for " up to the first space, never from the text: a pod IRI then "," is a condition entry; otherwise a pod IRI alone is a condition entry with no name, an IRI that is not the pod's alone is a code in a listed system, and an IRI followed by a space and more text is a system IRI and its code, in code point order of the name or code, then the entry or system, then the record (none when no record gives a reason), how many records it joins, and each record with the document it was derived from, when that was retrieved, and the hospitals that wrote it and that keep it. A source that states no stop gives no end date: none is inferred from a medication's last appearance. The code is the one `pod/My active medications` gives, and the entries whose lifecycle is cascade:MedicationActive are the ones it lists. A list holds its values in order, separated by U+001F, which no value holds; a value's own parts are ended by ", ".

?medication?code?status?lifecycle?started?written?ended?statuses?dosages?narrativeTexts?reasons?records?entry?sources
Amlodipine 5 mg tabletRxNorm 197361activecascade:MedicationActive2023-02-20urn:uuid:de97072d-47b6-81ac-8f7b-f2cc1be1a77b activeurn:uuid:de97072d-47b6-81ac-8f7b-f2cc1be1a77b Take 1 tablet by mouth once daily., written 2023-02-201Medication entry · Amlodipine 5 mg tablet · 2023-02-20urn:uuid:de97072d-47b6-81ac-8f7b-f2cc1be1a77b from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital
Atorvastatin 10 mg tabletRxNorm 617312activecascade:MedicationActive2024-01-09urn:uuid:0bff1fbe-3434-826d-bbf4-aace24c066dc activeurn:uuid:0bff1fbe-3434-826d-bbf4-aace24c066dc Take 1 tablet by mouth at bedtime., written 2024-01-091Medication entry · Atorvastatin 10 mg tablet · 2024-01-09urn:uuid:0bff1fbe-3434-826d-bbf4-aace24c066dc from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital

2 rows

The query: queries/questions/pod/My medication history.rq on GitHub
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 ?medication ?code ?status ?lifecycle ?started ?written ?ended ?statuses ?dosages ?narrativeTexts ?reasons
       (COUNT(?record) AS ?records) ?entry ?entryLabel ?sources
WHERE {
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT CONCAT(?statusText, "\u001F"); separator=""), "\u001F$", "") AS ?statuses)
    WHERE {
      { SELECT ?entry ?statusText
        WHERE {
          ?entry a cascade:PrescribedOrReportedMedication ; cascade:memberCurrentValues ?values .
          ?values cascade:valuesOfMember ?member .
          OPTIONAL { ?values cascade:workflowStatus ?memberStatus }
          OPTIONAL { ?values cascade:medicationUseEndDate ?memberEnded }
          BIND (CONCAT(STR(?member), " ", COALESCE(?memberStatus, "with no status"),
                       COALESCE(CONCAT(", ended ", STR(?memberEnded)), "")) AS ?statusText)
        }
        ORDER BY ?entry ?statusText }
    }
    GROUP BY ?entry }
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT ?dosageText; separator=""), "\u001F$", "") AS ?stated)
    WHERE {
      { SELECT ?entry ?dosageText
        WHERE {
          ?entry a cascade:PrescribedOrReportedMedication ; cascade:memberCurrentValues ?values .
          ?values cascade:valuesOfMember ?member .
          OPTIONAL { ?values cascade:dosageInstructionText ?memberDosage }
          OPTIONAL { ?values cascade:prescriptionWrittenDate ?memberWritten }
          BIND (IF(BOUND(?memberDosage),
                   CONCAT(STR(?member), " ", ?memberDosage, COALESCE(CONCAT(", written ", STR(?memberWritten)), ""), "\u001F"), "") AS ?dosageText)
          BIND (COALESCE(STR(?memberWritten), "~") AS ?writtenKey)
        }
        ORDER BY ?entry ?writtenKey ?dosageText }
    }
    GROUP BY ?entry }
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT ?narrativeLine; separator=""), "\u001F$", "") AS ?said)
    WHERE {
      { SELECT ?entry ?narrativeLine
        WHERE {
          ?entry a cascade:PrescribedOrReportedMedication ; 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 ?reasonLine; separator=""), "\u001F$", "") AS ?given)
    WHERE {
      { SELECT ?entry ?reasonLine
        WHERE {
          { ?entry a cascade:PrescribedOrReportedMedication .
            BIND ("" AS ?reasonLine) }
          UNION
          { ?entry a cascade:PrescribedOrReportedMedication ; cascade:memberCurrentValues ?values .
            ?values cascade:valuesOfMember ?member ; cascade:reasonCondition ?conditionRecord .
            ?conditionEntry cascade:entryMember ?conditionRecord .
            OPTIONAL { ?conditionEntry cascade:conditionName ?conditionName }
            BIND (CONCAT(STR(?member), " for ", STR(?conditionEntry), COALESCE(CONCAT(", ", ?conditionName), ""), "\u001F") AS ?reasonLine)
            BIND (COALESCE(?conditionName, "") AS ?reasonKey)
            BIND (STR(?conditionEntry) AS ?reasonTail) }
          UNION
          { ?entry a cascade:PrescribedOrReportedMedication ; cascade:memberCurrentValues ?values .
            ?values cascade:valuesOfMember ?member ; cascade:reasonCode ?reasonCode .
            BIND (CONCAT(STR(?member), " for ", STR(?reasonCode), "\u001F") AS ?reasonLine)
            BIND (STR(?reasonCode) AS ?reasonKey)
            BIND ("" AS ?reasonTail) }
          UNION
          { ?entry a cascade:PrescribedOrReportedMedication ; cascade:memberCurrentValues ?values .
            ?values cascade:valuesOfMember ?member ; cascade:reasonCodeInOtherSystem ?otherCode .
            BIND (CONCAT(STR(?member), " for ", STR(DATATYPE(?otherCode)), " ", STR(?otherCode), "\u001F") AS ?reasonLine)
            BIND (STR(?otherCode) AS ?reasonKey)
            BIND (STR(DATATYPE(?otherCode)) AS ?reasonTail) }
        }
        ORDER BY ?entry ?reasonKey ?reasonTail ?member }
    }
    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:PrescribedOrReportedMedication ; 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 }
  {
    SELECT ?entry (COUNT(DISTINCT ?candidate) AS ?candidates) (SAMPLE(?candidate) AS ?only)
    WHERE {
      ?entry a cascade:PrescribedOrReportedMedication .
      OPTIONAL {
        ?entry cascade:rxNormCode ?written .
        BIND (IF(isIRI(?written), ?written, IRI(CONCAT("https://ns.cascadeprotocol.org/codes/rxnorm/", ENCODE_FOR_URI(STR(?written))))) AS ?candidate)
      }
    }
    GROUP BY ?entry
  }
  ?entry a cascade:PrescribedOrReportedMedication ; cascade:drugName ?medication ; cascade:entryMember ?record .
  OPTIONAL { ?entry cascade:userSelectedCode ?chosen }
  OPTIONAL { ?entry cascade:workflowStatus ?status }
  OPTIONAL { ?entry cascade:lifecycle ?lifecycle }
  OPTIONAL { ?entry cascade:medicationUseStartDate ?started }
  OPTIONAL { ?entry cascade:prescriptionWrittenDate ?written }
  OPTIONAL { ?entry cascade:medicationUseEndDate ?ended }
  OPTIONAL { ?entry rdfs:label ?entryLabel }
  BIND (IF(?stated = "", ?nothing, ?stated) AS ?dosages)
  BIND (IF(?said = "", ?nothing, ?said) AS ?narrativeTexts)
  BIND (IF(?given = "", ?nothing, ?given) AS ?reasons)
  BIND (COALESCE(IF(STRSTARTS(STR(?chosen), "https://ns.cascadeprotocol.org/codes/rxnorm/"), ?chosen, ?nothing),
                 IF(?candidates = 1, ?only, ?nothing)) AS ?code)
}
GROUP BY ?entry ?medication ?code ?status ?lifecycle ?started ?written ?ended ?statuses ?dosages ?narrativeTexts ?reasons ?entryLabel ?sources
ORDER BY ?medication ?entry

The terms it uses: cascade:PrescribedOrReportedMedication, cascade:memberCurrentValues, cascade:valuesOfMember, cascade:workflowStatus, cascade:medicationUseEndDate, cascade:dosageInstructionText, cascade:prescriptionWrittenDate, cascade:narrativeText, cascade:reasonCondition, cascade:entryMember, cascade:conditionName, cascade:reasonCode, cascade:reasonCodeInOtherSystem, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion, cascade:rxNormCode, cascade:drugName, cascade:userSelectedCode, cascade:lifecycle, cascade:medicationUseStartDate.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/My medication history"

Or in GraphDB, open the saved query pod/My medication history in the repository martin-okafor.

My procedures

1 row

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.

?performed?procedure?procedureCode?status?narrativeTexts?records?entry?sources
2023-11-08ColonoscopySNOMED CT 73761001completed1Procedure entry · Colonoscopy · 2023-11-08urn:uuid:d1e47110-6ce4-8815-9d7f-6d9703d9af4c from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital

1 row

The query: queries/questions/pod/My procedures.rq on GitHub
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

The terms it uses: cascade:MedicalProcedure, cascade:memberCurrentValues, cascade:valuesOfMember, cascade:narrativeText, cascade:entryMember, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion, cascade:procedureDate, cascade:procedureName, cascade:procedureCode, cascade:workflowStatus.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/My procedures"

Or in GraphDB, open the saved query pod/My procedures in the repository martin-okafor.

My reports, notes and documents

2 rows

Read from the views as an app would, so a model reads what a report or a note says in its first answer: one row for each report and each note or document entry, newest first, never more, so its text is given once. Each row holds the entry's kind, date, time issued, name, title, status, content status, conclusion and text; every code it states, an IRI or, in another system, the code and its system; each attachment its records' current versions hold, by media type and title, a file the pod keeps but does not read, so a report sent only as a PDF says so; each result a report names, by its entry in the lab results view, with its test, value, unit, reference range and the interpretation flags its source gave it; and each record the entry joins, with the document it was derived from, when that was retrieved, and the hospitals that wrote it and that keep it. A list holds its values in order, separated by U+001F, and a list with nothing in it is unbound; a value's own parts are ended by ", ". A day and a time are not comparable, so entries are ordered by their day first, then by the time as written; an entry with no date by the time it was issued.

?date?issued?kind?codes?name?title?status?contentStatus?conclusion?text?attachments?results?entry?sources
2024-03-21 14:20 UTCReporthttp://loinc.org/rdf/51969-4Genetic analysis reportfinalhttps://pod.martin-okafor.example/clinical/variant-interpretations.ttl#28386292eb56f4e769886c24837f4e03ea8b41d469fb2cecb4780b4178aefbb9https://pod.martin-okafor.example/clinical/variant-interpretations.ttl#5753df19a9240fbc5e885de9151807d10801b4ee51ce20e7b7abb03c47f5f5dbhttps://pod.martin-okafor.example/clinical/variant-interpretations.ttl#8fe38281afeef276c481d0fe266b6eb00345bfa4930b5a8c291eaa987c8cb37chttps://pod.martin-okafor.example/clinical/variants.ttl#1b1e91c6629bc211630eeb05fa6eb34c526f9e2e033d9010ec43ab76a6523844https://pod.martin-okafor.example/clinical/variants.ttl#5ce4cc59328ecac5827bd418008ac986b1b1082aaba54439503deed40d45cca3https://pod.martin-okafor.example/clinical/variants.ttl#bbebdd5d881707aab4c978f0c6b4b155fca44357325fbe6b5a83661f6885a149Report entry · Genetic analysis reporturn:uuid:47fbf4ba-a0bb-8cfb-85ea-d76b6ee4e815 from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospital
2022-06-14 17:15 UTCReporthttp://loinc.org/rdf/51969-4Genetic analysis reportfinalhttps://pod.martin-okafor.example/clinical/variant-interpretations.ttl#42508478e9537bbf506c9dc1a4800ae8346b1a979d773cd18810805f966a7d24https://pod.martin-okafor.example/clinical/variant-interpretations.ttl#8709375c4737a3d474ea72fab8ddffbeddbc4c4d19abf6e526eb6817c4b7a161https://pod.martin-okafor.example/clinical/variant-interpretations.ttl#a2329a370322ff79b74805e2053558ccaea4c9de684923c7627ce26690b3ba69https://pod.martin-okafor.example/clinical/variants.ttl#09620feeb84e00cd438e6ac975c1dad00463f7cfa4cfa48654d045d5af3b7081https://pod.martin-okafor.example/clinical/variants.ttl#1b1e91c6629bc211630eeb05fa6eb34c526f9e2e033d9010ec43ab76a6523844https://pod.martin-okafor.example/clinical/variants.ttl#bbebdd5d881707aab4c978f0c6b4b155fca44357325fbe6b5a83661f6885a149Report entry · Genetic analysis reporturn:uuid:71cc8310-b341-84b1-bd87-ab95c1e23f1f from ni:///sha-256;PoyKMPHUii6EQ-Cw9qXaHOcPhzm4bHQINk8uzzZKGt4, retrieved 2026-10-13T09:10:00Z, written by Harbourline Genetics

2 rows

The query: queries/questions/pod/My reports, notes and documents.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
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 ?date ?issued ?kind ?codes ?name ?title ?status ?contentStatus ?conclusion ?text ?attachments ?results ?entry
       ?entryLabel ?sources
WHERE {
  { SELECT ?entry ?entryLabel ?kind ?date ?issued ?name ?title ?status ?contentStatus ?conclusion ?text
           (REPLACE(CONCAT(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(STR(?reportCode), "\u001F"), ""); separator=""),
                           GROUP_CONCAT(DISTINCT COALESCE(CONCAT(STR(?reportOther), " in ", STR(DATATYPE(?reportOther)), "\u001F"), ""); separator=""),
                           GROUP_CONCAT(DISTINCT COALESCE(CONCAT(STR(?noteType), "\u001F"), ""); separator=""),
                           GROUP_CONCAT(DISTINCT COALESCE(CONCAT(STR(?noteOther), " in ", STR(DATATYPE(?noteOther)), "\u001F"), ""); separator="")),
                    "\u001F$", "") AS ?allCodes)
           (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?attachment, "\u001F"), ""); separator=""), "\u001F$", "") AS ?allAttachments)
    WHERE {
      { SELECT ?entry ?entryLabel ?kind ?date ?issued ?name ?title ?status ?contentStatus ?conclusion ?text ?reportCode ?reportOther
               ?noteType ?noteOther ?attachment
        WHERE {
          VALUES ?type { cascade:DiagnosticReport cascade:ClinicalNoteOrDocument }
          ?entry a ?type ; cascade:leadMember ?lead .
          ?lead cascade:recordKind ?kind .
          OPTIONAL { ?entry rdfs:label ?entryLabel }
          OPTIONAL { ?entry cascade:reportEffectiveTime ?reportDate }
          OPTIONAL { ?entry cascade:noteOrDocumentDate ?noteDate }
          BIND (COALESCE(?reportDate, ?noteDate) AS ?date)
          OPTIONAL { ?entry cascade:reportIssuedTime ?issued }
          OPTIONAL { ?entry cascade:reportName ?reportName }
          OPTIONAL { ?entry cascade:noteOrDocumentTypeName ?noteName }
          BIND (COALESCE(?reportName, ?noteName) AS ?name)
          OPTIONAL { ?entry cascade:noteOrDocumentTitle ?title }
          OPTIONAL { ?entry cascade:workflowStatus ?status }
          OPTIONAL { ?entry cascade:noteOrDocumentContentStatus ?contentStatus }
          OPTIONAL { ?entry cascade:reportConclusion ?conclusion }
          OPTIONAL { ?entry cascade:narrativeText ?text }
          OPTIONAL { ?entry cascade:reportCode ?reportCode }
          OPTIONAL { ?entry cascade:reportCodeInOtherSystem ?reportOther }
          OPTIONAL { ?entry cascade:noteOrDocumentTypeCode ?noteType }
          OPTIONAL { ?entry cascade:noteOrDocumentTypeCodeInOtherSystem ?noteOther }
          OPTIONAL { ?entry cascade:entryMember/pav:hasCurrentVersion/cascade:attachment ?attached .
                     ?attached cascade:attachmentContentType ?contentType .
                     OPTIONAL { ?attached cascade:attachmentTitle ?attachmentTitle }
                     BIND (CONCAT(?contentType, COALESCE(CONCAT(" ", ?attachmentTitle), "")) AS ?attachment) }
        }
        ORDER BY ?entry ?reportCode ?reportOther ?noteType ?noteOther ?attachment }
    }
    GROUP BY ?entry ?entryLabel ?kind ?date ?issued ?name ?title ?status ?contentStatus ?conclusion ?text }
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?resultText, "\u001F"), ""); separator=""), "\u001F$", "") AS ?allResults)
    WHERE {
      { SELECT ?entry ?resultText
        WHERE {
          { SELECT ?entry ?result ?test ?value ?unit ?range
                   (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?flag, ", "), ""); separator=""), ", $", "") AS ?flags)
            WHERE {
              { SELECT ?entry ?result ?test ?value ?unit ?range ?flag
                WHERE {
                  VALUES ?type { cascade:DiagnosticReport cascade:ClinicalNoteOrDocument }
                  ?entry a ?type .
                  OPTIONAL { ?entry obo:RO_0002351 ?result .
                             OPTIONAL { ?result cascade:testName ?test }
                             OPTIONAL { ?result cascade:resultValueText ?value }
                             OPTIONAL { ?result cascade:resultUnitText ?unit }
                             OPTIONAL { ?result cascade:referenceRangeText ?range }
                             OPTIONAL { ?result cascade:resultInterpretationCode ?interpretation }
                             BIND (REPLACE(STR(?interpretation), "^.*/", "") AS ?flag) }
                }
                ORDER BY ?entry ?result ?flag }
            }
            GROUP BY ?entry ?result ?test ?value ?unit ?range }
          BIND (CONCAT(STR(?result), COALESCE(CONCAT(" ", ?test), ""), COALESCE(CONCAT(" ", ?value), ""),
                       COALESCE(CONCAT(" ", ?unit), ""), COALESCE(CONCAT(", reference range ", ?range), ""),
                       IF(?flags = "", "", CONCAT(", flagged ", ?flags))) AS ?resultText)
        }
        ORDER BY ?entry ?resultText }
    }
    GROUP BY ?entry }
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT CONCAT(?sourceText, "\u001F"); separator=""), "\u001F$", "") AS ?allSources)
    WHERE {
      { SELECT ?entry ?sourceText
        WHERE {
          { SELECT ?entry ?record ?document ?retrievedOn
                   (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?hospital, ", "), ""); separator=""), ", $", "") AS ?hospitals)
            WHERE {
              { SELECT ?entry ?record ?document ?retrievedOn ?hospital
                WHERE {
                  VALUES ?type { cascade:DiagnosticReport cascade:ClinicalNoteOrDocument }
                  ?entry a ?type ; cascade:entryMember ?record .
                  OPTIONAL { ?record 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 ?record ?document ?hospital }
            }
            GROUP BY ?entry ?record ?document ?retrievedOn }
          BIND (CONCAT(STR(?record), COALESCE(CONCAT(" from ", STR(?document)), ""),
                       COALESCE(CONCAT(", retrieved ", STR(?retrievedOn)), ""),
                       IF(?hospitals = "", "", CONCAT(", ", ?hospitals))) AS ?sourceText)
        }
        ORDER BY ?entry ?sourceText }
    }
    GROUP BY ?entry }
  BIND (IF(?allCodes = "", 1/0, ?allCodes) AS ?codes)
  BIND (IF(?allAttachments = "", 1/0, ?allAttachments) AS ?attachments)
  BIND (IF(?allResults = "", 1/0, ?allResults) AS ?results)
  BIND (?allSources AS ?sources)
}
ORDER BY DESC(COALESCE(SUBSTR(STR(COALESCE(?date, ?issued)), 1, 10), "")) DESC(COALESCE(STR(COALESCE(?date, ?issued)), "")) ?entry

The terms it uses: cascade:DiagnosticReport, cascade:ClinicalNoteOrDocument, cascade:leadMember, cascade:recordKind, rdfs:label, cascade:reportEffectiveTime, cascade:noteOrDocumentDate, cascade:reportIssuedTime, cascade:reportName, cascade:noteOrDocumentTypeName, cascade:noteOrDocumentTitle, cascade:workflowStatus, cascade:noteOrDocumentContentStatus, cascade:reportConclusion, cascade:narrativeText, cascade:reportCode, cascade:reportCodeInOtherSystem, cascade:noteOrDocumentTypeCode, cascade:noteOrDocumentTypeCodeInOtherSystem, cascade:entryMember, cascade:attachmentContentType, cascade:attachmentTitle, obo:RO_0002351, cascade:testName, cascade:resultValueText, cascade:resultUnitText, cascade:referenceRangeText, cascade:resultInterpretationCode, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, pav:hasCurrentVersion.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/My reports, notes and documents"

Or in GraphDB, open the saved query pod/My reports, notes and documents in the repository martin-okafor.

The person this pod is about

1 row

Each hospital knows the person by a patient profile of its own, and About judgments tie those profiles to one subject, whom every record in a view is about. Read from the patient-profile view, as an app would: what each profile the view joins for the subject, a counting About tying it and no counting NotAbout outranking that, says of the person's date of birth, administrative gender, whether they have died and when, each value after the profile that states it, so sources that disagree are told apart and none is chosen; and each profile with the document it was derived from, when that was retrieved, and the hospitals that wrote it and that keep it. A list holds its values in order, separated by U+001F, and a list with nothing in it is unbound; a value's own parts are ended by ", ".

?subject?dateOfBirth?administrativeGender?deceased?dateOfDeath?sources
The person this pod is abouturn:uuid:62c7bb5a-1d8d-81b1-aed2-3770124e6ef2 1979-02-08urn:uuid:e92ce3a3-3394-8f1e-8aac-eaf036a95638 1979-02-08urn:uuid:62c7bb5a-1d8d-81b1-aed2-3770124e6ef2 from ni:///sha-256;i9B4_qkGGaaTYo6lwKMFmDhd8VSHXjzmmjTdEKbbyD0, retrieved 2026-10-13T09:20:00Z, written by St Columba's Hospitalurn:uuid:e92ce3a3-3394-8f1e-8aac-eaf036a95638 from ni:///sha-256;PoyKMPHUii6EQ-Cw9qXaHOcPhzm4bHQINk8uzzZKGt4, retrieved 2026-10-13T09:10:00Z, written by Harbourline Genetics

1 row

The query: queries/questions/pod/The person this pod is about.rq on GitHub
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 DISTINCT ?subject ?subjectLabel ?dateOfBirth ?administrativeGender ?deceased ?dateOfDeath ?sources
WHERE {
  { SELECT ?subject
           (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?birthText, "\u001F"), ""); separator=""), "\u001F$", "") AS ?births)
           (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?genderText, "\u001F"), ""); separator=""), "\u001F$", "") AS ?genders)
           (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?deceasedText, "\u001F"), ""); separator=""), "\u001F$", "") AS ?deaths)
           (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?deathDateText, "\u001F"), ""); separator=""), "\u001F$", "") AS ?deathDates)
    WHERE {
      { SELECT ?subject ?birthText ?genderText ?deceasedText ?deathDateText
        WHERE {
          ?subject a cascade:Subject .
          OPTIONAL {
            ?about cascade:countsUnderLens true ; cascade:verdict ?aboutVerdict ; prov:hadMember ?profile ;
                   cascade:subject ?subject .
            ?entry a ?entryKind ; cascade:memberCurrentValues ?values .
            ?values cascade:valuesOfMember ?profile .
            FILTER (?aboutVerdict = cascade:About && ?entryKind = cascade:PatientProfile)
            OPTIONAL { ?values cascade:dateOfBirth ?birth }
            OPTIONAL { ?values cascade:administrativeGender ?gender }
            OPTIONAL { ?values cascade:deceased ?dead }
            OPTIONAL { ?values cascade:dateOfDeath ?died }
          }
          BIND (CONCAT(STR(?profile), " ", STR(?birth)) AS ?birthText)
          BIND (CONCAT(STR(?profile), " ", ?gender) AS ?genderText)
          BIND (CONCAT(STR(?profile), " ", STR(?dead)) AS ?deceasedText)
          BIND (CONCAT(STR(?profile), " ", STR(?died)) AS ?deathDateText)
        }
        ORDER BY ?subject ?profile }
    }
    GROUP BY ?subject }
  { SELECT ?subject (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?sourceText, "\u001F"), ""); separator=""), "\u001F$", "")
                     AS ?allSources)
    WHERE {
      { SELECT ?subject ?sourceText
        WHERE {
          { SELECT ?subject ?sourceRecord ?document ?retrievedOn
                   (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?hospital, ", "), ""); separator=""), ", $", "") AS ?hospitals)
            WHERE {
              { SELECT ?subject ?sourceRecord ?document ?retrievedOn ?hospital
                WHERE {
                  ?subject a cascade:Subject .
                  OPTIONAL {
                    ?about cascade:countsUnderLens true ; cascade:verdict ?aboutVerdict ; prov:hadMember ?sourceRecord ;
                           cascade:subject ?subject .
                    ?entry a ?entryKind ; cascade:entryMember ?sourceRecord .
                    FILTER (?aboutVerdict = cascade:About && ?entryKind = cascade:PatientProfile)
                    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 ?subject ?sourceRecord ?document ?hospital }
            }
            GROUP BY ?subject ?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 ?subject ?sourceText }
    }
    GROUP BY ?subject }
  ?subject a cascade:Subject .
  OPTIONAL { ?subject rdfs:label ?subjectLabel }
  BIND (IF(?births = "", 1/0, ?births) AS ?dateOfBirth)
  BIND (IF(?genders = "", 1/0, ?genders) AS ?administrativeGender)
  BIND (IF(?deaths = "", 1/0, ?deaths) AS ?deceased)
  BIND (IF(?deathDates = "", 1/0, ?deathDates) AS ?dateOfDeath)
  BIND (IF(?allSources = "", 1/0, ?allSources) AS ?sources)
}
ORDER BY ?subject

The terms it uses: cascade:Subject, cascade:countsUnderLens, cascade:verdict, prov:hadMember, cascade:subject, cascade:memberCurrentValues, cascade:valuesOfMember, cascade:About, cascade:PatientProfile, cascade:dateOfBirth, cascade:administrativeGender, cascade:deceased, cascade:dateOfDeath, cascade:entryMember, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/The person this pod is about"

Or in GraphDB, open the saved query pod/The person this pod is about in the repository martin-okafor.

What each import brought in

23 rows

An import is one run of the Bridge over one download, or one session of the person entering things. Rows come in the order the imports started: every revision it added, the record it revised, and the version it carries.

?started?import?record?revision?version
2026-10-13 09:10 UTCFHIR pullurn:uuid:b110c83f-9061-882c-abda-6cee63b93c1f TurtleRevision · no name · Harbourline Genetics · received 2026-10-13ni:///sha-256;VGqPY2nBN0SuUGPf4ziq9H88L7uermTOF3h2SO963E4
2026-10-13 09:10 UTCFHIR pullPatient profile · Harbourline Genetics · first received 2026-10-13 TurtleRevision · no name · Harbourline Genetics · received 2026-10-13ni:///sha-256;gMvKTYj93qWqBzKbPHvWIcmH-IvJVGPAmEcaB0BwzKg
2026-10-13 09:10 UTCFHIR pullReport · Genetic analysis report · Harbourline Genetics · received 2026-10-13 TurtleRevision · Genetic analysis report · Harbourline Genetics · received 2026-10-13Report version · Genetic analysis report · final · Harbourline Genetics · first received 2026-10-13
2026-10-13 09:10 UTCFHIR pullVariant interpretation · no name · Harbourline Genetics · received 2026-10-13 TurtleRevision · no name · Harbourline Genetics · received 2026-10-13Variant interpretation version · no name · final · Harbourline Genetics · first received 2026-10-13
2026-10-13 09:10 UTCFHIR pullVariant interpretation · no name · Harbourline Genetics · received 2026-10-13 TurtleRevision · no name · Harbourline Genetics · received 2026-10-13Variant interpretation version · no name · final · Harbourline Genetics · first received 2026-10-13
2026-10-13 09:10 UTCFHIR pullVariant interpretation · no name · Harbourline Genetics · received 2026-10-13 TurtleRevision · no name · Harbourline Genetics · received 2026-10-13Variant interpretation version · no name · final · Harbourline Genetics · first received 2026-10-13
2026-10-13 09:10 UTCFHIR pullVariant · NM_000179.3:c.2633T>C · Harbourline Genetics · received 2026-10-13 TurtleRevision · NM_000179.3:c.2633T>C · Harbourline Genetics · received 2026-10-13Variant version · NM_000179.3:c.2633T>C · final · Harbourline Genetics · first received 2026-10-13
2026-10-13 09:10 UTCFHIR pullVariant · NM_000249.3:c.2042C>T · Harbourline Genetics · received 2026-10-13 TurtleRevision · NM_000249.3:c.2042C>T · Harbourline Genetics · received 2026-10-13Variant version · NM_000249.3:c.2042C>T · final · Harbourline Genetics · first received 2026-10-13
2026-10-13 09:10 UTCFHIR pullVariant · NM_001258271.2:c.1111A>T · Harbourline Genetics · received 2026-10-13 TurtleRevision · NM_001258271.2:c.1111A>T · Harbourline Genetics · received 2026-10-13Variant version · NM_001258271.2:c.1111A>T · final · Harbourline Genetics · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullurn:uuid:f20e0b14-67dc-86e1-bf1f-d91db549155f TurtleRevision · no name · St Columba's Hospital · received 2026-10-13ni:///sha-256;-6gtQs0HYBG39bYSLtPN6ta3GIgq_biQFbzZeVIOSVg
2026-10-13 09:20 UTCFHIR pullCondition · Essential hypertension · St Columba's Hospital · received 2026-10-13 TurtleRevision · Essential hypertension · St Columba's Hospital · received 2026-10-13Condition version · Essential hypertension · active · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullCondition · Hyperlipidemia · St Columba's Hospital · received 2026-10-13 TurtleRevision · Hyperlipidemia · St Columba's Hospital · received 2026-10-13Condition version · Hyperlipidemia · active · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullMedication · Amlodipine 5 mg tablet · St Columba's Hospital · received 2026-10-13 TurtleRevision · Amlodipine 5 mg tablet · St Columba's Hospital · received 2026-10-13Medication version · Amlodipine 5 mg tablet · active · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullMedication · Atorvastatin 10 mg tablet · St Columba's Hospital · received 2026-10-13 TurtleRevision · Atorvastatin 10 mg tablet · St Columba's Hospital · received 2026-10-13Medication version · Atorvastatin 10 mg tablet · active · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullPatient profile · St Columba's Hospital · first received 2026-10-13 TurtleRevision · no name · St Columba's Hospital · received 2026-10-13ni:///sha-256;8SBK1XgjzRbWBHg7WM8dQGQAJ1Fd6iMAqABX5saff1M
2026-10-13 09:20 UTCFHIR pullProcedure · Colonoscopy · St Columba's Hospital · received 2026-10-13 TurtleRevision · Colonoscopy · St Columba's Hospital · received 2026-10-13Procedure version · Colonoscopy · completed · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullReport · Genetic analysis report · St Columba's Hospital · received 2026-10-13 TurtleRevision · Genetic analysis report · St Columba's Hospital · received 2026-10-13Report version · Genetic analysis report · final · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullVariant interpretation · no name · St Columba's Hospital · received 2026-10-13 TurtleRevision · no name · St Columba's Hospital · received 2026-10-13Variant interpretation version · no name · final · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullVariant interpretation · no name · St Columba's Hospital · received 2026-10-13 TurtleRevision · no name · St Columba's Hospital · received 2026-10-13Variant interpretation version · no name · final · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullVariant interpretation · no name · St Columba's Hospital · received 2026-10-13 TurtleRevision · no name · St Columba's Hospital · received 2026-10-13Variant interpretation version · no name · final · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullVariant · NM_000059.4:c.7865A>G · St Columba's Hospital · received 2026-10-13 TurtleRevision · NM_000059.4:c.7865A>G · St Columba's Hospital · received 2026-10-13Variant version · NM_000059.4:c.7865A>G · final · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullVariant · NM_000179.3:c.2633T>C · St Columba's Hospital · received 2026-10-13 TurtleRevision · NM_000179.3:c.2633T>C · St Columba's Hospital · received 2026-10-13Variant version · NM_000179.3:c.2633T>C · final · St Columba's Hospital · first received 2026-10-13
2026-10-13 09:20 UTCFHIR pullVariant · NM_000249.4:c.2042C>T · St Columba's Hospital · received 2026-10-13 TurtleRevision · NM_000249.4:c.2042C>T · St Columba's Hospital · received 2026-10-13Variant version · NM_000249.4:c.2042C>T · final · St Columba's Hospital · first received 2026-10-13

23 rows

The query: queries/questions/pod/What each import brought in.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?started ?import ?importLabel ?record ?recordLabel ?revision ?revisionLabel ?version ?versionLabel
WHERE {
  VALUES ?kind { cascade:DocumentImport cascade:HandEntrySession }
  ?import a ?kind ; prov:startedAtTime ?started .
  ?revision prov:wasGeneratedBy ?import ; cascade:revisionOf ?record ; cascade:version ?version .
  OPTIONAL { ?import rdfs:label ?importLabel }
  OPTIONAL { ?record rdfs:label ?recordLabel }
  OPTIONAL { ?revision rdfs:label ?revisionLabel }
  OPTIONAL { ?version rdfs:label ?versionLabel }
}
ORDER BY ?started ?import ?recordLabel ?revision

The terms it uses: cascade:DocumentImport, cascade:HandEntrySession, prov:startedAtTime, prov:wasGeneratedBy, cascade:revisionOf, cascade:version, rdfs:label.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/What each import brought in"

Or in GraphDB, open the saved query pod/What each import brought in in the repository martin-okafor.

What each report says of a variant

6 rows

Read from the view as an app would: one row for each interpretation entry that names the variant it interprets, newest first within a variant. ?report is the interpretation's entry and ?variant the variant's entry, each as the other pod questions give an entry's IRI; ?classification is the cascade: IRI of the ACMG value the report states, none for a report whose answer is not one of the five, and ?date the day it was issued, or its year or month where the source wrote no day, ordered by the date as written. ?lab is the organization record the view attributes the report to, none for a report that names no lab, and ?labName that record's current name.

?report?variant?classification?date?lab?labName
clinical/variant-interpretations.ttl#8709375c4737a3d474ea72fab8ddffbeddbc4c4d19abf6e526eb6817c4b7a161clinical/variants.ttl#09620feeb84e00cd438e6ac975c1dad00463f7cfa4cfa48654d045d5af3b7081cascade:UncertainSignificance2022-06-14urn:uuid:b110c83f-9061-882c-abda-6cee63b93c1f TurtleHarbourline Genetics
clinical/variant-interpretations.ttl#5753df19a9240fbc5e885de9151807d10801b4ee51ce20e7b7abb03c47f5f5dbclinical/variants.ttl#1b1e91c6629bc211630eeb05fa6eb34c526f9e2e033d9010ec43ab76a6523844cascade:Benign2024-03-21urn:uuid:f20e0b14-67dc-86e1-bf1f-d91db549155f TurtleSt Columba's Hospital
clinical/variant-interpretations.ttl#a2329a370322ff79b74805e2053558ccaea4c9de684923c7627ce26690b3ba69clinical/variants.ttl#1b1e91c6629bc211630eeb05fa6eb34c526f9e2e033d9010ec43ab76a6523844cascade:Benign2022-06-14urn:uuid:b110c83f-9061-882c-abda-6cee63b93c1f TurtleHarbourline Genetics
clinical/variant-interpretations.ttl#8fe38281afeef276c481d0fe266b6eb00345bfa4930b5a8c291eaa987c8cb37cclinical/variants.ttl#5ce4cc59328ecac5827bd418008ac986b1b1082aaba54439503deed40d45cca3cascade:UncertainSignificance2024-03-21urn:uuid:f20e0b14-67dc-86e1-bf1f-d91db549155f TurtleSt Columba's Hospital
clinical/variant-interpretations.ttl#28386292eb56f4e769886c24837f4e03ea8b41d469fb2cecb4780b4178aefbb9clinical/variants.ttl#bbebdd5d881707aab4c978f0c6b4b155fca44357325fbe6b5a83661f6885a149cascade:LikelyPathogenic2024-03-21urn:uuid:f20e0b14-67dc-86e1-bf1f-d91db549155f TurtleSt Columba's Hospital
clinical/variant-interpretations.ttl#42508478e9537bbf506c9dc1a4800ae8346b1a979d773cd18810805f966a7d24clinical/variants.ttl#bbebdd5d881707aab4c978f0c6b4b155fca44357325fbe6b5a83661f6885a149cascade:UncertainSignificance2022-06-14urn:uuid:b110c83f-9061-882c-abda-6cee63b93c1f TurtleHarbourline Genetics

6 rows

The query: queries/questions/pod/What each report says of a variant.rq on GitHub
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#>

SELECT DISTINCT ?report ?variant ?classification ?date ?lab ?labName
WHERE {
  ?report cascade:subjectVariant ?variant ; cascade:entryMember [] .
  OPTIONAL { ?report cascade:acmgClassification ?classification }
  OPTIONAL { ?report cascade:variantInterpretationDate ?date }
  OPTIONAL { ?report prov:wasAttributedTo ?lab .
             OPTIONAL { ?lab pav:hasCurrentVersion/foaf:name ?labName } }
}
ORDER BY ?variant DESC(STR(?date)) ?report

The terms it uses: cascade:subjectVariant, cascade:entryMember, cascade:acmgClassification, cascade:variantInterpretationDate, prov:wasAttributedTo, pav:hasCurrentVersion.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/What each report says of a variant"

Or in GraphDB, open the saved query pod/What each report says of a variant in the repository martin-okafor.

What was seen more than once

4 rows

Each entry that holds more than one record, once for each place its records came from: how many of its records came from that place, and from how many places they came. A record's place is read from its current revision: a hospital that wrote or keeps the document it was derived from, by its label or its organization record's current name, or, when it has none, the label of the import or session that generated it. A place is told apart by that text alone: a hospital with two names is two places, and a hospital and an import that share a name are one. A record with two hospitals counts at each, so an entry's records can add up to more than it holds; a record with no hospital and no labelled import or session is given no place, and is not counted in places. Entries seen at more than one place come first.

?entry?place?records?places
Variant entry · NM_000179.3:c.2633T>CHarbourline Genetics12
Variant entry · NM_000179.3:c.2633T>CSt Columba's Hospital12
Variant entry · NM_000249.4:c.2042C>THarbourline Genetics12
Variant entry · NM_000249.4:c.2042C>TSt Columba's Hospital12

4 rows

The query: queries/questions/pod/What was seen more than once.rq on GitHub
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 ?entry ?entryLabel ?place (COUNT(DISTINCT ?record) AS ?records) ?places
WHERE {
  { SELECT ?entry (COUNT(DISTINCT ?somewhere) AS ?places)
    WHERE {
      ?member a cascade:Record ; ^cascade:entryMember ?entry ; cascade:currentRevision ?memberRevision .
      OPTIONAL { ?memberRevision prov:wasGeneratedBy/rdfs:label ?memberImportLabel }
      OPTIONAL { ?memberRevision prov:wasDerivedFrom/prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?memberHospital }
      BIND (COALESCE(?memberHospital, ?memberImportLabel) AS ?somewhere)
    }
    GROUP BY ?entry
    HAVING (COUNT(DISTINCT ?member) > 1) }
  ?record ^cascade:entryMember ?entry ; cascade:currentRevision ?revision .
  OPTIONAL { ?entry rdfs:label ?entryLabel }
  OPTIONAL { ?revision prov:wasGeneratedBy/rdfs:label ?importLabel }
  OPTIONAL { ?revision prov:wasDerivedFrom/prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?hospital }
  BIND (COALESCE(?hospital, ?importLabel) AS ?place)
}
GROUP BY ?entry ?entryLabel ?place ?places
ORDER BY DESC(?places) ?entryLabel ?entry ?place

The terms it uses: cascade:Record, cascade:entryMember, cascade:currentRevision, prov:wasGeneratedBy, prov:wasDerivedFrom, rdfs:label, pav:hasCurrentVersion.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/What was seen more than once"

Or in GraphDB, open the saved query pod/What was seen more than once in the repository martin-okafor.

Which files are out of place: none. The question

Which reference versions are current

2 rows

The matcher compares codes using reference tables, and each table comes in versions. The newest is the one no other revises; a matcher judgment made with an older one stops counting, unless the newest one's rows join its records too.

2 rows

The query: queries/questions/pod/Which reference versions are current.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pav: <http://purl.org/pav/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?series ?seriesLabel ?version ?versionLabel
WHERE {
  ?series a cascade:ReferenceSeries ; pav:hasCurrentVersion ?version .
  OPTIONAL { ?series rdfs:label ?seriesLabel }
  OPTIONAL { ?version rdfs:label ?versionLabel }
}
ORDER BY ?series ?version

The terms it uses: cascade:ReferenceSeries, pav:hasCurrentVersion, rdfs:label.

Run it yourself, from the runtime's root:

npm run ask -- martin-okafor "pod/Which reference versions are current"

Or in GraphDB, open the saved query pod/Which reference versions are current in the repository martin-okafor.