@atmosx/event-product-parser 3.0.44 → 3.0.47
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 +77 -31
- package/SUPPORTED_EVENTS.md +369 -0
- package/dist/cjs/index.cjs +681 -403
- package/dist/esm/index.mjs +659 -382
- package/dist/index.d.mts +54 -25
- package/dist/index.d.ts +54 -25
- package/package.json +1 -1
- package/src/@building/building.attachments.ts +83 -0
- package/src/@building/building.enhance.ts +7 -3
- package/src/@building/building.office.ts +2 -2
- package/src/@building/building.properties.ts +12 -11
- package/src/@building/building.signature.ts +11 -11
- package/src/@building/building.tags.ts +2 -2
- package/src/@building/building.tracking.ts +3 -3
- package/src/@building/building.validate.ts +2 -2
- package/src/@core/core.createEvent.ts +83 -0
- package/src/@dictionaries/{dictionaries.eventActions.ts → dictionaries.actions.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventAwipAbreviations.ts → dictionaries.awips.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventCancelMessages.ts → dictionaries.cancellation.ts} +2 -1
- package/src/@dictionaries/{dictionaries.eventCauses.ts → dictionaries.causes.ts} +1 -1
- package/src/@dictionaries/{dictionaries.statusCorrelationText.ts → dictionaries.correlations.ts} +1 -1
- package/src/@dictionaries/{dictionaries.betterEventNames.ts → dictionaries.enhanced.ts} +13 -2
- package/src/@dictionaries/{dictionaries.eventTypes.ts → dictionaries.events.ts} +1 -1
- package/src/@dictionaries/{dictionaries.regExp.ts → dictionaries.expressions.ts} +2 -1
- package/src/@dictionaries/{dictionaries.hailStrings.ts → dictionaries.hail.ts} +4 -1
- package/src/@dictionaries/{dictionaries.officeICAOs.ts → dictionaries.icao.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventsMatchText.ts → dictionaries.matches.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventProducts.ts → dictionaries.products.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventRecords.ts → dictionaries.records.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventSeverity.ts → dictionaries.severity.ts} +1 -1
- package/src/@dictionaries/{dictionaries.shapefileLinks.ts → dictionaries.shapefiles.ts} +1 -1
- package/src/@dictionaries/dictionaries.states.ts +72 -0
- package/src/@dictionaries/{dictionaries.eventStatus.ts → dictionaries.status.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventTags.ts → dictionaries.tags.ts} +1 -1
- package/src/@dictionaries/{dictionaries.testSignatures.ts → dictionaries.testing.ts} +3 -2
- package/src/@events/events.api.ts +18 -15
- package/src/@events/events.text.ts +2 -2
- package/src/@events/events.ugc.ts +2 -2
- package/src/@manager/manager.mkEvent.ts +3 -3
- package/src/@manager/manager.rmEvent.ts +3 -2
- package/src/@manager/manager.updateListener.ts +163 -0
- package/src/@modules/@database/database.broadcastify.ts +67 -0
- package/src/@modules/@database/database.init.ts +14 -1
- package/src/@modules/@database/database.shapefiles.ts +3 -6
- package/src/@modules/@eas/eas.getCleanDescription.ts +2 -0
- package/src/@modules/@eas/eas.getTTS.ts +19 -8
- package/src/@modules/@eas/eas.setEasTone.ts +15 -10
- package/src/@modules/@stanza/stanza.getAwipsType.ts +2 -2
- package/src/@modules/@stanza/stanza.validate.ts +3 -3
- package/src/@modules/@utilities/utilities.createHttp.ts +56 -47
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +5 -2
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +1 -1
- package/src/@parsers/@hvtec/hvtec.extract.ts +8 -8
- package/src/@parsers/@pvtec/pvtec.extract.ts +12 -12
- package/src/@parsers/@text/text.getDescriptionFromProduct.ts +2 -2
- package/src/@parsers/@text/text.getEmbed.ts +58 -0
- package/src/@parsers/@ugc/ugc.header.ts +3 -3
- package/src/@types/type.event.ts +3 -3
- package/src/@types/{type.webhook.ts → type.listener.ts} +11 -7
- package/src/@types/type.properties.ts +10 -9
- package/src/@types/type.settings.ts +13 -6
- package/src/bootstrap.ts +13 -6
- package/src/index.ts +2 -1
- package/test.js +30 -22
- package/src/@building/building.outlooks.ts +0 -36
- package/src/@manager/manager.createWebhook.ts +0 -129
- package/src/@manager/manager.updateWebhooks.ts +0 -49
- package/src/@modules/@utilities/utilities.isImageReady.ts +0 -27
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
|
+
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
|
+
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
+
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { validateEvents } from "../@building/building.validate";
|
|
21
|
+
import { dict_correlations } from "../@dictionaries/dictionaries.correlations";
|
|
22
|
+
|
|
23
|
+
interface CreateEventOptions {
|
|
24
|
+
event: string
|
|
25
|
+
status: string
|
|
26
|
+
issued: Date
|
|
27
|
+
expires: Date
|
|
28
|
+
locations: string
|
|
29
|
+
description: string
|
|
30
|
+
coordinates: number[][]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const createEvent = (options: CreateEventOptions): void => {
|
|
34
|
+
const tick = performance.now()
|
|
35
|
+
validateEvents([{
|
|
36
|
+
type: `Feature`,
|
|
37
|
+
geometry: {
|
|
38
|
+
type: `Point`,
|
|
39
|
+
coordinates: options.coordinates
|
|
40
|
+
},
|
|
41
|
+
properties: {
|
|
42
|
+
event: options.event,
|
|
43
|
+
parent: options.event,
|
|
44
|
+
status: options.status,
|
|
45
|
+
issued: options.issued.toISOString(),
|
|
46
|
+
expires: options.expires.toISOString(),
|
|
47
|
+
locations: options.locations,
|
|
48
|
+
locations_array: options.locations ? options.locations.split(';') : [],
|
|
49
|
+
description: options.description,
|
|
50
|
+
geocode: {
|
|
51
|
+
office: {
|
|
52
|
+
office: `ATMX`,
|
|
53
|
+
name: `AtmosphericX Manual Event`,
|
|
54
|
+
},
|
|
55
|
+
organization: `AtmosphericX`,
|
|
56
|
+
ugc: [],
|
|
57
|
+
polygon: options.coordinates.length > 0 ? Buffer.from(JSON.stringify([options.coordinates[0]])).toString('base64') : null,
|
|
58
|
+
polygon_generated: options.coordinates.length > 0 ? true : false,
|
|
59
|
+
},
|
|
60
|
+
status_metadata: {
|
|
61
|
+
is_issued: options.status == `Issued`,
|
|
62
|
+
is_updated: options.status == `Updated`,
|
|
63
|
+
is_expired: options.status == `Expired`,
|
|
64
|
+
is_test: options.status == `Test`,
|
|
65
|
+
is_statement: options.status == `Statement`
|
|
66
|
+
},
|
|
67
|
+
metadata: {
|
|
68
|
+
ms: performance.now() - tick,
|
|
69
|
+
source: `events.manual`,
|
|
70
|
+
tracking: `ATMX-M-W-01`,
|
|
71
|
+
header: `ZCZC-ATMOSX-ATMX-M-W-01`,
|
|
72
|
+
raw: options.description,
|
|
73
|
+
history: [
|
|
74
|
+
{
|
|
75
|
+
description: options.description,
|
|
76
|
+
issued: options.issued.toISOString(),
|
|
77
|
+
status: options.status ?? null,
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}])
|
|
83
|
+
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const dict_awips: Record<string, string> = {
|
|
21
21
|
ABV: `rawinsonde-data-above-100-millibars`,
|
|
22
22
|
ADA: `alarm-alert-administrative-message`,
|
|
23
23
|
ADM: `alert-administrative-message`,
|
package/src/@dictionaries/{dictionaries.eventCancelMessages.ts → dictionaries.cancellation.ts}
RENAMED
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const dict_cancellation: string[] = [
|
|
21
21
|
"has been cancelled",
|
|
22
22
|
"subsided sufficiently for the advisory to be cancelled",
|
|
23
23
|
"has been cancelled",
|
|
24
|
+
"no tsunami threat from a nearby earthquake",
|
|
24
25
|
"will be allowed to expire",
|
|
25
26
|
"has diminished",
|
|
26
27
|
"and no longer",
|
package/src/@dictionaries/{dictionaries.statusCorrelationText.ts → dictionaries.correlations.ts}
RENAMED
|
@@ -26,7 +26,7 @@ type TypeCorrelations = {
|
|
|
26
26
|
isStatement: boolean
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export const
|
|
29
|
+
export const dict_correlations: TypeCorrelations[] = [
|
|
30
30
|
{type: "Statement", name: "Statement", isCancel: false, isUpdate: false, isIssued: true, isStatement: true},
|
|
31
31
|
{type: "Update", name: "Updated", isCancel: false, isUpdate: true, isIssued: false, isStatement: false},
|
|
32
32
|
{type: "Cancel", name: "Cancelled", isCancel: true, isUpdate: false, isIssued: false, isStatement: false},
|
|
@@ -22,9 +22,10 @@ type EnhancedEventType = {
|
|
|
22
22
|
append?: boolean
|
|
23
23
|
tornado?: string
|
|
24
24
|
damage?: string
|
|
25
|
+
pdswatch?: boolean
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
export const
|
|
28
|
+
export const dict_enhanced: Record<string, Record<string, EnhancedEventType>> = {
|
|
28
29
|
"Tornado Warning": {
|
|
29
30
|
"Tornado Emergency": {
|
|
30
31
|
description: "tornado emergency"
|
|
@@ -42,6 +43,11 @@ export const betterEventNames: Record<string, Record<string, EnhancedEventType>>
|
|
|
42
43
|
},
|
|
43
44
|
"Radar Indicated Tornado Warning": { },
|
|
44
45
|
},
|
|
46
|
+
"Fire Weather Warning": {
|
|
47
|
+
"PDS Fire Weather Warning": {
|
|
48
|
+
description: "particularly dangerous situation",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
45
51
|
"Blizzard Warning": {
|
|
46
52
|
"PDS Blizzard Warning": {
|
|
47
53
|
description: "particularly dangerous situation",
|
|
@@ -59,7 +65,12 @@ export const betterEventNames: Record<string, Record<string, EnhancedEventType>>
|
|
|
59
65
|
},
|
|
60
66
|
"Tornado Watch": {
|
|
61
67
|
"PDS Tornado Watch": {
|
|
62
|
-
|
|
68
|
+
pdswatch: true,
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"Severe Thunderstorm Watch": {
|
|
72
|
+
"PDS Severe Thunderstorm Watch": {
|
|
73
|
+
pdswatch: true
|
|
63
74
|
}
|
|
64
75
|
},
|
|
65
76
|
"Flash Flood Warning": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const dict_expressions: { [key: string]: RegExp } = {
|
|
21
|
+
location: new RegExp(/^([A-Za-z.\-' ]+),\s*([A-Z]{2})$/),
|
|
21
22
|
pvtec: new RegExp(`[OTEX].(NEW|CON|EXT|EXA|EXB|UPG|CAN|EXP|COR|ROU).[A-Z]{4}.[A-Z]{2}.[WAYSFON].[0-9]{4}.[0-9]{6}T[0-9]{4}Z-[0-9]{6}T[0-9]{4}Z`, "g"),
|
|
22
23
|
hvtec: new RegExp(`[a-zA-Z0-9]{4}.[A-Z0-9].[A-Z]{2}.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[A-Z]{2}`, "imu"),
|
|
23
24
|
wmo: new RegExp(`[A-Z0-9]{6}\\s[A-Z]{4}\\s\\d{6}`, "imu"),
|
|
@@ -17,8 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const dict_hail: Record<string, string> = {
|
|
21
|
+
".25": "Pea",
|
|
22
|
+
".50": "Penny",
|
|
21
23
|
".75": "Penny",
|
|
24
|
+
"Up to .75": "Penny",
|
|
22
25
|
".88": "Nickel",
|
|
23
26
|
"0.75": "Penny",
|
|
24
27
|
"0.88": "Nickel",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const dict_matches: Record<string, string> = {
|
|
21
21
|
"Special Weather Statement": "Special Weather Statement",
|
|
22
22
|
"Hurricane Warning": "Hurricane Warning",
|
|
23
23
|
"Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
|
|
@@ -23,7 +23,7 @@ interface ShapefilesResponse {
|
|
|
23
23
|
link: string
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const
|
|
26
|
+
export const dict_shapefiles: ShapefilesResponse[] = [
|
|
27
27
|
{name: "us_counties", id: "C", link: "https://www.weather.gov/source/gis/Shapefiles/County/c_16ap26.zip"},
|
|
28
28
|
{name: "us_states_territories", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/County/s_16ap26.zip"},
|
|
29
29
|
{name: "fire_weather_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/fz16ap26.zip"},
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
|
+
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
|
+
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
+
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const dict_states: Record<string, string> = {
|
|
21
|
+
"AL": "Alabama",
|
|
22
|
+
"AK": "Alaska",
|
|
23
|
+
"AZ": "Arizona",
|
|
24
|
+
"AR": "Arkansas",
|
|
25
|
+
"CA": "California",
|
|
26
|
+
"CO": "Colorado",
|
|
27
|
+
"CT": "Connecticut",
|
|
28
|
+
"DE": "Delaware",
|
|
29
|
+
"FL": "Florida",
|
|
30
|
+
"GA": "Georgia",
|
|
31
|
+
"HI": "Hawaii",
|
|
32
|
+
"ID": "Idaho",
|
|
33
|
+
"IL": "Illinois",
|
|
34
|
+
"IN": "Indiana",
|
|
35
|
+
"IA": "Iowa",
|
|
36
|
+
"KS": "Kansas",
|
|
37
|
+
"KY": "Kentucky",
|
|
38
|
+
"LA": "Louisiana",
|
|
39
|
+
"ME": "Maine",
|
|
40
|
+
"MD": "Maryland",
|
|
41
|
+
"MA": "Massachusetts",
|
|
42
|
+
"MI": "Michigan",
|
|
43
|
+
"MN": "Minnesota",
|
|
44
|
+
"MS": "Mississippi",
|
|
45
|
+
"MO": "Missouri",
|
|
46
|
+
"MT": "Montana",
|
|
47
|
+
"NE": "Nebraska",
|
|
48
|
+
"NV": "Nevada",
|
|
49
|
+
"NH": "New Hampshire",
|
|
50
|
+
"NJ": "New Jersey",
|
|
51
|
+
"NM": "New Mexico",
|
|
52
|
+
"NY": "New York",
|
|
53
|
+
"NC": "North Carolina",
|
|
54
|
+
"ND": "North Dakota",
|
|
55
|
+
"OH": "Ohio",
|
|
56
|
+
"OK": "Oklahoma",
|
|
57
|
+
"OR": "Oregon",
|
|
58
|
+
"PA": "Pennsylvania",
|
|
59
|
+
"RI": "Rhode Island",
|
|
60
|
+
"SC": "South Carolina",
|
|
61
|
+
"SD": "South Dakota",
|
|
62
|
+
"TN": "Tennessee",
|
|
63
|
+
"TX": "Texas",
|
|
64
|
+
"UT": "Utah",
|
|
65
|
+
"VT": "Vermont",
|
|
66
|
+
"VA": "Virginia",
|
|
67
|
+
"WA": "Washington",
|
|
68
|
+
"WV": "West Virginia",
|
|
69
|
+
"WI": "Wisconsin",
|
|
70
|
+
"WY": "Wyoming",
|
|
71
|
+
"DC": "District of Columbia"
|
|
72
|
+
};
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const dict_tags: Record<string, string> = {
|
|
21
21
|
"FROSTBITE AND HYPOTHERMIA ARE LIKELY": "Frostbite and Hypothermia Likely",
|
|
22
22
|
"LICKELY BECOME SLICK AND HAZARDOUS": "Slick and Hazardous Roads",
|
|
23
23
|
"SLIPPERY ROAD CONDITIONS": "Slippery Roads",
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
export const
|
|
20
|
+
export const dict_testing: string[] = [
|
|
21
21
|
`This is a test message`,
|
|
22
22
|
`Monitoring message only.`,
|
|
23
|
-
`THIS_MESSAGE_IS_FOR_TEST_PURPOSES_ONLY
|
|
23
|
+
`THIS_MESSAGE_IS_FOR_TEST_PURPOSES_ONLY`,
|
|
24
|
+
"TEST MESSAGE"
|
|
24
25
|
]
|
|
@@ -21,17 +21,19 @@ import { TypeStanzaCompiled } from "../@types/type.compiled"
|
|
|
21
21
|
import { TypeEvent } from "../@types/type.event";
|
|
22
22
|
import { getEventTracking } from "../@building/building.tracking";
|
|
23
23
|
import { validateEvents } from "../@building/building.validate";
|
|
24
|
-
import {
|
|
24
|
+
import { pvExtract } from "../@parsers/@pvtec/pvtec.extract"
|
|
25
25
|
import { getEventTags } from "../@building/building.tags";
|
|
26
26
|
import { getTextFromProduct } from "../@parsers/@text/text.getTextFromProduct";
|
|
27
|
-
import {
|
|
27
|
+
import { dict_icao } from "../@dictionaries/dictionaries.icao";
|
|
28
|
+
import { TypePVTEC } from "../@types/type.pvtec";
|
|
29
|
+
|
|
28
30
|
|
|
29
31
|
export const api = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
30
32
|
let processed: TypeEvent[] = [];
|
|
31
33
|
const messages = Object.values(JSON.parse(stanza.message).features) as any;
|
|
32
34
|
for (const feature of messages) {
|
|
33
35
|
const tick = performance.now();
|
|
34
|
-
const pVtec = feature?.properties?.parameters?.VTEC?.[0] ?? null
|
|
36
|
+
const pVtec = pvExtract(feature?.properties?.parameters?.VTEC?.[0]) ?? null as TypePVTEC[]
|
|
35
37
|
processed.push({
|
|
36
38
|
type: `Feature`,
|
|
37
39
|
geometry: {
|
|
@@ -45,12 +47,13 @@ export const api = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
45
47
|
issued: feature?.properties?.sent ? new Date(feature?.properties?.sent).toISOString() : null,
|
|
46
48
|
expires: feature?.properties?.expires ? new Date(feature?.properties?.expires).toISOString() : null,
|
|
47
49
|
locations: feature?.properties?.areaDesc ?? null,
|
|
50
|
+
locations_array: feature?.properties?.areaDesc ? feature?.properties?.areaDesc.split(';') : [],
|
|
48
51
|
description: feature?.properties?.description ?? null,
|
|
49
52
|
attributes: feature?.properties?.attributes ?? {},
|
|
50
53
|
geocode: {
|
|
51
54
|
office: {
|
|
52
|
-
office: pVtec ? pVtec.split(`.`)[
|
|
53
|
-
name:
|
|
55
|
+
office: pVtec ? pVtec?.[0]?.tracking.split(`.`)[0] : null,
|
|
56
|
+
name: dict_icao[pVtec ? pVtec?.[0]?.tracking.split(`.`)[0] : null] ?? null,
|
|
54
57
|
},
|
|
55
58
|
organization: feature?.properties?.parameters?.WMOidentifier?.[0],
|
|
56
59
|
ugc: feature?.properties?.geocode?.UGC ?? [],
|
|
@@ -71,16 +74,16 @@ export const api = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
71
74
|
wind_threat: feature?.properties?.parameters?.windThreat?.[0] ?? null,
|
|
72
75
|
hail_threat: feature?.properties?.parameters?.hailThreat?.[0] ?? null,
|
|
73
76
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
discussion_parameters: {
|
|
78
|
+
discussion_number: getTextFromProduct({ message: feature?.properties?.description, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })?.toString()?.padStart(4, "0") ?? null,
|
|
79
|
+
discussion_concerning: getTextFromProduct({ message: feature?.properties?.description, find: [`Concerning...`] }) ?? null,
|
|
80
|
+
discussion_max_tornado: getTextFromProduct({ message: feature?.properties?.description, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] }) ?? null,
|
|
81
|
+
discussion_max_hail: getTextFromProduct({ message: feature?.properties?.description, find: [`MOST PROBABLE PEAK HAIL SIZE...`] }) ?? null,
|
|
82
|
+
discussion_max_wind: getTextFromProduct({ message: feature?.properties?.description, find: [`MOST PROBABLE PEAK WIND GUST...`] }) ?? null,
|
|
83
|
+
discussion_watch_issuance: getTextFromProduct({ message: feature?.properties?.description, find: [`Probability of Watch Issuance...`], removal: [`percent`]}) ?? null,
|
|
81
84
|
},
|
|
82
85
|
watch_parameters: {
|
|
83
|
-
watch_number: getTextFromProduct({ message: feature?.properties?.description, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })?.replace(/(WT|WS|)/g, '')?.trim() ?? null,
|
|
86
|
+
watch_number: (pVtec?.[0]?.is_watch) && (getTextFromProduct({ message: feature?.properties?.description, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })?.replace(/(WT|WS|)/g, '')?.trim()?.toString()?.padStart(4, "0") ?? pVtec?.[0]?.tracking?.slice(-4)?.toString()?.padStart(4, "0") ?? null),
|
|
84
87
|
watch_type: feature?.properties?.description.includes(`TORNADO WATCH`) ? `Tornado` : feature?.properties?.description.includes(`SEVERE`) ? `Severe` : null,
|
|
85
88
|
additional_tornadoes_probability: getTextFromProduct({ message: feature?.properties?.description, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] }) ?? null,
|
|
86
89
|
strong_tornadoes_probability: getTextFromProduct({ message: feature?.properties?.description, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] }) ?? null,
|
|
@@ -96,9 +99,9 @@ export const api = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
96
99
|
metadata: {
|
|
97
100
|
ms: performance.now() - tick,
|
|
98
101
|
source: `events.api`,
|
|
99
|
-
tracking: getEventTracking({ type: `API`, organization: { wmoidentifier: feature?.properties?.parameters?.WMOidentifier?.[0], featureId: feature?.id}, vtec: pVtec}),
|
|
102
|
+
tracking: getEventTracking({ type: `API`, organization: { wmoidentifier: feature?.properties?.parameters?.WMOidentifier?.[0], featureId: feature?.id}, vtec: pVtec?.[0]}),
|
|
100
103
|
header: `ZCZC-ATMOSX-${feature?.properties?.parameters?.WMOidentifier}`,
|
|
101
|
-
vtec: pVtec,
|
|
104
|
+
vtec: pVtec?.[0],
|
|
102
105
|
hvtec: null,
|
|
103
106
|
raw: feature?.properties?.description,
|
|
104
107
|
history: [
|
|
@@ -22,7 +22,7 @@ import { TypeStanzaCompiled } from "../@types/type.compiled"
|
|
|
22
22
|
import { TypeEvent } from "../@types/type.event";
|
|
23
23
|
import { properties } from "../@building/building.properties";
|
|
24
24
|
import { getEventHeader } from "../@building/building.headers";
|
|
25
|
-
import {
|
|
25
|
+
import { dict_matches } from "../@dictionaries/dictionaries.matches";
|
|
26
26
|
import { getEventTracking } from "../@building/building.tracking";
|
|
27
27
|
import { validateEvents } from "../@building/building.validate";
|
|
28
28
|
|
|
@@ -40,7 +40,7 @@ export const text = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
40
40
|
const header = getEventHeader({properties: props, getType: stanza.getType})
|
|
41
41
|
const issued = new Date(attributes.issue)
|
|
42
42
|
const expires = new Date(issued.getTime() + 12 * 60 * 60 * 1000)
|
|
43
|
-
let event = Object.keys(
|
|
43
|
+
let event = Object.keys(dict_matches).find(event => message.toLowerCase().includes(event.toLowerCase()));
|
|
44
44
|
let isStatement = false;
|
|
45
45
|
if (!event) {
|
|
46
46
|
event = stanza.getType.type.split(`-`).map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(` `)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { TypeAttributes } from "../@types/type.attributes";
|
|
21
21
|
import { TypeStanzaCompiled } from "../@types/type.compiled"
|
|
22
22
|
import { TypeEvent } from "../@types/type.event";
|
|
23
|
-
import {
|
|
23
|
+
import { dict_matches } from "../@dictionaries/dictionaries.matches";
|
|
24
24
|
import { ugcExtract } from "../@parsers/@ugc/ugc.extract";
|
|
25
25
|
import { properties } from "../@building/building.properties";
|
|
26
26
|
import { getEventHeader } from "../@building/building.headers";
|
|
@@ -43,7 +43,7 @@ export const ugc = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
43
43
|
const issued = new Date(attributes.issue)
|
|
44
44
|
const expires = new Date(ugc.expires)
|
|
45
45
|
const header = getEventHeader({properties: props, getType: stanza.getType })
|
|
46
|
-
let event = Object.keys(
|
|
46
|
+
let event = Object.keys(dict_matches).find(event => message.toLowerCase().includes(event.toLowerCase()));
|
|
47
47
|
let isStatement = false;
|
|
48
48
|
if (!event) {
|
|
49
49
|
event = stanza.getType.type.split(`-`).map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(` `)
|
|
@@ -21,7 +21,7 @@ import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
|
21
21
|
import { TypeEvent } from "../@types/type.event";
|
|
22
22
|
import { bootstrap } from "../bootstrap"
|
|
23
23
|
import { setHash } from "./manager.setHash";
|
|
24
|
-
import {
|
|
24
|
+
import { updateListener } from "./manager.updateListener";
|
|
25
25
|
import { updateNode } from "./manager.updateNodes";
|
|
26
26
|
import { TypeSettings } from "../@types/type.settings";
|
|
27
27
|
|
|
@@ -79,10 +79,10 @@ export const mkEvent = async (event: TypeEvent): Promise<void> => {
|
|
|
79
79
|
},
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
updateListener(bootstrap.cache.events.features[getIndex])
|
|
83
83
|
} else {
|
|
84
84
|
features.push(event)
|
|
85
|
-
|
|
85
|
+
updateListener(event)
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -20,13 +20,14 @@
|
|
|
20
20
|
import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
21
21
|
import { TypeEvent } from "../@types/type.event";
|
|
22
22
|
import { bootstrap } from "../bootstrap"
|
|
23
|
-
import {
|
|
23
|
+
import { updateListener } from "./manager.updateListener";
|
|
24
24
|
|
|
25
25
|
export const rmEvent = (event: TypeEvent): void => {
|
|
26
26
|
const getEvent = bootstrap.cache.events.features.find(f => f?.properties?.metadata?.tracking === event?.properties?.metadata?.tracking);
|
|
27
27
|
const cachedStatus = event.properties.status;
|
|
28
28
|
event.properties.expires = new Date().toISOString();
|
|
29
29
|
event.properties.status = `Expired`;
|
|
30
|
+
event.properties.status_metadata.is_expired = true;
|
|
30
31
|
if (getEvent) {
|
|
31
32
|
setEventEmit({
|
|
32
33
|
event: `onEventStatus`,
|
|
@@ -37,7 +38,7 @@ export const rmEvent = (event: TypeEvent): void => {
|
|
|
37
38
|
message: `[Removed] ${event.properties.event} (${event.properties.status}) (${event.properties.metadata.tracking})`
|
|
38
39
|
})
|
|
39
40
|
setEventEmit({ event: `onExpiredProduct`, metadata: event })
|
|
40
|
-
if (cachedStatus != `Statement`)
|
|
41
|
+
if (cachedStatus != `Statement`) updateListener(event)
|
|
41
42
|
bootstrap.cache.events.features.splice(bootstrap.cache.events.features.indexOf(getEvent), 1);
|
|
42
43
|
bootstrap.cache.hashes = bootstrap.cache.hashes.filter(hash => hash.tracking !== event.properties.metadata.tracking);
|
|
43
44
|
}
|