Skip to content
Alpha: see what works today →
Menu

Priya Natarajan

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.priya-natarajan.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

75 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/allergy or intolerance cascade:AllergyOrIntolerance1
/clinical/clinical note or document cascade:ClinicalNoteOrDocument4
/clinical/diagnostic report cascade:DiagnosticReport1
/clinical/laboratory test result cascade:LaboratoryTestResult2
/clinical/patient profile cascade:PatientProfile1
/clinical/prescribed or reported medication cascade:PrescribedOrReportedMedication4
/clinical/problem or diagnosis cascade:ProblemOrDiagnosis2
/clinical/vaccination cascade:Vaccination1
/clinical/view cascade:View9
/judgments/SoftwareAgent prov:SoftwareAgent1
/judgments/judgment cascade:Judgment12
/judgments/assertions/matcher judgment assertion cascade:MatcherJudgmentAssertion7
/profile/Person prov:Person1
/profile/foaf:Person1
/provenance/activities/Activity prov:Activity5
/provenance/activities/SoftwareAgent prov:SoftwareAgent1
/provenance/activities/hand entry session cascade:HandEntrySession1
/provenance/activities/matcher run cascade:MatcherRun4
/provenance/activities/snapshot cascade:Snapshot5
/provenance/documents/Entity prov:Entity11
/provenance/imports/Activity prov:Activity7
/provenance/imports/SoftwareAgent prov:SoftwareAgent1
/provenance/imports/document import cascade:DocumentImport7
/provenance/imports/snapshot cascade:Snapshot7
/records/allergies/FragmentSelector oa:FragmentSelector1
/records/allergies/XPathSelector oa:XPathSelector3
/records/allergies/allergy or intolerance cascade:AllergyOrIntolerance3
/records/allergies/revision cascade:Revision4
/records/allergies/no type stated4
/records/conditions/FragmentSelector oa:FragmentSelector1
/records/conditions/XPathSelector oa:XPathSelector2
/records/conditions/problem or diagnosis cascade:ProblemOrDiagnosis3
/records/conditions/revision cascade:Revision3
/records/conditions/no type stated3
/records/immunizations/XPathSelector oa:XPathSelector1
/records/immunizations/revision cascade:Revision1
/records/immunizations/vaccination cascade:Vaccination1
/records/immunizations/no type stated1
/records/lab-results/FragmentSelector oa:FragmentSelector2
/records/lab-results/XPathSelector oa:XPathSelector1
/records/lab-results/laboratory test result cascade:LaboratoryTestResult3
/records/lab-results/revision cascade:Revision3
/records/lab-results/no type stated12
/records/medications/FragmentSelector oa:FragmentSelector2
/records/medications/XPathSelector oa:XPathSelector6
/records/medications/prescribed or reported medication cascade:PrescribedOrReportedMedication9
/records/medications/revision cascade:Revision9
/records/medications/no type stated15
/records/notes-and-documents/XPathSelector oa:XPathSelector10
/records/notes-and-documents/clinical note or document cascade:ClinicalNoteOrDocument4
/records/notes-and-documents/revision cascade:Revision10
/records/notes-and-documents/no type stated10
/records/organizations/XPathSelector oa:XPathSelector2
/records/organizations/organization cascade:Organization2
/records/organizations/revision cascade:Revision2
/records/organizations/no type stated2
/records/patient-profile/XPathSelector oa:XPathSelector2
/records/patient-profile/patient profile cascade:PatientProfile2
/records/patient-profile/revision cascade:Revision2
/records/patient-profile/no type stated2
/records/reports/XPathSelector oa:XPathSelector1
/records/reports/diagnostic report cascade:DiagnosticReport1
/records/reports/revision cascade:Revision1
/records/reports/no type stated1
/records/servers/server cascade:Server1
/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:TypeRegistration9
/settings/solid:UnlistedDocument1
/subject/subject cascade:Subject1

75 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 -- priya-natarajan "pod/What each folder holds"

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

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

8 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.

8 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 -- priya-natarajan "pod/Which view lists each kind"

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

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

34 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.

34 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 -- priya-natarajan "pod/How many of each kind"

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

My active allergies

1 row

Read from the view alone, as an app would: each entry whose status is active, or that no document gives a status (its status then reads "not stated"), with its code, its criticality, its category and onset as its lead states them, else as the members chosen for them do, how many records it joins, what each record states of the reaction, 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. A record's reactions are its reaction texts, then its reaction codes in parentheses, then its severity, each as the record's current values state them, so a record that is not the entry's lead is read as much as the lead. A list holds its values in order, separated by U+001F, a record stating none of them is left out, and a list with nothing in it is unbound; a value's own parts are ended by ", ".

?allergenName?code?criticality?status?category?onset?reactionsByRecord?records?entry?sources
AspirinRxNorm 1191lowactivemedication2016urn:uuid:1e34e75f-f22b-8b29-b85e-ac9214de3f50 Urticaria (http://snomed.info/id/126485001), moderateurn:uuid:3276d319-248c-8b93-8342-3b1ffa356f20 Hives (http://snomed.info/id/126485001)urn:uuid:ed292d3f-0e3b-8504-8be2-1c1a149764dd Urticaria (http://snomed.info/id/126485001)3Allergy entry · Aspirinurn:uuid:1e34e75f-f22b-8b29-b85e-ac9214de3f50 from ni:///sha-256;Bwm0crFETA-xzDHxXmRCabkhh_ERelDEVRRKvQdzgWg, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospitalurn:uuid:3276d319-248c-8b93-8342-3b1ffa356f20 from ni:///sha-256;qXn6lMeu_atscvvwusJYEXv5V5rOs7zhN3BQ40XFKd0, retrieved 2025-03-29T18:39:51Z, written by Kestrel Harbor Hospitalurn:uuid:ed292d3f-0e3b-8504-8be2-1c1a149764dd from ni:///sha-256;qurj4q_ZRRUEBFDJ5YawdegzxLUUUJn62fRs8J-LcDE, kept by Fernhill Family Clinic, written by Fernhill Family Clinic

1 row

The query: queries/questions/pod/My active allergies.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 ?allergenName ?code ?criticality ?status ?category ?onset ?reactionsByRecord (COUNT(?record) AS ?records) ?entry ?entryLabel ?sources
WHERE {
  { SELECT ?entry (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?memberText, "\u001F"), ""); separator=""), "\u001F$", "") AS ?allReactions)
    WHERE {
      { SELECT ?entry ?memberText
        WHERE {
          { SELECT ?entry ?member (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(?reactionText, ", "), ""); separator=""), ", $", "") AS ?texts)
            WHERE {
              { SELECT ?entry ?member ?reactionText
                WHERE {
                  ?entry a cascade:AllergyOrIntolerance ; cascade:memberCurrentValues ?textValues .
                  FILTER NOT EXISTS { ?entry cascade:clinicalStatus ?other FILTER (?other != "active") }
                  ?textValues cascade:valuesOfMember ?member .
                  OPTIONAL { ?textValues cascade:reactionManifestationText ?reactionText }
                }
                ORDER BY ?entry ?member ?reactionText }
            }
            GROUP BY ?entry ?member }
          { SELECT ?entry ?member (REPLACE(GROUP_CONCAT(DISTINCT COALESCE(CONCAT(STR(?memberCode), ", "), ""); separator=""), ", $", "") AS ?codes)
            WHERE {
              { SELECT ?entry ?member ?memberCode
                WHERE {
                  ?entry a cascade:AllergyOrIntolerance ; cascade:memberCurrentValues ?codeValues .
                  FILTER NOT EXISTS { ?entry cascade:clinicalStatus ?other FILTER (?other != "active") }
                  ?codeValues cascade:valuesOfMember ?member .
                  OPTIONAL { ?codeValues cascade:reactionManifestationCode ?memberCode }
                }
                ORDER BY ?entry ?member ?memberCode }
            }
            GROUP BY ?entry ?member }
          ?entry cascade:memberCurrentValues ?severityValues .
          ?severityValues cascade:valuesOfMember ?member .
          OPTIONAL { ?severityValues cascade:allergySeverity ?memberSeverity }
          BIND (IF(?texts = "" && ?codes = "" && !BOUND(?memberSeverity), 1/0,
                   CONCAT(STR(?member),
                          IF(?texts = "", "", CONCAT(" ", ?texts)),
                          IF(?codes = "", "", CONCAT(" (", ?codes, ")")),
                          COALESCE(CONCAT(", ", ?memberSeverity), ""))) AS ?memberText)
        }
        ORDER BY ?entry ?memberText }
    }
    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:AllergyOrIntolerance ; cascade:entryMember ?sourceRecord .
                  FILTER NOT EXISTS { ?entry cascade:clinicalStatus ?other FILTER (?other != "active") }
                  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:AllergyOrIntolerance ;
         cascade:allergenName ?allergenName ; cascade:entryMember ?record .
  OPTIONAL { ?entry cascade:clinicalStatus ?stated }
  FILTER (!BOUND(?stated) || ?stated = "active")
  OPTIONAL { ?entry cascade:allergenCode ?code }
  OPTIONAL { ?entry cascade:allergyCriticality ?criticality }
  OPTIONAL { ?entry cascade:allergyCategory ?category }
  OPTIONAL { ?entry cascade:onsetDate ?onset }
  OPTIONAL { ?entry rdfs:label ?entryLabel }
  BIND (COALESCE(?stated, "not stated") AS ?status)
  BIND (IF(?allReactions = "", 1/0, ?allReactions) AS ?reactionsByRecord)
}
GROUP BY ?entry ?allergenName ?code ?criticality ?status ?category ?onset ?reactionsByRecord ?entryLabel ?sources
ORDER BY ?allergenName ?entry ?code

The terms it uses: cascade:AllergyOrIntolerance, cascade:memberCurrentValues, cascade:clinicalStatus, cascade:valuesOfMember, cascade:reactionManifestationText, cascade:reactionManifestationCode, cascade:allergySeverity, cascade:entryMember, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion, cascade:allergenName, cascade:allergenCode, cascade:allergyCriticality, cascade:allergyCategory, cascade:onsetDate.

Run it yourself, from the runtime's root:

npm run ask -- priya-natarajan "pod/My active allergies"

Or in GraphDB, open the saved query pod/My active allergies in the repository priya-natarajan.

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 596210002023-06-152Condition entry · Essential hypertension · 2023-06-15urn:uuid:908ca1db-13ad-82a9-8391-2f3f3d035453 from ni:///sha-256;PjSmpjsg6m6RHn2fkn6Y2jtlRcq8TQbB4GAGhVWWV1Q, retrieved 2025-03-29T18:39:51Z, written by Kestrel Harbor Hospitalurn:uuid:fc7b002e-5233-8177-b19f-b7684b02507b from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital
Hay feverSNOMED CT 3674980012024-10-151Condition entry · Hay fever · 2024-10-15urn:uuid:d9bc7e76-e7cf-89dd-ad65-0ea3c36288ed from ni:///sha-256;qurj4q_ZRRUEBFDJ5YawdegzxLUUUJn62fRs8J-LcDE, kept by Fernhill Family Clinic, written by Fernhill Family Clinic

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 -- priya-natarajan "pod/My active conditions"

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

My active medications

3 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 Oral TabletRxNorm 1973612025-04-012025-04-01urn:uuid:eb08288e-0f3c-86f1-9e2e-98c0721a59e4 activeurn:uuid:efb91a51-2ec8-81ec-acda-44e5465a22c8 activeurn:uuid:eb08288e-0f3c-86f1-9e2e-98c0721a59e4 Take 1 tablet by mouth once daily., written 2025-04-01urn:uuid:efb91a51-2ec8-81ec-acda-44e5465a22c8 amlodipine 5 MG Oral Tablet Take 1 tablet by mouth once daily. April 1, 2025 Active2Medication entry · amlodipine 5 MG Oral Tablet · 2025-04-01urn:uuid:eb08288e-0f3c-86f1-9e2e-98c0721a59e4 from ni:///sha-256;tgT6mpcxmsu7GZScyv7uNZTwDhbUgJG8ZnvdhVWDKCM, retrieved 2025-06-14T07:12:40Z, written by Kestrel Harbor Hospitalurn:uuid:efb91a51-2ec8-81ec-acda-44e5465a22c8 from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital
lisinopril 10 MG Oral TabletRxNorm 3140762023-06-152023-06-15urn:uuid:62afa632-0672-8e62-b160-02d3a96f6c5b activeurn:uuid:e6e48325-74c2-8cae-a26e-8e802cee03c2 activeurn:uuid:62afa632-0672-8e62-b160-02d3a96f6c5b Take 1 tablet by mouth once daily., written 2023-06-15urn:uuid:e6e48325-74c2-8cae-a26e-8e802cee03c2 lisinopril 10 MG Oral Tablet Take 1 tablet by mouth once daily. June 15, 2023 Active2Medication entry · lisinopril 10 MG Oral Tablet · 2023-06-15urn:uuid:62afa632-0672-8e62-b160-02d3a96f6c5b from ni:///sha-256;AAZXQ4qJikuBjOyYT8yakeYd2jjZvhGJ4knRmhehZKo, retrieved 2025-03-29T18:39:51Z, written by Kestrel Harbor Hospitalurn:uuid:e6e48325-74c2-8cae-a26e-8e802cee03c2 from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital
loratadine 10 MG Oral TabletRxNorm 311372urn:uuid:6403335b-0709-8906-8c7c-cd8dfc0d854a activeurn:uuid:9497431c-48fd-877f-9d90-cb6b2e16cd37 activeurn:uuid:acf3f318-ce80-8c57-b247-632d6648bafc activeurn:uuid:9497431c-48fd-877f-9d90-cb6b2e16cd37 Claritin 10 MG Oral Tablet: 1 tablet daily as needed; start date not recordedurn:uuid:acf3f318-ce80-8c57-b247-632d6648bafc Claritin 10 MG Oral Tablet: 1 tablet daily as needed; start date not recorded3Medication entry · loratadine 10 MG Oral Tableturn:uuid:6403335b-0709-8906-8c7c-cd8dfc0d854aurn:uuid:9497431c-48fd-877f-9d90-cb6b2e16cd37 from ni:///sha-256;qurj4q_ZRRUEBFDJ5YawdegzxLUUUJn62fRs8J-LcDE, kept by Fernhill Family Clinic, written by Fernhill Family Clinicurn:uuid:acf3f318-ce80-8c57-b247-632d6648bafc from ni:///sha-256;uceV7W1vUib_6nbQMyon-i3vQoM0LbQ6aZnaW47jqcQ, kept by Fernhill Family Clinic, written by Fernhill Family Clinic

3 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 -- priya-natarajan "pod/My active medications"

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

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 59621000active2023-06-15urn:uuid:908ca1db-13ad-82a9-8391-2f3f3d035453 activeurn:uuid:fc7b002e-5233-8177-b19f-b7684b02507b active2Condition entry · Essential hypertension · 2023-06-15urn:uuid:908ca1db-13ad-82a9-8391-2f3f3d035453 from ni:///sha-256;PjSmpjsg6m6RHn2fkn6Y2jtlRcq8TQbB4GAGhVWWV1Q, retrieved 2025-03-29T18:39:51Z, written by Kestrel Harbor Hospitalurn:uuid:fc7b002e-5233-8177-b19f-b7684b02507b from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital
Hay feverSNOMED CT 367498001active2024-10-15urn:uuid:d9bc7e76-e7cf-89dd-ad65-0ea3c36288ed active1Condition entry · Hay fever · 2024-10-15urn:uuid:d9bc7e76-e7cf-89dd-ad65-0ea3c36288ed from ni:///sha-256;qurj4q_ZRRUEBFDJ5YawdegzxLUUUJn62fRs8J-LcDE, kept by Fernhill Family Clinic, written by Fernhill Family Clinic

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 -- priya-natarajan "pod/My condition history"

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

My genetic variants: none. The question

My immunizations

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, each CVX code the entry states, a row for each, 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.

?given?vaccine?code?status?records?entry?sources
2024-10-15Influenza vaccineCVX 141completed1Immunization entry · Influenza vaccine · 2024-10-15urn:uuid:b7406450-c64e-86e9-9e22-32ccf1dcd76e from ni:///sha-256;qurj4q_ZRRUEBFDJ5YawdegzxLUUUJn62fRs8J-LcDE, kept by Fernhill Family Clinic, written by Fernhill Family Clinic

1 row

The query: queries/questions/pod/My immunizations.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 ?given ?vaccine ?code ?status (COUNT(?record) AS ?records) ?entry ?entryLabel ?sources
WHERE {
  { 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:Vaccination ; 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:Vaccination ; cascade:entryMember ?record .
  OPTIONAL { ?entry cascade:vaccinationOccurrenceTime ?given }
  OPTIONAL { ?entry cascade:vaccineName ?vaccine }
  OPTIONAL { ?entry cascade:vaccineCode ?code }
  OPTIONAL { ?entry cascade:workflowStatus ?status }
  OPTIONAL { ?entry rdfs:label ?entryLabel }
}
GROUP BY ?entry ?given ?vaccine ?code ?status ?entryLabel ?sources
ORDER BY DESC(COALESCE(STR(?given), "")) ?vaccine ?entry ?code

The terms it uses: cascade:Vaccination, cascade:entryMember, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion, cascade:vaccinationOccurrenceTime, cascade:vaccineName, cascade:vaccineCode, cascade:workflowStatus.

Run it yourself, from the runtime's root:

npm run ask -- priya-natarajan "pod/My immunizations"

Or in GraphDB, open the saved query pod/My immunizations in the repository priya-natarajan.

My lab results

2 rows

Read from the view alone, as an app would, newest first, with the interpretation flags its source gave each entry, each the code of HL7's ObservationInterpretation, its reference range as text and each bound as written, with its unit, the text each record's source wrote for it, such as a label beside the value (none when no record has one), how many records each entry joins, 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. 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, and an entry's rows by code.

?performed?test?code?value?unit?status?interpretations?referenceRangeText?referenceRangeLow?referenceRangeHigh?narrativeTexts?records?entry?sources
2025-06-10 13:45 UTCPotassiumLOINC 2823-34.4mmol/LfinalN3.5-5.1 mmol/L3.5 mmol/L5.1 mmol/L1Lab result entry · Potassium · 2025-06-10T13:45:00Zurn:uuid:89e2da27-e7d8-8643-8a3e-d4b817d3fb18 from ni:///sha-256;uaajzsPxTtKovhO7m0Az4GIX2nEb19Ocab3Mv5Sx-mA, retrieved 2025-06-14T07:12:40Z, written by Kestrel Harbor Hospital
2025-03-27 12:00 UTCPotassium [Moles/volume] in Serum or PlasmaLOINC 2823-34.1mmol/lfinalN3.5-5.1 mmol/l3.5 mmol/l5.1 mmol/lurn:uuid:5a550ee4-b064-85aa-a002-291c94d66d63 Potassium 4.1 mmol/l 3.5-5.1 mmol/l March 27, 2025 12:00 UTC2Lab result entry · Potassium [Moles/volume] in Serum or Plasma · 2025-03-27T12:00:00Zurn:uuid:5a550ee4-b064-85aa-a002-291c94d66d63 from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospitalurn:uuid:5d05bfc9-fed1-8887-a78a-62bd0f938d7e from ni:///sha-256;9A9vb7ioqrBFMhikgEJ_t7jN_ytVUXaoQ7a8eBBia4c, retrieved 2025-03-29T18:39:51Z, written by Kestrel Harbor Hospital

2 rows

The query: queries/questions/pod/My lab results.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 ?test ?code ?value ?unit ?status ?interpretations ?referenceRangeText ?referenceRangeLow ?referenceRangeHigh
       ?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:LaboratoryTestResult ; 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 COALESCE(CONCAT(?flag, "\u001F"), ""); separator=""), "\u001F$", "") AS ?flags)
    WHERE {
      { SELECT ?entry ?flag
        WHERE {
          ?entry a cascade:LaboratoryTestResult .
          OPTIONAL { ?entry cascade:resultInterpretationCode ?interpretation }
          BIND (REPLACE(STR(?interpretation), "^.*/", "") AS ?flag)
        }
        ORDER BY ?entry ?flag }
    }
    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:LaboratoryTestResult ; 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:LaboratoryTestResult ; cascade:entryMember ?record .
  OPTIONAL { ?entry cascade:resultClinicallyRelevantTime ?performed }
  OPTIONAL { ?entry cascade:testName ?test }
  OPTIONAL { ?entry cascade:testCode ?code }
  OPTIONAL { ?entry cascade:resultValueText ?value }
  OPTIONAL { ?entry cascade:resultUnitText ?unit }
  OPTIONAL { ?entry cascade:workflowStatus ?status }
  OPTIONAL { ?entry cascade:referenceRangeText ?referenceRangeText }
  OPTIONAL { ?entry cascade:referenceRangeLow ?low .
             ?low cascade:writtenValue ?lowWritten .
             OPTIONAL { ?low cascade:unitText ?lowUnitText }
             OPTIONAL { ?low cascade:ucumUnit ?lowUcum } }
  OPTIONAL { ?entry cascade:referenceRangeHigh ?high .
             ?high cascade:writtenValue ?highWritten .
             OPTIONAL { ?high cascade:unitText ?highUnitText }
             OPTIONAL { ?high cascade:ucumUnit ?highUcum } }
  OPTIONAL { ?entry rdfs:label ?entryLabel }
  BIND (IF(?flags = "", 1/0, ?flags) AS ?interpretations)
  BIND (IF(?said = "", 1/0, ?said) AS ?narrativeTexts)
  BIND (CONCAT(?lowWritten, COALESCE(CONCAT(" ", COALESCE(?lowUnitText, ?lowUcum)), "")) AS ?referenceRangeLow)
  BIND (CONCAT(?highWritten, COALESCE(CONCAT(" ", COALESCE(?highUnitText, ?highUcum)), "")) AS ?referenceRangeHigh)
}
GROUP BY ?entry ?performed ?test ?code ?value ?unit ?status ?interpretations ?referenceRangeText ?referenceRangeLow
         ?referenceRangeHigh ?narrativeTexts ?entryLabel ?sources
ORDER BY DESC(COALESCE(SUBSTR(STR(?performed), 1, 10), "")) DESC(COALESCE(STR(?performed), "")) ?test ?entry ?code

The terms it uses: cascade:LaboratoryTestResult, cascade:memberCurrentValues, cascade:valuesOfMember, cascade:narrativeText, cascade:resultInterpretationCode, cascade:entryMember, cascade:currentRevision, pav:retrievedOn, prov:wasGeneratedBy, prov:hadRole, prov:agent, cascade:AuthorRole, cascade:CustodianRole, rdfs:label, pav:hasCurrentVersion, cascade:resultClinicallyRelevantTime, cascade:testName, cascade:testCode, cascade:resultValueText, cascade:resultUnitText, cascade:workflowStatus, cascade:referenceRangeText, cascade:referenceRangeLow, cascade:writtenValue, cascade:unitText, cascade:ucumUnit, cascade:referenceRangeHigh.

Run it yourself, from the runtime's root:

npm run ask -- priya-natarajan "pod/My lab results"

Or in GraphDB, open the saved query pod/My lab results in the repository priya-natarajan.

My medication history

4 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 Oral TabletRxNorm 197361activecascade:MedicationActive2025-04-012025-04-01urn:uuid:eb08288e-0f3c-86f1-9e2e-98c0721a59e4 activeurn:uuid:efb91a51-2ec8-81ec-acda-44e5465a22c8 activeurn:uuid:eb08288e-0f3c-86f1-9e2e-98c0721a59e4 Take 1 tablet by mouth once daily., written 2025-04-01urn:uuid:efb91a51-2ec8-81ec-acda-44e5465a22c8 amlodipine 5 MG Oral Tablet Take 1 tablet by mouth once daily. April 1, 2025 Active2Medication entry · amlodipine 5 MG Oral Tablet · 2025-04-01urn:uuid:eb08288e-0f3c-86f1-9e2e-98c0721a59e4 from ni:///sha-256;tgT6mpcxmsu7GZScyv7uNZTwDhbUgJG8ZnvdhVWDKCM, retrieved 2025-06-14T07:12:40Z, written by Kestrel Harbor Hospitalurn:uuid:efb91a51-2ec8-81ec-acda-44e5465a22c8 from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital
fluticasone propionate 50 MCG/ACTUAT Nasal SprayRxNorm 1797907completedcascade:MedicationStopped2024-10-15urn:uuid:1f11d0a3-24ca-85a0-887e-ae821a28988a activeurn:uuid:c3104d9a-e9ce-8053-9979-c8e285c4176b completedurn:uuid:1f11d0a3-24ca-85a0-887e-ae821a28988a fluticasone propionate 50 MCG/ACTUAT Nasal Spray: 1 spray in each nostril daily, from October 15, 2024urn:uuid:c3104d9a-e9ce-8053-9979-c8e285c4176b fluticasone propionate 50 MCG/ACTUAT Nasal Spray: 1 spray in each nostril daily, from October 15, 2024; completed2Medication entry · fluticasone propionate 50 MCG/ACTUAT Nasal Spray · 2024-10-15urn:uuid:1f11d0a3-24ca-85a0-887e-ae821a28988a from ni:///sha-256;qurj4q_ZRRUEBFDJ5YawdegzxLUUUJn62fRs8J-LcDE, kept by Fernhill Family Clinic, written by Fernhill Family Clinicurn:uuid:c3104d9a-e9ce-8053-9979-c8e285c4176b from ni:///sha-256;uceV7W1vUib_6nbQMyon-i3vQoM0LbQ6aZnaW47jqcQ, kept by Fernhill Family Clinic, written by Fernhill Family Clinic
lisinopril 10 MG Oral TabletRxNorm 314076activecascade:MedicationActive2023-06-152023-06-15urn:uuid:62afa632-0672-8e62-b160-02d3a96f6c5b activeurn:uuid:e6e48325-74c2-8cae-a26e-8e802cee03c2 activeurn:uuid:62afa632-0672-8e62-b160-02d3a96f6c5b Take 1 tablet by mouth once daily., written 2023-06-15urn:uuid:e6e48325-74c2-8cae-a26e-8e802cee03c2 lisinopril 10 MG Oral Tablet Take 1 tablet by mouth once daily. June 15, 2023 Active2Medication entry · lisinopril 10 MG Oral Tablet · 2023-06-15urn:uuid:62afa632-0672-8e62-b160-02d3a96f6c5b from ni:///sha-256;AAZXQ4qJikuBjOyYT8yakeYd2jjZvhGJ4knRmhehZKo, retrieved 2025-03-29T18:39:51Z, written by Kestrel Harbor Hospitalurn:uuid:e6e48325-74c2-8cae-a26e-8e802cee03c2 from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital
loratadine 10 MG Oral TabletRxNorm 311372activecascade:MedicationActiveurn:uuid:6403335b-0709-8906-8c7c-cd8dfc0d854a activeurn:uuid:9497431c-48fd-877f-9d90-cb6b2e16cd37 activeurn:uuid:acf3f318-ce80-8c57-b247-632d6648bafc activeurn:uuid:9497431c-48fd-877f-9d90-cb6b2e16cd37 Claritin 10 MG Oral Tablet: 1 tablet daily as needed; start date not recordedurn:uuid:acf3f318-ce80-8c57-b247-632d6648bafc Claritin 10 MG Oral Tablet: 1 tablet daily as needed; start date not recorded3Medication entry · loratadine 10 MG Oral Tableturn:uuid:6403335b-0709-8906-8c7c-cd8dfc0d854aurn:uuid:9497431c-48fd-877f-9d90-cb6b2e16cd37 from ni:///sha-256;qurj4q_ZRRUEBFDJ5YawdegzxLUUUJn62fRs8J-LcDE, kept by Fernhill Family Clinic, written by Fernhill Family Clinicurn:uuid:acf3f318-ce80-8c57-b247-632d6648bafc from ni:///sha-256;uceV7W1vUib_6nbQMyon-i3vQoM0LbQ6aZnaW47jqcQ, kept by Fernhill Family Clinic, written by Fernhill Family Clinic

4 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 -- priya-natarajan "pod/My medication history"

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

My procedures: none. The question

My reports, notes and documents

5 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
2025-08-12 19:02 UTCNote or documenthttp://loinc.org/rdf/8716-3Vital signsVital SignscurrentMay 20, 2025: blood pressure 132/84 mm[Hg]Note or document entry · Vital signs · 2025-08-12T19:02:37Zurn:uuid:49000233-78b0-891f-b619-46e0832a98d4 from ni:///sha-256;uceV7W1vUib_6nbQMyon-i3vQoM0LbQ6aZnaW47jqcQ, kept by Fernhill Family Clinic, written by Fernhill Family Clinic
2025-08-12 19:02 UTCNote or documenthttp://loinc.org/rdf/29762-2Social history NarrativeSocial HistorycurrentNever smoker, recorded May 20, 2025Note or document entry · Social history Narrative · 2025-08-12T19:02:37Zurn:uuid:42b2c52a-820f-818b-abe9-f24b5733fb27 from ni:///sha-256;uceV7W1vUib_6nbQMyon-i3vQoM0LbQ6aZnaW47jqcQ, kept by Fernhill Family Clinic, written by Fernhill Family Clinic
2025-05-05 17:42 UTCNote or documenthttp://loinc.org/rdf/29762-2Social history NarrativeSocial HistorycurrentSmoking status Recorded Never smoker March 27, 2025Note or document entry · Social history Narrative · 2025-05-05T17:42:33Zurn:uuid:a992cb26-24a1-8af1-855a-cb45d7a72acf from ni:///sha-256;Bwm0crFETA-xzDHxXmRCabkhh_ERelDEVRRKvQdzgWg, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital
2025-05-05 17:42 UTCNote or documenthttp://loinc.org/rdf/8716-3Vital signsVital SignscurrentTaken Blood pressure March 27, 2025 11:40 UTC 148/92 mm[Hg]Note or document entry · Vital signs · 2025-05-05T17:42:33Zurn:uuid:3ddc6393-6294-871f-8f14-d3e477d085de from ni:///sha-256;Bwm0crFETA-xzDHxXmRCabkhh_ERelDEVRRKvQdzgWg, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital
2025-03-27 12:00 UTCReporthttp://loinc.org/rdf/51990-0Basic metabolic panel - Bloodfinalhttps://pod.priya-natarajan.example/clinical/lab-results.ttl#385e5ffb09b34c8b29d19a3ff9f5675403e0e3e8a5f5f5e3ee145441d3c16751 Potassium [Moles/volume] in Serum or Plasma 4.1 mmol/l, reference range 3.5-5.1 mmol/l, flagged NReport entry · Basic metabolic panel - Blood · 2025-03-27T12:00:00Zurn:uuid:c825e48f-fccd-8560-b2cb-8dc9dd6e6649 from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospital

5 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 -- priya-natarajan "pod/My reports, notes and documents"

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

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 about Turtleurn:uuid:2ac2622d-c327-8f8b-ad3b-c818bbda69f2 1968-11-04urn:uuid:5d5ec9e3-66e6-8264-96ec-1cb07f9fb0ba 1968-11-04urn:uuid:2ac2622d-c327-8f8b-ad3b-c818bbda69f2 femaleurn:uuid:5d5ec9e3-66e6-8264-96ec-1cb07f9fb0ba femaleurn:uuid:2ac2622d-c327-8f8b-ad3b-c818bbda69f2 from ni:///sha-256;1NNkDAj1ax7VmzXMrvZ4e-wQvOjnNR9cNLz_fm_pLII, kept by Kestrel Harbor Hospital, written by Kestrel Harbor Hospitalurn:uuid:5d5ec9e3-66e6-8264-96ec-1cb07f9fb0ba from ni:///sha-256;qurj4q_ZRRUEBFDJ5YawdegzxLUUUJn62fRs8J-LcDE, kept by Fernhill Family Clinic, written by Fernhill Family Clinicurn:uuid:abf9a03f-8e23-8fca-8afb-ab51f2daa6f7

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 -- priya-natarajan "pod/The person this pod is about"

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

What each import brought in

35 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
2025-03-29 18:45 UTCApple Health exportAllergy · Aspirin · Kestrel Harbor Hospital · alg-aspirin-1 TurtleRevision · Aspirin · alg-aspirin-1 · received 2025-03-29Allergy version · Aspirin · active · alg-aspirin-1 · first received 2025-03-29
2025-03-29 18:45 UTCApple Health exportCondition · Essential hypertension · Kestrel Harbor Hospital · cond-htn-1 TurtleRevision · Essential hypertension · cond-htn-1 · received 2025-03-29Condition version · Essential hypertension · active · cond-htn-1 · first received 2025-03-29
2025-03-29 18:45 UTCApple Health exportLab result · Potassium · Kestrel Harbor Hospital · obs-potassium-20250327 TurtleRevision · Potassium · obs-potassium-20250327 · received 2025-03-29Lab result version · Potassium · final · obs-potassium-20250327 · first received 2025-03-29
2025-03-29 18:45 UTCApple Health exportMedication · lisinopril 10 MG Oral Tablet · Kestrel Harbor Hospital · medrx-lisinopril-1 TurtleRevision · lisinopril 10 MG Oral Tablet · medrx-lisinopril-1 · received 2025-03-29Medication version · lisinopril 10 MG Oral Tablet · active · medrx-lisinopril-1 · first received 2025-03-29
2025-04-03 09:20 UTCC-CDA downloadurn:uuid:1ca25bcf-7a1e-816b-9884-dda72bd0cac7 TurtleRevision · no name · Kestrel Harbor Hospital · received 2025-04-03ni:///sha-256;1kGjUc8o_Eb_48f9uPkk0Xo-K_UYnrtlYPPcnsWOEM8
2025-04-03 09:20 UTCC-CDA downloadAllergy · Aspirin · Kestrel Harbor Hospital · received 2025-05-05 TurtleRevision · Aspirin · Kestrel Harbor Hospital · received 2025-04-03Allergy version · Aspirin · active · Kestrel Harbor Hospital · first received 2025-04-03
2025-04-03 09:20 UTCC-CDA downloadCondition · Essential hypertension · Kestrel Harbor Hospital · received 2025-04-03 TurtleRevision · Essential hypertension · Kestrel Harbor Hospital · received 2025-04-03Condition version · Essential hypertension · active · Kestrel Harbor Hospital · first received 2025-04-03
2025-04-03 09:20 UTCC-CDA downloadLab result · Potassium [Moles/volume] in Serum or Plasma · Kestrel Harbor Hospital · received 2025-04-03 TurtleRevision · Potassium [Moles/volume] in Serum or Plasma · Kestrel Harbor Hospital · received 2025-04-03Lab result version · Potassium [Moles/volume] in Serum or Plasma · final · Kestrel Harbor Hospital · first received 2025-04-03
2025-04-03 09:20 UTCC-CDA downloadMedication · amlodipine 5 MG Oral Tablet · Kestrel Harbor Hospital · received 2025-04-03 TurtleRevision · amlodipine 5 MG Oral Tablet · Kestrel Harbor Hospital · received 2025-04-03Medication version · amlodipine 5 MG Oral Tablet · active · Kestrel Harbor Hospital · first received 2025-04-03
2025-04-03 09:20 UTCC-CDA downloadMedication · lisinopril 10 MG Oral Tablet · Kestrel Harbor Hospital · received 2025-04-03 TurtleRevision · lisinopril 10 MG Oral Tablet · Kestrel Harbor Hospital · received 2025-04-03Medication version · lisinopril 10 MG Oral Tablet · active · Kestrel Harbor Hospital · first received 2025-04-03
2025-04-03 09:20 UTCC-CDA downloadNote or document · Social history Narrative · Kestrel Harbor Hospital · received 2025-05-05 TurtleRevision · Social history Narrative · Kestrel Harbor Hospital · received 2025-04-03Note or document version · Social history Narrative · current · Kestrel Harbor Hospital · first received 2025-04-03
2025-04-03 09:20 UTCC-CDA downloadNote or document · Vital signs · Kestrel Harbor Hospital · received 2025-05-05 TurtleRevision · Vital signs · Kestrel Harbor Hospital · received 2025-04-03Note or document version · Vital signs · current · Kestrel Harbor Hospital · first received 2025-04-03
2025-04-03 09:20 UTCC-CDA downloadPatient profile · Kestrel Harbor Hospital · first received 2025-04-03 TurtleRevision · no name · Kestrel Harbor Hospital · received 2025-04-03ni:///sha-256;atMpi56SZggc2yuwnSLFAerdQEolBwrnZyiEbitDchs
2025-04-03 09:20 UTCC-CDA downloadReport · Basic metabolic panel - Blood · Kestrel Harbor Hospital · received 2025-04-03 TurtleRevision · Basic metabolic panel - Blood · Kestrel Harbor Hospital · received 2025-04-03Report version · Basic metabolic panel - Blood · final · Kestrel Harbor Hospital · first received 2025-04-03
2025-04-20 08:15 UTCC-CDA downloadNote or document · Social history Narrative · Kestrel Harbor Hospital · received 2025-05-05 TurtleRevision · Social history Narrative · Kestrel Harbor Hospital · received 2025-04-20Note or document version · Social history Narrative · current · Kestrel Harbor Hospital · first received 2025-04-20
2025-04-20 08:15 UTCC-CDA downloadNote or document · Vital signs · Kestrel Harbor Hospital · received 2025-05-05 TurtleRevision · Vital signs · Kestrel Harbor Hospital · received 2025-04-20Note or document version · Vital signs · current · Kestrel Harbor Hospital · first received 2025-04-20
2025-05-05 17:45 UTCC-CDA downloadAllergy · Aspirin · Kestrel Harbor Hospital · received 2025-05-05 TurtleRevision · Aspirin · Kestrel Harbor Hospital · received 2025-05-05Allergy version · Aspirin · active · Kestrel Harbor Hospital · first received 2025-05-05
2025-05-05 17:45 UTCC-CDA downloadNote or document · Social history Narrative · Kestrel Harbor Hospital · received 2025-05-05 TurtleRevision · Social history Narrative · Kestrel Harbor Hospital · received 2025-05-05Note or document version · Social history Narrative · current · Kestrel Harbor Hospital · first received 2025-05-05
2025-05-05 17:45 UTCC-CDA downloadNote or document · Vital signs · Kestrel Harbor Hospital · received 2025-05-05 TurtleRevision · Vital signs · Kestrel Harbor Hospital · received 2025-05-05Note or document version · Vital signs · current · Kestrel Harbor Hospital · first received 2025-05-05
2025-05-20 18:50 UTCC-CDA downloadurn:uuid:24764251-def4-8920-b26d-fa30c1b72085 TurtleRevision · no name · Fernhill Family Clinic · received 2025-05-20ni:///sha-256;Q8K26Fv8fCB3U4nQLOAoEc8R9GhCPR1RKVXlG6dm8HA
2025-05-20 18:50 UTCC-CDA downloadAllergy · Aspirin · Fernhill Family Clinic · received 2025-05-20 TurtleRevision · Aspirin · Fernhill Family Clinic · received 2025-05-20Allergy version · Aspirin · active · Fernhill Family Clinic · first received 2025-05-20
2025-05-20 18:50 UTCC-CDA downloadCondition · Hay fever · Fernhill Family Clinic · received 2025-05-20 TurtleRevision · Hay fever · Fernhill Family Clinic · received 2025-05-20Condition version · Hay fever · active · Fernhill Family Clinic · first received 2025-05-20
2025-05-20 18:50 UTCC-CDA downloadImmunization · Influenza vaccine · Fernhill Family Clinic · received 2025-05-20 TurtleRevision · Influenza vaccine · Fernhill Family Clinic · received 2025-05-20Immunization version · Influenza vaccine · completed · Fernhill Family Clinic · first received 2025-05-20
2025-05-20 18:50 UTCC-CDA downloadMedication · Claritin 10 MG Oral Tablet · Fernhill Family Clinic · received 2025-05-20 TurtleRevision · Claritin 10 MG Oral Tablet · Fernhill Family Clinic · received 2025-05-20Medication version · Claritin 10 MG Oral Tablet · active · Fernhill Family Clinic · first received 2025-05-20
2025-05-20 18:50 UTCC-CDA downloadMedication · fluticasone propionate 50 MCG/ACTUAT Nasal Spray · Fernhill Family Clinic · received 2025-05-20 TurtleRevision · fluticasone propionate 50 MCG/ACTUAT Nasal Spray · Fernhill Family Clinic · received 2025-05-20Medication version · fluticasone propionate 50 MCG/ACTUAT Nasal Spray · active · Fernhill Family Clinic · first received 2025-05-20
2025-05-20 18:50 UTCC-CDA downloadNote or document · Social history Narrative · Fernhill Family Clinic · received 2025-08-12 TurtleRevision · Social history Narrative · Fernhill Family Clinic · received 2025-05-20Note or document version · Social history Narrative · current · Fernhill Family Clinic · first received 2025-05-20
2025-05-20 18:50 UTCC-CDA downloadNote or document · Vital signs · Fernhill Family Clinic · received 2025-08-12 TurtleRevision · Vital signs · Fernhill Family Clinic · received 2025-05-20Note or document version · Vital signs · current · Fernhill Family Clinic · first received 2025-05-20
2025-05-20 18:50 UTCC-CDA downloadPatient profile · Fernhill Family Clinic · first received 2025-05-20 TurtleRevision · no name · Fernhill Family Clinic · received 2025-05-20ni:///sha-256;lg8Tdche1wxgkXrGw0JgKHNju9Mi-Faoj6pfJGqboGY
2025-05-20 19:30 UTCentered by Priya in the Cascade appMedication · loratadine 10 MG Oral Tablet · own entry TurtleRevision · loratadine 10 MG Oral Tablet · own entry · received 2025-05-20Medication version · loratadine 10 MG Oral Tablet · active · own entry · first received 2025-05-20
2025-06-15 08:05 UTCApple Health exportLab result · Potassium · Kestrel Harbor Hospital · obs-potassium-20250610 TurtleRevision · Potassium · obs-potassium-20250610 · received 2025-06-15Lab result version · Potassium · final · obs-potassium-20250610 · first received 2025-06-15
2025-06-15 08:05 UTCApple Health exportMedication · amlodipine 5 MG Oral Tablet · Kestrel Harbor Hospital · medrx-amlodipine-1 TurtleRevision · amlodipine 5 MG Oral Tablet · medrx-amlodipine-1 · received 2025-06-15Medication version · amlodipine 5 MG Oral Tablet · active · medrx-amlodipine-1 · first received 2025-06-15
2025-08-12 19:05 UTCC-CDA downloadMedication · Claritin 10 MG Oral Tablet · Fernhill Family Clinic · received 2025-08-12 TurtleRevision · Claritin 10 MG Oral Tablet · Fernhill Family Clinic · received 2025-08-12Medication version · Claritin 10 MG Oral Tablet · active · Fernhill Family Clinic · first received 2025-08-12
2025-08-12 19:05 UTCC-CDA downloadMedication · fluticasone propionate 50 MCG/ACTUAT Nasal Spray · Fernhill Family Clinic · received 2025-08-12 TurtleRevision · fluticasone propionate 50 MCG/ACTUAT Nasal Spray · Fernhill Family Clinic · received 2025-08-12Medication version · fluticasone propionate 50 MCG/ACTUAT Nasal Spray · completed · Fernhill Family Clinic · first received 2025-08-12
2025-08-12 19:05 UTCC-CDA downloadNote or document · Social history Narrative · Fernhill Family Clinic · received 2025-08-12 TurtleRevision · Social history Narrative · Fernhill Family Clinic · received 2025-08-12Note or document version · Social history Narrative · current · Fernhill Family Clinic · first received 2025-08-12
2025-08-12 19:05 UTCC-CDA downloadNote or document · Vital signs · Fernhill Family Clinic · received 2025-08-12 TurtleRevision · Vital signs · Fernhill Family Clinic · received 2025-08-12Note or document version · Vital signs · current · Fernhill Family Clinic · first received 2025-08-12

35 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 -- priya-natarajan "pod/What each import brought in"

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

What each report says of a variant: none. The question

What was seen more than once

9 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.

9 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 -- priya-natarajan "pod/What was seen more than once"

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

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 -- priya-natarajan "pod/Which reference versions are current"

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