forked from jf-tech/omniparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1_canadapost_edi_214.schema.json
123 lines (123 loc) · 5.93 KB
/
1_canadapost_edi_214.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{
"parser_settings": {
"version": "omni.2.1",
"file_format_type": "edi"
},
"file_declaration": {
"element_delimiter": "*",
"segment_delimiter": "\n",
"segment_declarations": [
{
"name": "ISA",
"child_segments": [
{
"name": "GS",
"_comment": "functional group",
"child_segments": [
{
"name": "scanInfo", "type": "segment_group", "min": 0, "max": -1, "is_target": true,
"child_segments": [
{ "name": "ST" },
{ "name": "B10", "elements": [ { "name": "shipmentIdentificationNumber", "index": 2 } ] },
{ "name": "L11" },
{ "name": "L11" },
{ "name": "N1" },
{ "name": "N1" },
{ "name": "N3" },
{
"name": "N4",
"elements": [
{ "name": "cityName", "index": 1, "_comment": "E19" },
{ "name": "provinceCode", "index": 2 },
{ "name": "postalCode", "index": 3 },
{ "name": "countryCode", "index": 4 }
]
},
{ "name": "LX" },
{
"name": "AT7",
"elements": [
{ "name": "shipmentStatusCode", "index": 1 },
{ "name": "shipmentStatusReasonCode", "index": 2 },
{ "name": "date", "index": 5 },
{ "name": "time", "index": 6 },
{ "name": "timeCode", "index": 7 }
]
},
{
"name": "MS1",
"elements": [
{ "name": "cityName", "index": 1 },
{ "name": "provinceCode", "index": 2 },
{ "name": "countryCode", "index": 3 }
]
},
{ "name": "L11", "min": 0 },
{
"name": "AT8",
"elements": [
{ "name": "weightUOM", "index": 2 },
{ "name": "weight", "index": 3 }
]
},
{ "name": "SE" }
]
}
]
},
{ "name": "GE" }
]
},
{ "name": "IEA" }
]
},
"transform_declarations": {
"FINAL_OUTPUT": { "object": {
"tracking_number": { "xpath": "B10/shipmentIdentificationNumber" },
"weight": { "xpath": "AT8/weight", "type": "float" },
"weight_uom": { "custom_func": {
"name": "javascript",
"args": [
{ "const": "uom=='K'?'KG':'LBS'" },
{ "const": "uom" }, { "xpath": "AT8/weightUOM" }
]
}},
"dest": { "object": {
"city": { "xpath": "N4/cityName" },
"state": { "xpath": "N4/provinceCode" },
"country": { "xpath": "N4/countryCode" },
"zip": { "xpath": "N4/postalCode" }
}},
"events": { "array": [ { "object": {
"date": { "template": "event_date_template" },
"date_raw": { "template": "event_date_template" },
"location": { "object": {
"city": { "xpath": "MS1/cityName" },
"state": { "xpath": "MS1/provinceCode" },
"country": { "xpath": "MS1/countryCode" }
}}
}}]}
}},
"event_date_template": { "custom_func": {
"name": "dateTimeToRFC3339",
"args": [
{ "custom_func": {
"name": "concat",
"args": [
{ "xpath": "AT7/date" },
{ "xpath": "AT7/time" }
]
}},
{ "custom_func": {
"name": "javascript",
"args": [
{ "const": "caTZ=='PT'?'America/Vancouver':caTZ=='MT'?'America/Edmonton':caTZ=='CT'?'America/Winnipeg':caTZ=='ET'?'America/Toronto':caTZ=='AT'?'America/Halifax':caTZ=='NT'?'America/St_Johns':caTZ=='PS'?'Etc/GMT+8':caTZ=='PST'?'Etc/GMT+8':caTZ=='MS'?'Etc/GMT+7':caTZ=='MST'?'Etc/GMT+7':caTZ=='CS'?'Etc/GMT+6':caTZ=='CST'?'Etc/GMT+6':caTZ=='ES'?'Etc/GMT+5':caTZ=='EST'?'Etc/GMT+5':caTZ=='AS'?'Etc/GMT+4':caTZ=='AST'?'Etc/GMT+4':''" },
{ "const": "caTZ" }, { "xpath": "AT7/timeCode" }
]},
"_comment": "from tz; some of canadapost tz codes are non-IANA-standard shortcuts, we need to translate them into standard IANA tz"
},
{ "const": "", "_comment": "to tz" }
]
}}
}
}