Skip to content
Alpha: see what works today →
Menu

Entry

Immunization entry · Influenza vaccine · 2024-10-15

https://pod.priya-natarajan.example/clinical/immunizations.ttl#31dd82ce339cf1bdbbe6665d8a4611bf5a728915cf5b353418c39fc39171abfe

An entry is what an app shows: one allergy, one condition, one vaccination. The build makes it in a view by joining the records judged to be the same thing, and takes each of its values from one of them. Follow a member to see where it came from.

Every section below is one question with only the rows about this entry. The first lists the files of the pod that say something about it or name it. A Turtle link beside a thing opens the file it arrived in; a thing only ever named, or written by the build, has none.

Which file states each thing

The store loads each file twice: into the default graph, which the other questions read, and into a graph named by its address, which GRAPH ?file reads. A file states a thing when it says something about it, or names it as the value of a statement: a patient profile has no file of its own, so the files that name it are where it is stated. Named marks a row for a file that names the thing, and rebuilt a view or the labels, which the build writes. Files the build did not write come first, and among them the file a thing arrived in, if it has one.

Only the rows whose ?thing is this one.

?file?named?rebuilt
clinical/immunizations.ttl pagefalsetrue
clinical/labels.ttlfalsetrue

2 rows

The query: queries/questions/pod/Which file states each thing.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pim: <http://www.w3.org/ns/pim/space#>

SELECT DISTINCT ?thing ?file ?named ?rebuilt
WHERE {
  { { SELECT DISTINCT ?file ?thing
      WHERE {
        ?owner pim:storage ?root .
        GRAPH ?file { ?thing ?property ?value }
        FILTER (isIRI(?thing) && STRSTARTS(STR(?file), STR(?root)))
      } }
    BIND (false AS ?named)
    BIND (EXISTS { ?file a cascade:View } AS ?rebuilt) }
  UNION
  { { SELECT DISTINCT ?file ?thing
      WHERE {
        ?owner pim:storage ?root .
        GRAPH ?file { ?subject ?property ?thing }
        FILTER (isIRI(?thing) && STRSTARTS(STR(?file), STR(?root)))
      } }
    BIND (true AS ?named)
    BIND (EXISTS { ?file a cascade:View } AS ?rebuilt) }
}
ORDER BY ?thing ?rebuilt ?named ?file

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

Run it yourself, from the runtime's root:

npm run ask -- priya-natarajan "pod/Which file states each thing"

It prints the rows for every thing; this block keeps those whose ?thing is https://pod.priya-natarajan.example/clinical/immunizations.ttl#31dd82ce339cf1bdbbe6665d8a4611bf5a728915cf5b353418c39fc39171abfe.

Or in GraphDB, open the saved query pod/Which file states each thing in the repository priya-natarajan.

What it shows

What each entry shows: every value its view states of it and every value its members' current versions state of the fields the view shows, each with From, the member whose current version states it, and Lead, whether that member is the entry's lead (cascade:leadMember), whose values come first. An entry is what an app shows: one allergy, one condition, one vaccination; no merged record is stored, so the view holds each member's current values as a node of its own (cascade:memberCurrentValues) and this reads the view alone. The view takes the entry's name and codes from its lead, and its status and dates from the members the derivations chose for them (cascade:statusFrom, cascade:dateFrom and, for a medication, cascade:medicationUseStartDateFrom, cascade:prescriptionWrittenDateFrom and cascade:dosageFrom, and for an allergy cascade:allergyCategoryFrom and cascade:onsetDateFrom). A value no member states, such as the highest criticality among them, has no From. A padded time is shown as the time, and a reference range as its text, its bounds being nodes of the view of their own; the node saying a time was written short of the second is no value of its own.

Only the rows whose ?entry is this one.

8 rows

The query: queries/questions/entry/What it shows.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?entry ?entryLabel ?view ?field ?value ?valueLabel ?from ?fromLabel ?lead
WHERE {
  { GRAPH ?view { ?entry cascade:entryMember [] ; cascade:leadMember ?leader ; cascade:memberCurrentValues ?values .
                  ?values cascade:valuesOfMember ?from ; ?field ?value .
                  FILTER (?field NOT IN (cascade:valuesOfMember, cascade:paddedDateTime, cascade:referenceRangeLow, cascade:referenceRangeHigh)) }
    BIND (?from = ?leader AS ?lead)
    OPTIONAL { ?from rdfs:label ?fromLabel }
    OPTIONAL { ?entry rdfs:label ?entryLabel }
    OPTIONAL { ?value rdfs:label ?valueLabel } }
  UNION
  { GRAPH ?view { ?entry cascade:entryMember [] ; ?field ?value
                  FILTER (?field NOT IN (cascade:memberCurrentValues, cascade:paddedDateTime, cascade:referenceRangeLow, cascade:referenceRangeHigh))
                  FILTER NOT EXISTS { ?entry cascade:memberCurrentValues ?held . ?held ?field ?value } }
    OPTIONAL { ?entry rdfs:label ?entryLabel }
    OPTIONAL { ?value rdfs:label ?valueLabel } }
}
ORDER BY ?entryLabel ?entry ?field DESC(?lead) STR(?value) ?from

The terms it uses: cascade:entryMember, cascade:leadMember, cascade:memberCurrentValues, cascade:valuesOfMember, cascade:paddedDateTime, cascade:referenceRangeLow, cascade:referenceRangeHigh, rdfs:label.

Run it yourself, from the runtime's root:

npm run ask -- priya-natarajan "entry/What it shows"

It prints the rows for every entry; this block keeps those whose ?entry is https://pod.priya-natarajan.example/clinical/immunizations.ttl#31dd82ce339cf1bdbbe6665d8a4611bf5a728915cf5b353418c39fc39171abfe.

Or in GraphDB, open the saved query entry/What it shows in the repository priya-natarajan.

What needs review: none. The question

Where it came from

For each member of an entry: when its current revision arrived, the import that brought it, and the document it was derived from, with each hospital that wrote or keeps that document and when it was retrieved. A record the person entered has no document.

Only the rows whose ?entry is this one.

?record?arrived?import?document?hospital?retrieved
Immunization · Influenza vaccine · Fernhill Family Clinic · received 2025-05-20 Turtle2025-05-20 18:50 UTCC-CDA downloadDocument · Fernhill Family Clinic TurtleFernhill Family Clinic

1 row

The query: queries/questions/entry/Where it came from.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 ?entry ?entryLabel ?record ?recordLabel ?arrived ?import ?importLabel ?document ?documentLabel ?hospital ?retrieved
WHERE {
  ?record ^cascade:entryMember ?entry ; cascade:currentRevision ?revision .
  ?revision prov:generatedAtTime ?arrived .
  OPTIONAL { ?entry rdfs:label ?entryLabel }
  OPTIONAL { ?record rdfs:label ?recordLabel }
  OPTIONAL { ?revision prov:wasGeneratedBy ?import .
             OPTIONAL { ?import rdfs:label ?importLabel } }
  OPTIONAL { ?revision prov:wasDerivedFrom ?document .
             OPTIONAL { ?document rdfs:label ?documentLabel }
             OPTIONAL { ?document pav:retrievedOn ?retrieved }
             OPTIONAL { ?document prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?hospital } }
}
ORDER BY ?entryLabel ?entry ?arrived ?recordLabel ?record ?document ?hospital ?retrieved

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

Run it yourself, from the runtime's root:

npm run ask -- priya-natarajan "entry/Where it came from"

It prints the rows for every entry; this block keeps those whose ?entry is https://pod.priya-natarajan.example/clinical/immunizations.ttl#31dd82ce339cf1bdbbe6665d8a4611bf5a728915cf5b353418c39fc39171abfe.

Or in GraphDB, open the saved query entry/Where it came from in the repository priya-natarajan.