Skip to content
Alpha: see what works today →
Menu

Tamsin Vale

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.tamsin-vale.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

31 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/laboratory test result cascade:LaboratoryTestResult6
/clinical/patient profile cascade:PatientProfile1
/clinical/prescribed or reported medication cascade:PrescribedOrReportedMedication1
/clinical/view cascade:View4
/judgments/judgment cascade:Judgment1
/profile/Person prov:Person1
/profile/foaf:Person1
/provenance/documents/Entity prov:Entity2
/provenance/imports/Activity prov:Activity2
/provenance/imports/SoftwareAgent prov:SoftwareAgent1
/provenance/imports/document import cascade:DocumentImport2
/provenance/imports/snapshot cascade:Snapshot2
/records/lab-results/FragmentSelector oa:FragmentSelector6
/records/lab-results/laboratory test result cascade:LaboratoryTestResult6
/records/lab-results/revision cascade:Revision6
/records/lab-results/no type stated12
/records/medications/FragmentSelector oa:FragmentSelector2
/records/medications/prescribed or reported medication cascade:PrescribedOrReportedMedication1
/records/medications/revision cascade:Revision2
/records/medications/no type stated2
/records/patient-profile/FragmentSelector oa:FragmentSelector1
/records/patient-profile/patient profile cascade:PatientProfile1
/records/patient-profile/revision cascade:Revision1
/records/patient-profile/no type stated1
/records/servers/server cascade:Server1
/settings/pim:ConfigurationFile1
/settings/Type index solid:TypeIndex1
/settings/Type Registration solid:TypeRegistration4
/settings/solid:UnlistedDocument1
/subject/subject cascade:Subject1

31 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 -- tamsin-vale "pod/What each folder holds"

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

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

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

3 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 -- tamsin-vale "pod/Which view lists each kind"

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

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

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

22 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 -- tamsin-vale "pod/How many of each kind"

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

My active allergies: none. The question

My active conditions: none. The question

My active medications: none. The question

My condition history: none. The question

My genetic variants: none. The question

My immunizations: none. The question

My lab results

6 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-01-13 16:00 UTCHemoglobin A1cLOINC 4548-48.3%final1Lab result entry · Hemoglobin A1c · 2025-01-13T16:00:00Zurn:uuid:eb53fafc-8404-89f1-bdbd-9faf20e83c50 from ni:///sha-256;sJergYpzf8EdQsI-gZH51UyJ2ZozZTMcSoNFbqB8IZ4, retrieved 2025-02-01T00:00:00Z, written by Cascade North Demo Hospital
2024-10-14 16:00 UTCHemoglobin A1cLOINC 4548-47.9%final1Lab result entry · Hemoglobin A1c · 2024-10-14T16:00:00Zurn:uuid:bd584a6a-ea11-8a89-a98a-65728c5ebc37 from ni:///sha-256;sJergYpzf8EdQsI-gZH51UyJ2ZozZTMcSoNFbqB8IZ4, retrieved 2025-02-01T00:00:00Z, written by Cascade North Demo Hospital
2024-07-15 16:00 UTCHemoglobin A1cLOINC 4548-47.4%final1Lab result entry · Hemoglobin A1c · 2024-07-15T16:00:00Zurn:uuid:5c4afe5e-6d87-896e-926a-9ee8e22a3105 from ni:///sha-256;sJergYpzf8EdQsI-gZH51UyJ2ZozZTMcSoNFbqB8IZ4, retrieved 2025-02-01T00:00:00Z, written by Cascade North Demo Hospital
2024-01-15 16:00 UTCHemoglobin A1cLOINC 4548-46.7%final1Lab result entry · Hemoglobin A1c · 2024-01-15T16:00:00Zurn:uuid:58de1059-0d71-8244-9549-c4ef8b4c3146 from ni:///sha-256;fIOEvoik2VN5L4Ht1B-w2YxZBRR0tkCbId2CgXxeMCk, retrieved 2024-02-01T00:00:00Z, written by Cascade North Demo Hospital
2023-10-09 16:00 UTCHemoglobin A1cLOINC 4548-46.5%final1Lab result entry · Hemoglobin A1c · 2023-10-09T16:00:00Zurn:uuid:24951dba-839b-8298-b1ac-a8961e784267 from ni:///sha-256;fIOEvoik2VN5L4Ht1B-w2YxZBRR0tkCbId2CgXxeMCk, retrieved 2024-02-01T00:00:00Z, written by Cascade North Demo Hospital
2023-07-10 16:00 UTCHemoglobin A1cLOINC 4548-46.6%final1Lab result entry · Hemoglobin A1c · 2023-07-10T16:00:00Zurn:uuid:f022b622-485c-8253-8d3f-766b1d871c5a from ni:///sha-256;fIOEvoik2VN5L4Ht1B-w2YxZBRR0tkCbId2CgXxeMCk, retrieved 2024-02-01T00:00:00Z, written by Cascade North Demo Hospital

6 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 -- tamsin-vale "pod/My lab results"

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

My medication history

1 row

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
Metformin 500 mg tabletRxNorm 861007completedcascade:MedicationStopped2022-03-012024-04-15urn:uuid:eb3a91fc-6f47-8b0e-9803-2452e8d034ce completed, ended 2024-04-151Medication entry · Metformin 500 mg tablet · 2022-03-01urn:uuid:eb3a91fc-6f47-8b0e-9803-2452e8d034ce from ni:///sha-256;sJergYpzf8EdQsI-gZH51UyJ2ZozZTMcSoNFbqB8IZ4, retrieved 2025-02-01T00:00:00Z, written by Cascade North Demo Hospital

1 row

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 -- tamsin-vale "pod/My medication history"

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

My procedures: none. The question

My reports, notes and documents: none. The question

The person this pod is about

1 row

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

?subject?dateOfBirth?administrativeGender?deceased?dateOfDeath?sources
The person this pod is abouturn:uuid:04cd6e3f-922b-8f2d-ad65-81a0a7842efc 1957-09-30urn:uuid:04cd6e3f-922b-8f2d-ad65-81a0a7842efc femaleurn:uuid:04cd6e3f-922b-8f2d-ad65-81a0a7842efc from ni:///sha-256;fIOEvoik2VN5L4Ht1B-w2YxZBRR0tkCbId2CgXxeMCk, retrieved 2024-02-01T00:00:00Z, written by Cascade North Demo Hospital

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

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

What each import brought in

9 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
2024-02-01 09:05 UTCFHIR pullLab result · Hemoglobin A1c · Cascade North Demo Hospital · received 2024-02-01 TurtleRevision · Hemoglobin A1c · Cascade North Demo Hospital · received 2024-02-01Lab result version · Hemoglobin A1c · final · Cascade North Demo Hospital · first received 2024-02-01
2024-02-01 09:05 UTCFHIR pullLab result · Hemoglobin A1c · Cascade North Demo Hospital · received 2024-02-01 TurtleRevision · Hemoglobin A1c · Cascade North Demo Hospital · received 2024-02-01Lab result version · Hemoglobin A1c · final · Cascade North Demo Hospital · first received 2024-02-01
2024-02-01 09:05 UTCFHIR pullLab result · Hemoglobin A1c · Cascade North Demo Hospital · received 2024-02-01 TurtleRevision · Hemoglobin A1c · Cascade North Demo Hospital · received 2024-02-01Lab result version · Hemoglobin A1c · final · Cascade North Demo Hospital · first received 2024-02-01
2024-02-01 09:05 UTCFHIR pullMedication · Metformin 500 mg tablet · Cascade North Demo Hospital · received 2025-02-01 TurtleRevision · Metformin 500 mg tablet · Cascade North Demo Hospital · received 2024-02-01Medication version · Metformin 500 mg tablet · active · Cascade North Demo Hospital · first received 2024-02-01
2024-02-01 09:05 UTCFHIR pullPatient profile · Cascade North Demo Hospital · first received 2024-02-01 TurtleRevision · no name · Cascade North Demo Hospital · received 2024-02-01ni:///sha-256;Jvo2YDXR2A2XkAAlj5mbLQPqPVLSmVrTyjfx6bUxucI
2025-02-01 09:05 UTCFHIR pullLab result · Hemoglobin A1c · Cascade North Demo Hospital · received 2025-02-01 TurtleRevision · Hemoglobin A1c · Cascade North Demo Hospital · received 2025-02-01Lab result version · Hemoglobin A1c · final · Cascade North Demo Hospital · first received 2025-02-01
2025-02-01 09:05 UTCFHIR pullLab result · Hemoglobin A1c · Cascade North Demo Hospital · received 2025-02-01 TurtleRevision · Hemoglobin A1c · Cascade North Demo Hospital · received 2025-02-01Lab result version · Hemoglobin A1c · final · Cascade North Demo Hospital · first received 2025-02-01
2025-02-01 09:05 UTCFHIR pullLab result · Hemoglobin A1c · Cascade North Demo Hospital · received 2025-02-01 TurtleRevision · Hemoglobin A1c · Cascade North Demo Hospital · received 2025-02-01Lab result version · Hemoglobin A1c · final · Cascade North Demo Hospital · first received 2025-02-01
2025-02-01 09:05 UTCFHIR pullMedication · Metformin 500 mg tablet · Cascade North Demo Hospital · received 2025-02-01 TurtleRevision · Metformin 500 mg tablet · Cascade North Demo Hospital · received 2025-02-01Medication version · Metformin 500 mg tablet · completed · Cascade North Demo Hospital · first received 2025-02-01

9 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 -- tamsin-vale "pod/What each import brought in"

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

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

What was seen more than once: none. The question

Which files are out of place: none. The question

Which reference versions are current: none. The question