Skip to content
Alpha: see what works today →
Menu

Named question about record

Its revisions, in the order they arrived

A revision is one arrival: it carries a version, which is the content, and names the document it was derived from. A version seen before is named again, not copied, and Current marks the revision the views read. ?arrived is the pod's clock; ?observed is when the source was observed saying the revision's state, and ?changed the source's own change time, the two clocks the ladder ranks by; a pull's document says the instant its source answered as of (?answeredAsOf).

The query

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 ?record ?recordLabel ?arrived ?observed ?changed ?revision ?revisionLabel ?current ?previous ?previousLabel
       ?version ?versionLabel ?change ?document ?documentLabel ?retrieved ?answeredAsOf ?hospital ?transmitter ?import
       ?importLabel ?started
WHERE {
  { SELECT ?version (MIN(?received) AS ?first)
    WHERE { ?any cascade:version ?version ; prov:generatedAtTime ?received . }
    GROUP BY ?version }
  ?revision cascade:revisionOf ?record ; cascade:version ?version ; prov:generatedAtTime ?arrived .
  OPTIONAL { ?record cascade:currentRevision ?now }
  BIND (COALESCE(?revision = ?now, false) AS ?current)
  BIND (IF(?arrived = ?first, "a new version", "an earlier version again") AS ?change)
  OPTIONAL { ?revision cascade:observedAsOf ?observed }
  OPTIONAL { ?revision pav:lastUpdateOn ?changed }
  OPTIONAL { ?revision rdfs:label ?revisionLabel }
  OPTIONAL { ?record rdfs:label ?recordLabel }
  OPTIONAL { ?version rdfs:label ?versionLabel }
  OPTIONAL { ?revision prov:wasRevisionOf ?previous .
             OPTIONAL { ?previous rdfs:label ?previousLabel } }
  OPTIONAL { ?revision prov:wasDerivedFrom ?document .
             OPTIONAL { ?document rdfs:label ?documentLabel }
             OPTIONAL { ?document pav:retrievedOn ?retrieved }
             OPTIONAL { ?document cascade:answeredAsOf ?answeredAsOf }
             OPTIONAL { ?document prov:wasAttributedTo/(rdfs:label|pav:hasCurrentVersion/foaf:name) ?hospital }
             OPTIONAL { ?document prov:wasGeneratedBy/prov:qualifiedAssociation ?sender .
                        ?sender prov:hadRole ?transmitterRole ; prov:agent/rdfs:label ?transmitter
                        FILTER (?transmitterRole = cascade:TransmitterRole) } }
  OPTIONAL { ?revision prov:wasGeneratedBy ?import .
             OPTIONAL { ?import rdfs:label ?importLabel }
             OPTIONAL { ?import prov:startedAtTime ?started } }
}
ORDER BY ?recordLabel ?record ?arrived ?revision ?document ?retrieved ?answeredAsOf ?hospital ?transmitter

Terms it reads

cascade:TransmitterRole · cascade:answeredAsOf · cascade:currentRevision · cascade:observedAsOf · cascade:revisionOf · cascade:version · pav:hasCurrentVersion · pav:lastUpdateOn · pav:retrievedOn · prov:agent · prov:generatedAtTime · prov:hadRole · prov:startedAtTime · prov:wasAttributedTo · prov:wasDerivedFrom · prov:wasGeneratedBy · prov:wasRevisionOf · rdfs:label

Rules and decision notes that name it

No rule or decision note writes its path.

Its rows on Alex Rivera's pod

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

recordarrivedobservedchangedrevisioncurrentversionchangedocumentretrievedhospitaltransmitterimportstartedprevious
Allergy · Amoxicillin · Meridian Health System · alg-amox-22027-02-10T17:21:00Z2027-02-10T17:19:00Z2027-01-28T16:00:00ZRevision · Amoxicillin · alg-amox-2 · received 2027-02-10trueAllergy version · Amoxicillin · active · alg-amox-2 · first received 2027-02-10a new versionDocument · Meridian Health System · AllergyIntolerance/alg-amox-2 · retrieved 2027-02-102027-02-10T17:19:00ZMeridian Health SystemApple HealthApple Health export2027-02-10T17:21:00Z
Allergy · Codeine · Meridian Health System · alg-codeine-12026-09-01T10:00:04Z2026-09-01T10:00:00Z2026-04-08T13:05:00ZRevision · Codeine · alg-codeine-1 · received 2026-09-01falseAllergy version · Codeine · active · alg-codeine-1 · first received 2026-09-01a new versionDocument · Meridian Health System · AllergyIntolerance/alg-codeine-1 · retrieved 2026-09-012026-09-01T10:00:00ZMeridian Health SystemApple HealthApple Health export2026-09-01T10:00:04Z
Allergy · Codeine · Meridian Health System · alg-codeine-12026-11-20T09:00:04Z2026-11-20T09:00:00Z2026-11-18T09:45:00ZRevision · Codeine · alg-codeine-1 · received 2026-11-20trueAllergy version · Codeine · entered-in-error · alg-codeine-1 · first received 2026-11-20a new versionDocument · Meridian Health System · AllergyIntolerance/alg-codeine-1 · retrieved 2026-11-202026-11-20T09:00:00ZMeridian Health SystemApple HealthApple Health export2026-11-20T09:00:04ZRevision · Codeine · alg-codeine-1 · received 2026-09-01
Allergy · Latex · Meridian Health System · alg-latex-12026-09-01T10:00:04Z2026-09-01T10:00:00Z2026-07-21T10:15:00ZRevision · Latex · alg-latex-1 · received 2026-09-01falseAllergy version · Latex · active · alg-latex-1 · first received 2026-09-01a new versionDocument · Meridian Health System · AllergyIntolerance/alg-latex-1 · retrieved 2026-09-012026-09-01T10:00:00ZMeridian Health SystemApple HealthApple Health export2026-09-01T10:00:04Z
Allergy · Latex · Meridian Health System · alg-latex-12026-11-20T09:00:04Z2026-11-20T09:00:00Z2026-11-18T09:40:00ZRevision · Latex · alg-latex-1 · received 2026-11-20trueAllergy version · Latex · active · alg-latex-1 · first received 2026-11-20a new versionDocument · Meridian Health System · AllergyIntolerance/alg-latex-1 · retrieved 2026-11-202026-11-20T09:00:00ZMeridian Health SystemApple HealthApple Health export2026-11-20T09:00:04ZRevision · Latex · alg-latex-1 · received 2026-09-01
Allergy · Peanuts · own entry2026-09-01T18:30:00Z2026-09-01T18:30:00ZRevision · Peanuts · own entry · received 2026-09-01trueAllergy version · Peanuts · criticality high · own entry · first received 2026-09-01a new versionentered by Alex in the Cascade app2026-09-01T18:30:00Z
Allergy · Penicillin G · Meridian Health System · alg-pcn-12026-09-01T10:00:04Z2026-09-01T10:00:00Z2026-02-10T12:00:00ZRevision · Penicillin G · alg-pcn-1 · received 2026-09-01trueAllergy version · Penicillin G · active · alg-pcn-1 · first received 2026-09-01a new versionDocument · Meridian Health System · AllergyIntolerance/alg-pcn-1 · retrieved 2026-09-012026-09-01T10:00:00ZMeridian Health SystemApple HealthApple Health export2026-09-01T10:00:04Z
Allergy · Penicillin · Larkspur Valley Health · al-82374612026-10-14T15:42:00Z2026-10-14T15:40:00Z2026-08-20T08:00:00ZRevision · Penicillin · al-8237461 · received 2026-10-14trueAllergy version · Penicillin · active · al-8237461 · first received 2026-10-14a new versionDocument · Larkspur Valley Health · AllergyIntolerance/al-8237461 · retrieved 2026-10-142026-10-14T15:40:00ZLarkspur Valley HealthApple HealthApple Health export2026-10-14T15:42:00Z
Allergy · Penicillin · Larkspur Valley Health · lv-alg-1012027-03-18T12:00:04Z2027-03-18T12:00:00Z2027-03-01T00:00:00ZRevision · Penicillin · lv-alg-101 · received 2027-03-18trueAllergy version · Penicillin · active · lv-alg-101 · first received 2027-03-18a new versionDocument · Larkspur Valley Health · AllergyIntolerance/lv-alg-101 · retrieved 2027-03-182027-03-18T12:00:00ZLarkspur Valley HealthApple HealthApple Health export2027-03-18T12:00:04Z
Allergy · Sulfamethoxazole · Larkspur Valley Health · al-82374622026-10-14T15:42:00Z2026-10-14T15:40:00Z2026-08-20T08:00:00ZRevision · Sulfamethoxazole · al-8237462 · received 2026-10-14trueAllergy version · Sulfamethoxazole · active · al-8237462 · first received 2026-10-14a new versionDocument · Larkspur Valley Health · AllergyIntolerance/al-8237462 · retrieved 2026-10-142026-10-14T15:40:00ZLarkspur Valley HealthApple HealthApple Health export2026-10-14T15:42:00Z

queries/questions/record/Its revisions, in the order they arrived.rq on GitHub ↗