Spaces:
Sleeping
Sleeping
add cached data dictionary file
Browse files
.gitignore
CHANGED
|
@@ -110,7 +110,6 @@ venv/
|
|
| 110 |
ENV/
|
| 111 |
env.bak/
|
| 112 |
venv.bak/
|
| 113 |
-
cache/
|
| 114 |
|
| 115 |
# Spyder project settings
|
| 116 |
.spyderproject
|
|
|
|
| 110 |
ENV/
|
| 111 |
env.bak/
|
| 112 |
venv.bak/
|
|
|
|
| 113 |
|
| 114 |
# Spyder project settings
|
| 115 |
.spyderproject
|
cache/https___opendata.mtr.com.hk_doc_Next_Train_DataDictionary_v1.7.pdf.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Data Dictionary for Next Train API
|
| 2 |
+
|
| 3 |
+
Version 1.7 13 March 2025
|
| 4 |
+
|
| 5 |
+
<!-- image -->
|
| 6 |
+
|
| 7 |
+
<!-- image -->
|
| 8 |
+
|
| 9 |
+
| Version | Details of Change | Effective Date |
|
| 10 |
+
|-----------|-----------------------------------------------------------------|------------------|
|
| 11 |
+
| 1 | Initial Release. | 18 July, 2019 |
|
| 12 |
+
| 1.1 | Added Tuen Ma Line (TML) | 27 June, 2021 |
|
| 13 |
+
| 1.2 | - Added East Rail Line (EAL) - Added fields for returned result | 15 May, 2022 |
|
| 14 |
+
| 1.3 | Added South Island Line (SIL) | 30 January, 2023 |
|
| 15 |
+
| 1.4 | Added Tsuen Wan Line (TWL) | 17 April, 2023 |
|
| 16 |
+
| 1.5 | Added Island Line (ISL) | 19 July, 2023 |
|
| 17 |
+
| 1.6 | Added Kwun Tong Line (KTL) | 11 October, 2023 |
|
| 18 |
+
| 1.7 | Added Disneyland Resort Line (DRL) | 13 March, 2025 |
|
| 19 |
+
|
| 20 |
+
<!-- image -->
|
| 21 |
+
|
| 22 |
+
## Table of Contents
|
| 23 |
+
|
| 24 |
+
| 1. Description and requirement of required variables........................................................................4 |
|
| 25 |
+
|------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 26 |
+
| 2. Description of returned result ...........................................................................................................8 |
|
| 27 |
+
|
| 28 |
+
<!-- image -->
|
| 29 |
+
|
| 30 |
+
## 1. Description and requirement of required variables
|
| 31 |
+
|
| 32 |
+
The following table shows the required variables when using the API. Valid result will be returned only if the combination of parameter 1(line) and parameter 2(sta) is correct.
|
| 33 |
+
|
| 34 |
+
| Parameter 1 (line) | Description | Parameter 2 (sta) | Description |
|
| 35 |
+
|----------------------|-----------------|---------------------|--------------------|
|
| 36 |
+
| AEL | Airport Express | HOK | Hong Kong |
|
| 37 |
+
| AEL | Airport Express | KOW | Kowloon |
|
| 38 |
+
| AEL | Airport Express | TSY | Tsing Yi |
|
| 39 |
+
| AEL | Airport Express | AIR | Airport |
|
| 40 |
+
| AEL | Airport Express | AWE | AsiaWorld Expo |
|
| 41 |
+
| | | HOK | Hong Kong |
|
| 42 |
+
| | | KOW | Kowloon |
|
| 43 |
+
| | | OLY | Olympic |
|
| 44 |
+
| | | NAC | Nam Cheong |
|
| 45 |
+
| TCL | Tung Chung Line | LAK | Lai King |
|
| 46 |
+
| | | TSY | Tsing Yi |
|
| 47 |
+
| | | SUN | Sunny Bay |
|
| 48 |
+
| | | TUC | Tung Chung |
|
| 49 |
+
| TML | Tuen Ma Line | WKS | Wu Kai Sha |
|
| 50 |
+
| | | MOS | Ma On Shan |
|
| 51 |
+
| | | HEO | Heng On |
|
| 52 |
+
| | | TSH | Tai Shui Hang |
|
| 53 |
+
| | | SHM | Shek Mun |
|
| 54 |
+
| | | CIO | City One |
|
| 55 |
+
| | | STW | Sha Tin Wai |
|
| 56 |
+
| | | CKT | Che Kung Temple |
|
| 57 |
+
| | | TAW | Tai Wai |
|
| 58 |
+
| | | HIK | Hin Keng |
|
| 59 |
+
| | | DIH | Diamond Hill |
|
| 60 |
+
| | | KAT | Kai Tak |
|
| 61 |
+
| | | SUW | Sung Wong Toi |
|
| 62 |
+
| | | TKW | To Kwa Wan |
|
| 63 |
+
| | | HOM | Ho Man Tin |
|
| 64 |
+
| | | HUH | Hung Hom |
|
| 65 |
+
| | | ETS | East Tsim Sha Tsui |
|
| 66 |
+
| | | AUS | Austin |
|
| 67 |
+
| | | NAC | Nam Cheong |
|
| 68 |
+
| | | MEF | Mei Foo |
|
| 69 |
+
| | | TWW | Tsuen Wan West |
|
| 70 |
+
| | | KSR | Kam Sheung Road |
|
| 71 |
+
| | | YUL | Yuen Long |
|
| 72 |
+
| | | LOP | Long Ping |
|
| 73 |
+
| | | TIS | Tin Shui Wai |
|
| 74 |
+
| | | SIH | Siu Hong |
|
| 75 |
+
| | | TUM | Tuen Mun |
|
| 76 |
+
|
| 77 |
+
<!-- image -->
|
| 78 |
+
|
| 79 |
+
| Parameter 1 (line) | Description | Parameter 2 (sta) | Description |
|
| 80 |
+
|----------------------|----------------|---------------------|-----------------------|
|
| 81 |
+
| TKL | | NOP | North Point |
|
| 82 |
+
| TKL | | QUB | Quarry Bay |
|
| 83 |
+
| TKL | | YAT | Yau Tong |
|
| 84 |
+
| TKL | Tseung Kwan O | TIK | Tiu Keng Leng |
|
| 85 |
+
| TKL | Line | TKO | Tseung Kwan O |
|
| 86 |
+
| TKL | | LHP | LOHAS Park |
|
| 87 |
+
| TKL | | HAH | Hang Hau |
|
| 88 |
+
| TKL | | POA | Po Lam |
|
| 89 |
+
| EAL SIL | East Rail Line | ADM | Admiralty |
|
| 90 |
+
| EAL SIL | East Rail Line | EXC | Exhibition Centre |
|
| 91 |
+
| EAL SIL | East Rail Line | HUH | Hung Hom |
|
| 92 |
+
| EAL SIL | East Rail Line | MKK | Mong Kok East |
|
| 93 |
+
| EAL SIL | East Rail Line | KOT | Kowloon Tong |
|
| 94 |
+
| EAL SIL | East Rail Line | TAW | Tai Wai |
|
| 95 |
+
| EAL SIL | East Rail Line | SHT | Sha Tin |
|
| 96 |
+
| EAL SIL | East Rail Line | FOT | Fo Tan |
|
| 97 |
+
| EAL SIL | East Rail Line | RAC | Racecourse |
|
| 98 |
+
| EAL SIL | East Rail Line | UNI | University |
|
| 99 |
+
| EAL SIL | East Rail Line | TAP | Tai Po Market |
|
| 100 |
+
| EAL SIL | East Rail Line | TWO | Tai Wo |
|
| 101 |
+
| EAL SIL | East Rail Line | FAN | Fanling |
|
| 102 |
+
| EAL SIL | East Rail Line | SHS | Sheung Shui |
|
| 103 |
+
| EAL SIL | East Rail Line | LOW | Lo Wu |
|
| 104 |
+
| EAL SIL | East Rail Line | LMC | Lok Ma Chau |
|
| 105 |
+
| | | ADM | Admiralty |
|
| 106 |
+
| | | OCP | Ocean Park |
|
| 107 |
+
| | South Island | WCH | Wong Chuk Hang |
|
| 108 |
+
| | Line | LET | Lei Tung |
|
| 109 |
+
| | | SOH | South Horizons |
|
| 110 |
+
| TWL | Tsuen Wan Line | CEN | Central |
|
| 111 |
+
| TWL | Tsuen Wan Line | ADM | Admiralty |
|
| 112 |
+
| TWL | Tsuen Wan Line | TST | Tsim Sha Tsui |
|
| 113 |
+
| TWL | Tsuen Wan Line | JOR | Jordan |
|
| 114 |
+
| TWL | Tsuen Wan Line | YMT | Yau Ma Tei |
|
| 115 |
+
| TWL | Tsuen Wan Line | MOK | Mong Kok Price Edward |
|
| 116 |
+
| TWL | Tsuen Wan Line | PRE | Sham Shui |
|
| 117 |
+
| TWL | Tsuen Wan Line | SSP | Po |
|
| 118 |
+
| TWL | Tsuen Wan Line | LCK | Lai Chi Kok |
|
| 119 |
+
| TWL | Tsuen Wan Line | MEF | Mei Foo |
|
| 120 |
+
| TWL | Tsuen Wan Line | LAK | Lai King |
|
| 121 |
+
| TWL | Tsuen Wan Line | KWF | Kwai Fong |
|
| 122 |
+
|
| 123 |
+
<!-- image -->
|
| 124 |
+
|
| 125 |
+
| Parameter 1 (line) | Description | Parameter 2 (sta) | Description |
|
| 126 |
+
|----------------------|-------------------|---------------------|-------------------|
|
| 127 |
+
| | | KWH | Kwai Hing |
|
| 128 |
+
| | | TWH | Tai Wo Hau |
|
| 129 |
+
| | | TSW | Tsuen Wan |
|
| 130 |
+
| ISL | | KET | Kennedy Town |
|
| 131 |
+
| | | HKU | HKU |
|
| 132 |
+
| | | SYP | Sai Ying Pun |
|
| 133 |
+
| | | SHW | Sheung Wan |
|
| 134 |
+
| | | CEN | Central |
|
| 135 |
+
| | | ADM | Admiralty |
|
| 136 |
+
| | | WAC | Wan Chai |
|
| 137 |
+
| | | CAB | Causeway Bay |
|
| 138 |
+
| | Island Line | TIH | Tin Hau |
|
| 139 |
+
| | | FOH | Fortress Hill |
|
| 140 |
+
| | | NOP | North Point |
|
| 141 |
+
| | | QUB | Quarry Bay |
|
| 142 |
+
| | | TAK | Tai Koo |
|
| 143 |
+
| | | SWH | Sai Wan Ho |
|
| 144 |
+
| | | SKW | Shau Kei Wan |
|
| 145 |
+
| | | HFC | Heng Fa Chuen |
|
| 146 |
+
| | | CHW | Chai Wan |
|
| 147 |
+
| | | WHA | Whampoa |
|
| 148 |
+
| | | HOM | Ho Man Tin |
|
| 149 |
+
| | | YMT | Yau Ma Tei |
|
| 150 |
+
| | | MOK | Mong Kok |
|
| 151 |
+
| | | PRE | Prince Edward |
|
| 152 |
+
| | | SKM | Shek Kip Mei |
|
| 153 |
+
| | | KOT | Kowloon Tong |
|
| 154 |
+
| | | LOF | Lok Fu |
|
| 155 |
+
| KTL | Kwun Tong Line | WTS | Wong Tai Sin |
|
| 156 |
+
| | | DIH | Diamond Hill |
|
| 157 |
+
| | | CHH | Choi Hung |
|
| 158 |
+
| | | KOB | Kowloon Bay |
|
| 159 |
+
| | | NTK | Ngau Tau Kok |
|
| 160 |
+
| | | KWT | Kwun Tong |
|
| 161 |
+
| | | LAT | Lam Tin |
|
| 162 |
+
| | | YAT | Yau Tong |
|
| 163 |
+
| | | TIK | Tiu Keng Leng |
|
| 164 |
+
| DRL | Disneyland Resort | SUN | Sunny Bay |
|
| 165 |
+
| | Line | DIS | Disneyland Resort |
|
| 166 |
+
|
| 167 |
+
The following table shows the optional variable, lang, which specify the language of the retuned result. The default language is English.
|
| 168 |
+
|
| 169 |
+
<!-- image -->
|
| 170 |
+
|
| 171 |
+
| Parameter 3 (lang) - Optional | Description |
|
| 172 |
+
|---------------------------------|---------------------|
|
| 173 |
+
| EN | English (Default) |
|
| 174 |
+
| TC | Traditional Chinese |
|
| 175 |
+
|
| 176 |
+
<!-- image -->
|
| 177 |
+
|
| 178 |
+
## 2. Description of returned result
|
| 179 |
+
|
| 180 |
+
The returned result is in JSON format. The data type and description of retuned data is listed in below table.
|
| 181 |
+
|
| 182 |
+
| Name of JSON data | Data Type | Description |
|
| 183 |
+
|-----------------------------------------------------------------------|------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 184 |
+
| status | Numbers | system status code value: "1" = normal '0' = error or alert |
|
| 185 |
+
| message | Strings | Alert message |
|
| 186 |
+
| url (optional) | Strings | URL for Special Train Services Arrangement case. |
|
| 187 |
+
| curr_time | Strings, 19 digits alphanumeric in the format of "yyyy-MM-dd HH:mm:ss" | Current date and time |
|
| 188 |
+
| sys_time | Strings | System date and time |
|
| 189 |
+
| Isdelay (optional) | Strings | Indicate if the train is delayed. Value: "Y" = train is delayed 'N' = train is running on time |
|
| 190 |
+
| The below describes the key information within the data array format. | The below describes the key information within the data array format. | The below describes the key information within the data array format. |
|
| 191 |
+
| UP/DOWN | Array format | Indicate the destinations of the train in the specific line. AEL (Airport Express) UP: AIR (Airport) / AWE (AsiaWorld Expo) DOWN: HOK (Hong Kong) TCL (Tung Chung Line) UP: TUC (Tung Chung) DOWN: HOK (Hong Kong) TML (Tuen Ma Line) UP: TUM (Tuen Mun) DOWN: WKS (Wu Kai Sha) TKL (Tseung Kwan O Line) UP: POA (Po Lam) / LHP (LOHAS Park) DOWN: TIK (Tiu Keng Leng) / NOP (North Point) EAL (East Rail Line) UP: LMC (Lok Ma Chau) / LOW (Lo Wu) / SHS (Sheung Shui) / TAP (Tai Po Market) / RAC (Racecourse) / FOT (Fo Tan) / SHT (Sha Tin) DOWN: ADM (Admiralty) / HUH(Hung Hom) / MKK(MongKok East) SIL (South Island Line) UP: SOH (South Horizons) DOWN: ADM (Admiralty) TWL (Tsuen Wan Line) UP: TSW (Tsuen Wan) |
|
| 192 |
+
|
| 193 |
+
<!-- image -->
|
| 194 |
+
|
| 195 |
+
| Name of JSON data | Data Type | Description |
|
| 196 |
+
|---------------------|------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 197 |
+
| | | DOWN: CEN (Central) ISL (Island Line) UP: CHW (Chai Wan) DOWN: KET (Kennedy Town) KTL (Kwun Tong Line) UP: TIK (Tiu Keng Leng) DOWN: WHA (Whampoa) DRL (Disneyland Resort Line) UP: SUN (Sunny Bay) DOWN: DIS (Disneyland Resort) |
|
| 198 |
+
| ttnt | Dummy | N/A |
|
| 199 |
+
| valid | Dummy | N/A |
|
| 200 |
+
| plat | Numbers | Platform numbers for the departure / arrival train |
|
| 201 |
+
| time | Strings, 19 digits alphanumeric in the format of "yyyy-MM-dd HH:mm:ss" | Estimated arrival time (or departure time) of the train |
|
| 202 |
+
| source | Dummy | N/A |
|
| 203 |
+
| dest | Strings, 3 characters | MTR Station Code in capital letters |
|
| 204 |
+
| seq | Numbers | The sequence of the 4 upcoming trains. Value: 1,2,3,4 |
|
| 205 |
+
| timetype (optional) | Strings, 1 character | Special field apply for EAL only. Indicate the train is arrive or depart from the station. Value: 'A' = Arrival 'D' = Departure |
|
| 206 |
+
| route (optional) | Strings | Special field apply for EAL only. Indicate the train to destination via Racecourse station instead of Fo Tan station. Value: '' = Normal 'RAC' = Via Racecourse station |
|