Skip to content
Alpha: see what works today →
Menu

View

clinical/patient-profile.ttl

https://pod.alex-rivera.example/clinical/patient-profile.ttl

A view is a file the build writes. An app reads it to show a list, and never needs to know about records, revisions or judgments. Nobody edits a view: delete it and the build writes the same file again from the pod's records and judgments. Below are the files that state it, the query that wrote it, and every entry it lists.

The rules of the spec that name this view: A15. The build writes a view once the pod holds a record of its kind, and at every build after.

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
settings/privateTypeIndex.ttltruefalse
clinical/patient-profile.ttl pagefalsetrue

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 -- alex-rivera "pod/Which file states each thing"

It prints the rows for every thing; this block keeps those whose ?thing is https://pod.alex-rivera.example/clinical/patient-profile.ttl.

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

patient-profile

One entry for the person, joining every patient profile a counting About judgment ties to them and no counting NotAbout over it for them outranks, named as every entry is, from its least member. Profiles are joined by About, not by Same, so the entry has no lead and states no value of its own: each profile's current values are a node of the view of their own, named after the entry and the profile, which says the profile they came from, so each source's date of birth, gender and death stand beside the others'.

It wrote clinical/patient-profile.ttl, 7 statements, after the derivations of the everyday lens had run.

The query: queries/views/patient-profile.rq on GitHub
PREFIX cascade: <https://ns.cascadeprotocol.org/cascade#>
PREFIX pav: <http://purl.org/pav/>
PREFIX prov: <http://www.w3.org/ns/prov#>

CONSTRUCT {
  ?entry a cascade:PatientProfile ;
    cascade:entryMember ?profile .
  ?entry cascade:memberCurrentValues ?memberValues .
  ?memberValues cascade:valuesOfMember ?profile ;
    cascade:dateOfBirth ?memberDateOfBirth ;
    cascade:administrativeGender ?memberAdministrativeGender ;
    cascade:deceased ?memberDeceased ;
    cascade:dateOfDeath ?memberDateOfDeath .
}
WHERE {
  { SELECT ?s (IRI(CONCAT("urn:cascade:entry:", SHA256(MIN(STR(?member))))) AS ?entry)
    WHERE { ?about cascade:countsUnderLens true ; cascade:verdict cascade:About ; prov:hadMember ?member ;
                   cascade:subject ?s .
            MINUS { ?denial cascade:countsUnderLens true ; cascade:verdict cascade:NotAbout ; prov:hadMember ?member ;
                            cascade:subject ?s . } }
    GROUP BY ?s }
  ?j cascade:countsUnderLens true ; cascade:verdict cascade:About ; prov:hadMember ?profile ; cascade:subject ?s .
  MINUS { ?notAbout cascade:countsUnderLens true ; cascade:verdict cascade:NotAbout ; prov:hadMember ?profile ;
                    cascade:subject ?s . }
  OPTIONAL { ?profile pav:hasCurrentVersion ?memberVersion .
             OPTIONAL { ?memberVersion cascade:dateOfBirth ?memberDateOfBirth }
             OPTIONAL { ?memberVersion cascade:administrativeGender ?memberAdministrativeGender }
             OPTIONAL { ?memberVersion cascade:deceased ?memberDeceased }
             OPTIONAL { ?memberVersion cascade:dateOfDeath ?memberDateOfDeath } }
  BIND (IF(BOUND(?memberVersion), IRI(CONCAT(STR(?entry), "-", SHA256(STR(?profile)))), 1/0) AS ?memberValues)
}

The terms it uses: cascade:PatientProfile, cascade:entryMember, cascade:memberCurrentValues, cascade:valuesOfMember, cascade:dateOfBirth, cascade:administrativeGender, cascade:deceased, cascade:dateOfDeath, cascade:countsUnderLens, cascade:verdict, cascade:About, prov:hadMember, cascade:subject, cascade:NotAbout, pav:hasCurrentVersion.

Which view lists each kind

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.

Only the rows whose ?view is this one.

?title?type?entries
Patient profilepatient profile cascade:PatientProfile1

1 row

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 -- alex-rivera "pod/Which view lists each kind"

It prints the rows for every view; this block keeps those whose ?view is https://pod.alex-rivera.example/clinical/patient-profile.ttl.

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

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 ?view is this one.

4 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 -- alex-rivera "entry/What it shows"

It prints the rows for every view; this block keeps those whose ?view is https://pod.alex-rivera.example/clinical/patient-profile.ttl.

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