From 3beda3d8908e9c312363abcf7dd66c2c30e1d7e7 Mon Sep 17 00:00:00 2001 From: ingalls Date: Wed, 6 Dec 2023 09:10:10 -0700 Subject: [PATCH] Update CHANGELOG --- CHANGELOG.md | 4 ++++ package-lock.json | 26 +++++++++++++++++++++++--- package.json | 3 ++- task.js | 31 ++++++++++++++++++++++--------- 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 896fca9..8ca1efd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ ## Version History +### v2.3.0 + +- :rocket: Add denver timezone & add explicit fields + ### v2.2.0 - :bug: remove status property diff --git a/package-lock.json b/package-lock.json index 3627d50..3d620ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "coe-cotrip-incidents", - "version": "2.0.1", + "version": "2.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coe-cotrip-incidents", - "version": "2.0.1", + "version": "2.2.0", "license": "ISC", "dependencies": { - "@tak-ps/etl": "^2.0.1" + "@tak-ps/etl": "^2.0.1", + "moment-timezone": "^0.5.43" }, "devDependencies": { "eslint": "^8.31.0", @@ -1030,6 +1031,25 @@ "node": "*" } }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "engines": { + "node": "*" + } + }, + "node_modules/moment-timezone": { + "version": "0.5.43", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.43.tgz", + "integrity": "sha512-72j3aNyuIsDxdF1i7CEgV2FfxM1r6aaqJyLB2vwb33mXYyoyLly+F1zbWqhA3/bVIoJ4szlUoMbUnVdid32NUQ==", + "dependencies": { + "moment": "^2.29.4" + }, + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/package.json b/package.json index fef502e..37d06c5 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "eslint-plugin-node": "^11.1.0" }, "dependencies": { - "@tak-ps/etl": "^2.0.1" + "@tak-ps/etl": "^2.0.1", + "moment-timezone": "^0.5.43" } } diff --git a/task.js b/task.js index bf87276..5a19180 100644 --- a/task.js +++ b/task.js @@ -1,5 +1,6 @@ import fs from 'fs'; import ETL from '@tak-ps/etl'; +import moment from 'moment-timezone'; try { const dotfile = new URL('.env', import.meta.url); @@ -50,6 +51,12 @@ export default class Task extends ETL { incident_type: { type: 'string' }, + incident_status: { + type: 'string' + }, + startTime: { + type: 'string' + }, lastUpdated: { type: 'string' }, @@ -85,14 +92,20 @@ export default class Task extends ETL { const features = []; for (const feature of incidents.map((incident) => { - incident.id = incident.properties.id; - incident.properties.remarks = incident.properties.travelerInformationMessage; - incident.properties.callsign = incident.properties.type; - incident.properties.incident_type = incident.properties.type; - delete incident.properties.type; - delete incident.properties.status; - incident.properties.type = 'a-f-G' - return incident; + return { + id: incident.properties.id, + type: 'Feature', + properties: { + remarks: incident.properties.travelerInformationMessage, + callsign: incident.properties.type, + type: 'a-f-G', + incident_type: incident.properties.type, + incident_status: incident.properties.status, + startTime: moment(incident.properties.startTime).tz('America/Denver').format('YYYY-MM-DD HH:mm z'), + lastUpdated: moment(incident.properties.lastUpdated).tz('America/Denver').format('YYYY-MM-DD HH:mm z') + }, + geometry: incident.geometry + }; })) { if (feature.geometry.type.startsWith('Multi')) { const feat = JSON.stringify(feature); @@ -119,7 +132,7 @@ export default class Task extends ETL { const fc = { type: 'FeatureCollection', features: features.filter((feat) => { - return allowed.includes(feat.geometry.type) + return allowed.includes(feat.geometry.type); }) };