diff --git a/shapes/health_measurement.ttl b/shapes/health_measurement.ttl new file mode 100644 index 0000000..4a16a09 --- /dev/null +++ b/shapes/health_measurement.ttl @@ -0,0 +1,112 @@ +@prefix dc: . +@prefix dct: . +@prefix prov: . +@prefix schema: . +@prefix sh: . +@prefix vs: . +@prefix xsd: . + +@prefix health_measurement_shape: . + +health_measurement_shape:HealthMeasurementShape + a sh:NodeShape ; + sh:targetClass schema:Observation ; + sh:name "Health Measurement Shape" ; + sh:description "SHACL shape for a single health or fitness measurement modelled as a Schema.org Observation. The intended representation for the common cases consumer health and fitness exports (Apple Health, Google Fit, Strava) describe — heart rate, steps, sleep duration, body weight, distance, exercise duration, and energy burned. Note: schema:Observation and the schema:observation* properties currently sit in the pending area of Schema.org (https://pending.schema.org/); native exporters typically emit proprietary formats and an importer is expected to map them to this shape." ; + dct:created "2026-04-23"^^xsd:date ; + vs:term_status "testing" ; + dc:source ; + prov:wasDerivedFrom ; + dct:references ; # references the schema:Observation class (currently in https://pending.schema.org/) which the Schema.org Health-Lifesci extension and broader Schema.org community use to describe a single point measurement, together with schema:value, schema:unitCode, schema:observationDate, schema:observationAbout, and schema:measuredProperty. + dct:references ; # references the Schema.org Health-Lifesci hosted extension which defines health-specific vocabulary (e.g. schema:ExerciseAction usage, body-weight terms) reused alongside the core Observation pattern. + dct:references ; # references HL7 FHIR Observation as a heavier-duty alternative model used by clinical systems; this shape does not depend on FHIR but acknowledges the conceptual mapping. + sh:codeIdentifier "HealthMeasurement"; + + # Numeric value of the measurement. Accepts the common XSD numeric + # datatypes since SHACL sh:datatype matches exactly (no XSD subtype + # widening), and exporters emit any of decimal, integer, double, or + # float depending on the metric. + sh:property [ + sh:path schema:value ; + sh:or ( + [ sh:datatype xsd:decimal ] + [ sh:datatype xsd:integer ] + [ sh:datatype xsd:double ] + [ sh:datatype xsd:float ] + ) ; + sh:maxCount 1 ; + sh:name "Value" ; + sh:description "Numeric value of the measurement (e.g., 72 for a heart-rate reading, 8500 for a step count, 5.2 for a kilometre distance). May be xsd:decimal, xsd:integer, xsd:double, or xsd:float." ; + sh:codeIdentifier "value"; + ] ; + + # Unit of measurement. Per Schema.org, schema:unitCode is Text or URL, + # so accept any IRI or literal (including language-tagged strings). + sh:property [ + sh:path schema:unitCode ; + sh:nodeKind sh:IRIOrLiteral ; + sh:maxCount 1 ; + sh:name "Unit Code" ; + sh:description "Unit of measurement, given as a UN/CEFACT Common Code 3-character string (e.g. \"BPM\" for beats per minute, \"KGM\" for kilograms, \"KMT\" for kilometres) or a URL such as a QUDT unit IRI." ; + sh:codeIdentifier "unitCode"; + ] ; + + # Optional human-readable unit text (Schema.org provides schema:unitText). + sh:property [ + sh:path schema:unitText ; + sh:datatype xsd:string ; + sh:maxCount 1 ; + sh:name "Unit Text" ; + sh:description "Optional human-readable string for the unit of measurement, used when no UN/CEFACT or URL code is available (e.g. \"steps\", \"hours\")." ; + sh:codeIdentifier "unitText"; + ] ; + + # Date or date-time at which the observation was made. Schema.org's + # observationDate range is Date or DateTime; daily metrics (e.g. weight, + # daily step total) are typically stored at date granularity. + sh:property [ + sh:path schema:observationDate ; + sh:or ( + [ sh:datatype xsd:dateTime ] + [ sh:datatype xsd:date ] + ) ; + sh:maxCount 1 ; + sh:name "Observation Date" ; + sh:description "Date or date-time at which the measurement was taken (Schema.org schema:observationDate). Use xsd:dateTime for instantaneous readings (heart rate, exercise samples) and xsd:date for daily aggregates." ; + sh:codeIdentifier "observationDate"; + ] ; + + # The entity the observation is about. For self-reported health and + # fitness data this is the user's WebID. + sh:property [ + sh:path schema:observationAbout ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + sh:name "Observation About" ; + sh:description "The entity the observation is about. For personal health and fitness data this is typically the user's WebID (Schema.org schema:observationAbout)." ; + sh:codeIdentifier "observationAbout"; + ] ; + + # What property is being measured. Left open to any IRI so that apps can + # use either Schema.org properties (e.g. schema:weight) or vocabulary from + # other systems (HL7 FHIR, LOINC, QUDT, Wikidata, Data Commons). + sh:property [ + sh:path schema:measuredProperty ; + sh:nodeKind sh:IRI ; + sh:maxCount 1 ; + sh:name "Measured Property" ; + sh:description "The property being measured, identified by IRI. Apps may use Schema.org properties (e.g. schema:weight), Health-Lifesci terms, or external vocabularies such as HL7 FHIR, LOINC, or QUDT (Schema.org schema:measuredProperty)." ; + sh:codeIdentifier "measuredProperty"; + ] ; + + # Optional method/device used to capture the measurement (e.g. a smart + # watch, a manual entry, an exercise activity). May be an IRI (device or + # enumeration value) or a literal label. + sh:property [ + sh:path schema:measurementMethod ; + sh:nodeKind sh:IRIOrLiteral ; + sh:maxCount 1 ; + sh:name "Measurement Method" ; + sh:description "Method or device used to capture the measurement (Schema.org schema:measurementMethod). May be an IRI to a device or enumeration value, or a literal label." ; + sh:codeIdentifier "measurementMethod"; + ] .