@atmosx/event-product-parser 2.0.16 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -237
- package/dist/cjs/index.cjs +2233 -3105
- package/dist/esm/index.mjs +2233 -3108
- package/package.json +3 -2
- package/src/@building/building.clean.ts +30 -0
- package/src/@building/building.create.ts +42 -0
- package/src/@building/building.enhance.ts +56 -0
- package/src/@building/building.geometry.ts +42 -0
- package/src/@building/building.headers.ts +37 -0
- package/src/@building/building.office.ts +43 -0
- package/src/@building/building.polygon.ts +71 -0
- package/src/@building/building.properties.ts +89 -0
- package/src/@building/building.signature.ts +78 -0
- package/src/@building/building.tags.ts +24 -0
- package/src/@building/building.tracking.ts +68 -0
- package/src/@building/building.validate.ts +132 -0
- package/src/@core/core.callback.ts +39 -0
- package/src/@core/core.getEvents.ts +25 -0
- package/src/@core/core.getNodes.ts +25 -0
- package/src/@core/core.listener.ts +24 -0
- package/src/@core/core.setNode.ts +81 -0
- package/src/@core/core.start.ts +54 -0
- package/src/@core/core.stop.ts +32 -0
- package/src/@dictionaries/dictionaries.betterEventNames.ts +85 -0
- package/src/@dictionaries/dictionaries.eventActions.ts +28 -0
- package/src/@dictionaries/{awips.ts → dictionaries.eventAwipAbreviations.ts} +12 -6
- package/src/@dictionaries/dictionaries.eventCancelMessages.ts +29 -0
- package/src/@dictionaries/dictionaries.eventCauses.ts +36 -0
- package/src/@dictionaries/dictionaries.eventProducts.ts +25 -0
- package/src/@dictionaries/dictionaries.eventRecords.ts +25 -0
- package/src/@dictionaries/dictionaries.eventSeverity.ts +27 -0
- package/src/@dictionaries/dictionaries.eventStatus.ts +31 -0
- package/src/@dictionaries/{signatures.ts → dictionaries.eventTags.ts} +13 -68
- package/src/@dictionaries/dictionaries.eventTypes.ts +82 -0
- package/src/@dictionaries/dictionaries.eventsOffshore.ts +31 -0
- package/src/@dictionaries/dictionaries.hailStrings.ts +31 -0
- package/src/@dictionaries/{icao.ts → dictionaries.officeICAOs.ts} +13 -6
- package/src/@dictionaries/dictionaries.regExp.ts +28 -0
- package/src/@dictionaries/dictionaries.shapefileLinks.ts +36 -0
- package/src/@dictionaries/dictionaries.statusCorrelationText.ts +40 -0
- package/src/@dictionaries/dictionaries.test_signatures.ts +23 -0
- package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +68 -0
- package/src/@events/events.api.ts +113 -0
- package/src/@events/events.text.ts +79 -0
- package/src/@events/events.ugc.ts +83 -0
- package/src/@events/events.vtec.ts +87 -0
- package/src/@manager/manager.mkEvent.ts +79 -0
- package/src/@manager/manager.rmEvent.ts +44 -0
- package/src/@manager/manager.setHash.ts +37 -0
- package/src/@manager/manager.updateNodes.ts +51 -0
- package/src/@modules/@database/database.cache.ts +48 -0
- package/src/@modules/@database/database.init.ts +45 -0
- package/src/@modules/@database/database.shapefiles.ts +97 -0
- package/src/@modules/@database/database.stanza.ts +47 -0
- package/src/@modules/@stanza/stanza.getAwipsType.ts +46 -0
- package/src/@modules/@stanza/stanza.validate.ts +50 -0
- package/src/@modules/@utilities/utilities.createHttp.ts +75 -0
- package/src/@modules/@utilities/utilities.getFormattedTime.ts +43 -0
- package/src/@modules/@utilities/utilities.getSettings.ts +25 -0
- package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +114 -0
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +38 -0
- package/src/@modules/@utilities/utilities.setEventEmit.ts +41 -0
- package/src/@modules/@utilities/utilities.setListener.ts +30 -0
- package/src/@modules/@utilities/utilities.setSettings.ts +42 -0
- package/src/@modules/@utilities/utilities.setSleep.ts +33 -0
- package/src/@modules/@utilities/utilities.setTimeoutAction.ts +59 -0
- package/src/@modules/@utilities/utilities.setWarning.ts +34 -0
- package/src/@modules/@xmpp/xmpp.xDeploy.ts +58 -0
- package/src/@modules/@xmpp/xmpp.xError.ts +38 -0
- package/src/@modules/@xmpp/xmpp.xOffline.ts +38 -0
- package/src/@modules/@xmpp/xmpp.xOnline.ts +61 -0
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +59 -0
- package/src/@modules/@xmpp/xmpp.xStanza.ts +63 -0
- package/src/@parsers/@hvtec/hvtec.extract.ts +40 -0
- package/src/@parsers/@pvtec/pvtec.expires.ts +26 -0
- package/src/@parsers/@pvtec/pvtec.extract.ts +50 -0
- package/src/@parsers/@text/text.getDescriptionFromProduct.ts +53 -0
- package/src/@parsers/@text/text.getPolygonFromProduct.ts +32 -0
- package/src/@parsers/@text/text.getTextFromProduct.ts +43 -0
- package/src/@parsers/@text/text.getXML.ts +61 -0
- package/src/@parsers/@ugc/ugc.coordinates.ts +110 -0
- package/src/@parsers/@ugc/ugc.expiry.ts +32 -0
- package/src/@parsers/@ugc/ugc.extract.ts +37 -0
- package/src/@parsers/@ugc/ugc.header.ts +30 -0
- package/src/@parsers/@ugc/ugc.locations.ts +29 -0
- package/src/@parsers/@ugc/ugc.zones.ts +52 -0
- package/src/@types/type.event.ts +67 -0
- package/src/@types/type.properties.ts +75 -0
- package/src/@types/types.attributes.ts +28 -0
- package/src/@types/types.compiled.ts +35 -0
- package/src/@types/types.hash.ts +24 -0
- package/src/@types/types.hvtec.ts +25 -0
- package/src/@types/types.pvtec.ts +29 -0
- package/src/@types/types.settings.ts +71 -0
- package/src/@types/types.stanza.ts +37 -0
- package/src/@types/types.ugc.ts +24 -0
- package/src/bootstrap.ts +82 -163
- package/src/index.ts +48 -216
- package/test.js +65 -49
- package/src/@dictionaries/events.ts +0 -168
- package/src/@parsers/@events/api.ts +0 -146
- package/src/@parsers/@events/cap.ts +0 -123
- package/src/@parsers/@events/text.ts +0 -104
- package/src/@parsers/@events/ugc.ts +0 -107
- package/src/@parsers/@events/vtec.ts +0 -76
- package/src/@parsers/events.ts +0 -392
- package/src/@parsers/hvtec.ts +0 -46
- package/src/@parsers/pvtec.ts +0 -72
- package/src/@parsers/stanza.ts +0 -97
- package/src/@parsers/text.ts +0 -165
- package/src/@parsers/ugc.ts +0 -247
- package/src/@submodules/database.ts +0 -201
- package/src/@submodules/eas.ts +0 -490
- package/src/@submodules/utils.ts +0 -191
- package/src/@submodules/xmpp.ts +0 -142
- package/src/types.ts +0 -259
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<h1 style='font-size: 65px'; align="center"
|
|
1
|
+
<h1 style='font-size: 65px'; align="center">AtmosphericX - Event Product Parser</h1>
|
|
2
2
|
<div align="center">
|
|
3
3
|
<p align = "center">This repository contains the primary parser for AtmosphericX's NOAA Weather Wire Service (NWWS) and National Weather Service (NWS) API. It is designed to handle real time weather alerts and messages from the National Weather Service, using both XMPP (NWWS) and direct API access (Slower). This parser is intended for developers who want to integrate real time weather alerts, watches, warnings, and forecast data from the NWS seamlessly into their applications or services. It is not recommended for users without basic programming knowledge. If you wish to access NOAA weather data without programming, consider using our end-user project, which leverages this parser and provides an easy-to-use interface for tracking weather alerts.</small></p>
|
|
4
4
|
<p align = "center">Documentation written by @k3yomi</p>
|
|
@@ -12,240 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
## Installation (NPM)
|
|
14
14
|
```bash
|
|
15
|
-
npm install @atmosx/event-product-parser
|
|
15
|
+
npm install @atmosx/event-product-parser
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
```javascript
|
|
20
|
-
const { AlertManager } = require('@atmosx/product-parser'); // CJS
|
|
21
|
-
import { AlertManager } from '@atmosx/product-parser'; // ESM
|
|
22
|
-
|
|
23
|
-
const parser = new AlertManager({
|
|
24
|
-
database: `shapefiles.db`,
|
|
25
|
-
is_wire: true,
|
|
26
|
-
journal: true,
|
|
27
|
-
noaa_weather_wire_service_settings: {
|
|
28
|
-
reconnection_settings: {
|
|
29
|
-
enabled: true,
|
|
30
|
-
interval: 60,
|
|
31
|
-
},
|
|
32
|
-
credentials: {
|
|
33
|
-
username: `username_here`,
|
|
34
|
-
password: `password_here`,
|
|
35
|
-
nickname: "AtmosphericX Parser",
|
|
36
|
-
},
|
|
37
|
-
cache: {
|
|
38
|
-
enabled: false,
|
|
39
|
-
max_db_history: 5000,
|
|
40
|
-
max_db_cache_size: 1000,
|
|
41
|
-
},
|
|
42
|
-
preferences: {
|
|
43
|
-
disable_ugc: false,
|
|
44
|
-
disable_vtec: false,
|
|
45
|
-
disable_text: false,
|
|
46
|
-
cap_only: false,
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
national_weather_service_settings: {
|
|
50
|
-
interval: 15,
|
|
51
|
-
endpoint: `https://api.weather.gov/alerts/active`,
|
|
52
|
-
},
|
|
53
|
-
global_settings: {
|
|
54
|
-
parent_events_only: true,
|
|
55
|
-
better_event_parsing: true,
|
|
56
|
-
shapefile_coordinates: false,
|
|
57
|
-
shapefile_skip: 10,
|
|
58
|
-
filtering: {
|
|
59
|
-
events: [`Severe Thunderstorm Warning`],
|
|
60
|
-
filtered_icao: [`KLOT`],
|
|
61
|
-
ignored_icao: [],
|
|
62
|
-
ignored_events: [`Xx`, `Test Message`],
|
|
63
|
-
ugc_filter: [],
|
|
64
|
-
state_filter: [],
|
|
65
|
-
check_expired: true,
|
|
66
|
-
ignore_test_products: true,
|
|
67
|
-
},
|
|
68
|
-
eas_settings: {
|
|
69
|
-
directory: null,
|
|
70
|
-
intro_wav: null,
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## NOAA Weather Wire Service (Getting Started)
|
|
77
|
-
To use the NOAA Weather Wire Service (NWWS). You would need to obtain credentials from the National Weather Service. Follow these steps:
|
|
78
|
-
1. Visit the [NOAA NWWS Registration Page](https://www.weather.gov/nwws/nwws_oi_request).
|
|
79
|
-
2. Fill out the registration form with the required information.
|
|
80
|
-
3. Submit the form and wait for approval. You will receive your NWWS credentials via email.
|
|
81
|
-
|
|
82
|
-
## Events and Listeners
|
|
83
|
-
> All events are in GeoJSON.
|
|
84
|
-
|
|
85
|
-
### Event `onEvents`
|
|
86
|
-
Triggered when a batch of new alerts are received and processed.
|
|
87
|
-
```javascript
|
|
88
|
-
parser.on(`onEvents`, (alerts) => {
|
|
89
|
-
console.log(`Received ${alerts.length} new alerts.`);
|
|
90
|
-
alerts.forEach(alert => {
|
|
91
|
-
console.log(`${alert.properties.event} for ${alert.properties.locations}`);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
```
|
|
95
|
-
Alternatively, you can listen for single alert events using `onSevereThunderstormWarning` or `onTornadoWarning`, etc.
|
|
96
|
-
```javascript
|
|
97
|
-
parser.on(`onTornadoWarning`, (alert) => {
|
|
98
|
-
console.log(`Tornado Warning issued for ${alert.properties.locations}`);
|
|
99
|
-
});
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Event `onReconnection`
|
|
103
|
-
Triggered when the parser attempts to reconnect to the NWWS service.
|
|
104
|
-
```javascript
|
|
105
|
-
parser.on(`onReconnection`, (data) => {
|
|
106
|
-
console.log(`Reconnection attempt #${data.reconnects}`);
|
|
107
|
-
});
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Event `onConnection`
|
|
111
|
-
Triggered when the parser successfully connects to the NWWS service.
|
|
112
|
-
```javascript
|
|
113
|
-
parser.on(`onConnection`, (nickname) => {
|
|
114
|
-
console.log(`Connected to NWWS service as ${nickname}`);
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Event `onOccupant`
|
|
119
|
-
Triggered when a new occupant is detected on the NWWS XMPP service.
|
|
120
|
-
```javascript
|
|
121
|
-
parser.on(`onOccupant`, (data) => {
|
|
122
|
-
console.log(`New occupant detected: ${data.occupant}`);
|
|
123
|
-
});
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Event `onMessage`
|
|
127
|
-
Triggered when a stanza message is validated and received from the XMPP client.
|
|
128
|
-
```javascript
|
|
129
|
-
parser.on(`onMessage`, (data) => {
|
|
130
|
-
console.log(`Message received from ${data.from}: ${data.message}`);
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Event `onTest`
|
|
135
|
-
Triggered when a test message comes in. Ex: Test Tsunami Warning
|
|
136
|
-
```javascript
|
|
137
|
-
parser.on(`onTest`, (alert) => {
|
|
138
|
-
console.log(`Test alert received for ${alert.properties.locations}`);
|
|
139
|
-
});
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Event `onExpired`
|
|
143
|
-
Triggered when an alert expires.
|
|
144
|
-
```javascript
|
|
145
|
-
parser.on(`onExpired`, (alert) => {
|
|
146
|
-
console.log(`Alert expired for ${alert.properties.event} for locations of ${alert.properties.locations}`);
|
|
147
|
-
});
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Event `onFilteredEvent` / `onIgnoredEvent`
|
|
151
|
-
Triggered when an alert is filtered out.
|
|
152
|
-
```javascript
|
|
153
|
-
parser.on(`onFilteredEvent`, (alert) => {
|
|
154
|
-
console.log(`Alert filtered for ${alert.properties.event}`);
|
|
155
|
-
});
|
|
156
|
-
parser.on(`onIgnoredEvent`, (alert) => {
|
|
157
|
-
console.log(`Alert ignored for ${alert.properties.event}`);
|
|
158
|
-
});
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Event `onFilteredICAO` / (`onIgnoredICAO`)
|
|
162
|
-
Triggered when an alert is filtered out based on its ICAO code.
|
|
163
|
-
```javascript
|
|
164
|
-
parser.on(`onFilteredICAO`, (alert) => {
|
|
165
|
-
console.log(`Alert filtered for ${alert.properties.event}`);
|
|
166
|
-
});
|
|
167
|
-
parser.on(`onIgnoredICAO`, (alert) => {
|
|
168
|
-
console.log(`Alert ignored for ${alert.properties.event}`);
|
|
169
|
-
});
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Event `onFilteredUGC`
|
|
173
|
-
Triggered when an alert is filtered out based on its UGC zone.
|
|
174
|
-
```javascript
|
|
175
|
-
parser.on(`onFilteredUGC`, (alert) => {
|
|
176
|
-
console.log(`Alert filtered for ${alert.properties.event}`);
|
|
177
|
-
});
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### Event `onFilteredState`
|
|
181
|
-
Triggered when an alert is filtered out based on its state (Abbreviation)
|
|
182
|
-
```javascript
|
|
183
|
-
parser.on(`onFilteredState`, (alert) => {
|
|
184
|
-
console.log(`Alert filtered for ${alert.properties.event}`);
|
|
185
|
-
});
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Event `log`
|
|
189
|
-
Triggered for logging purposes, providing log level and message.
|
|
190
|
-
```javascript
|
|
191
|
-
parser.on(`log`, (message) => {
|
|
192
|
-
console.log(data.message);
|
|
193
|
-
});
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## Callbacks and Functions
|
|
197
|
-
|
|
198
|
-
### Function `setDisplayName(name)`
|
|
199
|
-
Sets the display name for the XMPP client. This requires reconnection to take effect.
|
|
200
|
-
```javascript
|
|
201
|
-
parser.setDisplayName(`My Weather Parser`);
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Function `createEasAudio(description, header)`
|
|
205
|
-
Generates an EAS audio file based on the provided description and header. Audio file will be located based on settings provided in the global_settings.eas_settings object.
|
|
206
|
-
If you are running linux, festival is required to use this or it will error out.
|
|
207
|
-
```javascript
|
|
208
|
-
parser.createEasAudio(`This is a test alert`, `EAS Header Info`);
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Function `getAllAlertTypes()`
|
|
212
|
-
Returns an array of all supported alert types by the parser.
|
|
213
|
-
```javascript
|
|
214
|
-
const alertTypes = parser.getAllAlertTypes();
|
|
215
|
-
console.log(alertTypes);
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### Function `getEventPolygon(event)`
|
|
219
|
-
Retrieves the geographical polygon for a given event based on its generated geocode and UGC zones. (Returns in GeoJSON format)
|
|
220
|
-
```javascript
|
|
221
|
-
const polygon = await parser.getEventPolygon(event);
|
|
222
|
-
console.log(polygon);
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
### Function `searchStanzaDatabase(query)`
|
|
226
|
-
Searches the internal stanza database for messages matching the provided query.
|
|
227
|
-
```javascript
|
|
228
|
-
const results = parser.searchStanzaDatabase(`Tornado Warning`);
|
|
229
|
-
console.log(results);
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Function `setSettings({})`
|
|
233
|
-
Dynamically updates the parser settings. Accepts the same configuration object as the constructor.
|
|
234
|
-
```javascript
|
|
235
|
-
parser.setSettings({
|
|
236
|
-
global_settings: {
|
|
237
|
-
filtering: {
|
|
238
|
-
ignored_icao: [`KXYZ`],
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Function `stop()`
|
|
245
|
-
Stops the parser and disconnects from the NWWS service.
|
|
246
|
-
```javascript
|
|
247
|
-
parser.stop();
|
|
248
|
-
```
|
|
18
|
+
### Documentation Coming Soon
|
|
249
19
|
|
|
250
20
|
## References
|
|
251
21
|
[NOAA NWWS Information](https://www.weather.gov/nwws/) |
|
|
@@ -262,7 +32,4 @@ parser.stop();
|
|
|
262
32
|
[Changelogs](/CHANGELOGS.md) |
|
|
263
33
|
|
|
264
34
|
## Acknowledgements
|
|
265
|
-
- [k3yomi](https://github.com/k3yomi)
|
|
266
|
-
- Lead developer @ AtmosphericX and maintainer of this module.
|
|
267
|
-
- [StarflightWx](https://x.com/starflightVR)
|
|
268
|
-
- For testing and providing feedback (Co-Developer and Spotter @ AtmosphericX)
|
|
35
|
+
- [k3yomi](https://github.com/k3yomi)
|