Skip to content
Alpha: see what works today →
Menu

Named question about entry

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.

The query

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

Terms it reads

cascade:entryMember · cascade:leadMember · cascade:memberCurrentValues · cascade:paddedDateTime · cascade:referenceRangeHigh · cascade:referenceRangeLow · cascade:valuesOfMember · rdfs:label

Rules and decision notes that name it

Its rows on Alex Rivera's pod

The first 10 of 163 rows, as Alex Rivera's explorer shows them. Every row of every question is in answers.json.

entryviewfieldvaluefromlead
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlrdf:typecascade:AllergyOrIntolerance
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:allergenCodehttp://snomed.info/id/111088007Allergy · Latex · Meridian Health System · alg-latex-1true
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:allergenNameLatexAllergy · Latex · Meridian Health System · alg-latex-1true
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:allergyCategoryenvironmentAllergy · Latex · Meridian Health System · alg-latex-1true
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:allergyCriticalitylowAllergy · Latex · Meridian Health System · alg-latex-1true
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:clinicalStatusactiveAllergy · Latex · Meridian Health System · alg-latex-1true
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:entryMemberAllergy · Latex · Meridian Health System · alg-latex-1
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:leadMemberAllergy · Latex · Meridian Health System · alg-latex-1
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:reactionManifestationTextContact dermatitisAllergy · Latex · Meridian Health System · alg-latex-1true
Allergy entry · Latexhttps://pod.alex-rivera.example/clinical/allergies.ttlcascade:statusFromAllergy · Latex · Meridian Health System · alg-latex-1

queries/questions/entry/What it shows.rq on GitHub ↗