From 38a8bc11889e15c45ab01cf371a1010e9762a9a8 Mon Sep 17 00:00:00 2001 From: Christopher Yamas Date: Thu, 8 Jan 2026 11:23:47 -0500 Subject: [PATCH 1/5] Add device_status schema for tracking device availability --- spec/device_status.schema.json | 80 ++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 spec/device_status.schema.json diff --git a/spec/device_status.schema.json b/spec/device_status.schema.json new file mode 100644 index 00000000..9b7b0dc6 --- /dev/null +++ b/spec/device_status.schema.json @@ -0,0 +1,80 @@ +{ + "primaryKey": "device_status_id", + "missingValues": [ + "NA", + "NaN", + "" + ], + "fields": [ + { + "name": "device_status_id", + "type": "string", + "title": "Device status ID", + "description": "Unique identifier for this device status record.", + "constraints": { + "required": true, + "unique": true + } + }, + { + "name": "service_date", + "type": "date", + "title": "Service date", + "description": "Service date associated with this status record. Optional because device status may not align with transit service dates." + }, + { + "name": "record_timestamp", + "type": "datetime", + "title": "Record timestamp", + "description": "Timestamp when this status record was created in the system. May differ from status_change_timestamp if status changes are recorded retroactively.", + "constraints": { + "required": true + } + }, + { + "name": "status_change_timestamp", + "type": "datetime", + "title": "Status change timestamp", + "description": "Timestamp when the device status actually changed. This is the time the device went offline, came back online, or experienced the status change.", + "constraints": { + "required": true + } + }, + { + "name": "device_id", + "type": "string", + "title": "ID referencing devices.device_id", + "description": "Identifies the device. References the devices table.", + "constraints": { + "required": true + } + }, + { + "name": "status_type", + "type": "string", + "title": "Status type", + "description": "Type of device status. Examples: online, offline, maintenance, error, degraded. Agencies may define additional status types as needed.", + "constraints": { + "required": true + } + }, + { + "name": "status_reason", + "type": "string", + "title": "Status reason", + "description": "Optional reason or description for the status change. Examples: scheduled maintenance, power failure, communication error, sensor malfunction." + } + ], + "foreignReferences": [ + { + "fields": "device_id", + "reference": { + "resource": "devices", + "fields": "device_id" + } + } + ], + "name": "device_status.schema.json", + "description": "Records device operational status changes over time. This table tracks when devices (APCs, fare gates, AVL units, etc.) go offline, return to service, or experience errors. Enables data quality analysis by distinguishing between missing data due to device outages versus actual service patterns.", + "_table_type": "Event" +} From aac93048bc240aa83715959c5fdf06043873e1c4 Mon Sep 17 00:00:00 2001 From: Christopher Yamas Date: Thu, 8 Jan 2026 11:23:54 -0500 Subject: [PATCH 2/5] Add device_status to tides-table enum --- spec/tides-datapackage-profile.json | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/tides-datapackage-profile.json b/spec/tides-datapackage-profile.json index aa25313b..817d991c 100644 --- a/spec/tides-datapackage-profile.json +++ b/spec/tides-datapackage-profile.json @@ -293,6 +293,7 @@ }, "tides-table": { "enum": [ + "device_status", "devices", "fare_transactions", "operators", From 1a665f3ae1eb8626dca8e8d559b0fdf1f45e7aa3 Mon Sep 17 00:00:00 2001 From: Christopher Yamas Date: Thu, 8 Jan 2026 11:24:00 -0500 Subject: [PATCH 3/5] Add device_status resource to template datapackage --- samples/template/TIDES/datapackage.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/samples/template/TIDES/datapackage.json b/samples/template/TIDES/datapackage.json index 399cb82a..7d21737c 100644 --- a/samples/template/TIDES/datapackage.json +++ b/samples/template/TIDES/datapackage.json @@ -24,6 +24,20 @@ } ], "resources": [ + { + "name": "device_status", + "profile": "tabular-data-resource", + "path": "device_status.csv", + "schema": "https://raw.githubusercontent.com/TIDES-transit/TIDES/main/spec/device_status.schema.json", + "sources": [ + { + "title": "Where did data come from?", + "component": "Type of technology component, e.g. `Device monitoring system`", + "product": "Product used.", + "vendor": "Vendor selling product." + } + ] + }, { "name": "devices", "profile": "tabular-data-resource", From ea3c0da7ee1c60c2fbce7ac83ec351f53e222afb Mon Sep 17 00:00:00 2001 From: Christopher Yamas Date: Thu, 8 Jan 2026 11:24:06 -0500 Subject: [PATCH 4/5] Add device_status template CSV --- samples/template/TIDES/device_status.csv | 1 + 1 file changed, 1 insertion(+) create mode 100644 samples/template/TIDES/device_status.csv diff --git a/samples/template/TIDES/device_status.csv b/samples/template/TIDES/device_status.csv new file mode 100644 index 00000000..1645ea08 --- /dev/null +++ b/samples/template/TIDES/device_status.csv @@ -0,0 +1 @@ +device_status_id,service_date,record_timestamp,status_change_timestamp,device_id,status_type,status_reason From ee9de16a4b8ae4b619fd4cc8b580f5de1176dda1 Mon Sep 17 00:00:00 2001 From: Christopher Yamas Date: Thu, 8 Jan 2026 11:24:12 -0500 Subject: [PATCH 5/5] Document device_status table in CHANGELOG --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 610b96b5..167807d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- New `device_status` table for tracking device operational status changes over time ([#242](https://github.com/TIDES-transit/TIDES/issues/242)) + - Tracks when devices go offline, return to service, or experience errors + - Two timestamps: `record_timestamp` (when recorded) vs `status_change_timestamp` (when status actually changed) + - Supports data quality analysis by distinguishing missing data due to device outages from actual service patterns + ## [1.0] - 2025-12-23 ### Changed