Compare commits

..

No commits in common. "main" and "20240301_125106" have entirely different histories.

6 changed files with 2646 additions and 5412 deletions

View File

@ -5,14 +5,10 @@ on:
push: push:
branches: branches:
- auto-* - auto-*
- workflow_update
- pis-*
jobs: jobs:
validate_and_release: validate_and_release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
steps: steps:
- name: Check out Repo code - name: Check out Repo code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -20,16 +16,12 @@ jobs:
- name: Validate YAML - name: Validate YAML
uses: https://github.com/GrantBirki/json-yaml-validate@v2.6.1 uses: https://github.com/GrantBirki/json-yaml-validate@v2.6.1
- name: Install Dependencies - name: Create PR
run: npm i uses: https://github.com/peter-evans/create-pull-request@v6
- name: Merge to gw.yaml
run: node ./scripts/merge-yaml.js
- name: Commit Changes
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
with: with:
commit_message: Sort & Merge PIS Files token: ${{ secrets.OWLBOT_KEY }}
commit_user_name: owlbot committer: OwlBot <owlbot@owlboard.info>
commit_user_email: owlbot@owlboard.info signoff: true
commit_author: owlbot <owlbot@owlboard.info> title: Merge Changes
reviewers: fred.boniface
branch: main

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
node_modules
package-lock.json

View File

@ -1,449 +0,0 @@
<?xml version="1.0", encoding="utf-8"?>
<!-- Contains stations which are included in LDBSVWS but not in
knowledgebase, such as ferry terminals with departure data
but no train services.
The data here is formatted such that it can be appended to
knowledgebase stations data while it is being parsed.
The combined output can be used to validate requests to
LDBSVWS (or the public version) to reduce API requests
that will return no data
Only a subset of the information included in the knowledgebase
is included for these locations
-->
<StationList>
<Station>
<CrsCode>YMH</CrsCode>
<Name>Yarmouth (Isle of Wight)</Name>
<SixteenCharacterName>YARMOUTH IOW</SixteenCharacterName>
<Longitude>-1.500656</Longitude>
<Latitude>50.706512</Latitude>
</Station>
<Station>
<CrsCode>RTY</CrsCode>
<Name>Rothesay, Bute (Ferry/Bus)</Name>
<SixteenCharacterName>Rothesay Bute</SixteenCharacterName>
<Longitude>-5.054006</Longitude>
<Latitude>55.838897</Latitude>
</Station>
<Station>
<CrsCode>BFA</CrsCode>
<Name>Belfast Port</Name>
<SixteenCharacterName>BELFAST PORT</SixteenCharacterName>
<Longitude>-5.889967</Longitude>
<Latitude>54.628623</Latitude>
</Station>
<Station>
<CrsCode>CRP</CrsCode>
<Name>Cairnryan Port</Name>
<SixteenCharacterName>Cairnryan Port</SixteenCharacterName>
<Longitude>-5.036245</Longitude>
<Latitude>54.985075</Latitude>
</Station>
<Station>
<CrsCode>DPS</CrsCode>
<Name>Dublin Port (Stena)</Name>
<SixteenCharacterName>Dublin Stena</SixteenCharacterName>
<Longitude>-6.196574</Longitude>
<Latitude>53.344992</Latitude>
</Station>
<Station>
<CrsCode>DFP</CrsCode>
<Name>Dublin Ferryport</Name>
<SixteenCharacterName></SixteenCharacterName>
<Longitude>-6.196574</Longitude>
<Latitude>53.344992</Latitude>
</Station>
<Station>
<CrsCode>HTR</CrsCode>
<Name>Heathrow Central (Bus)</Name>
<SixteenCharacterName>Heathrow Central</SixteenCharacterName>
<Longitude>-0.452915</Longitude>
<Latitude>51.471207</Latitude>
</Station>
<Station>
<CrsCode>PMG</CrsCode>
<Name>Porthmadog (FR)</Name>
<SixteenCharacterName>Porthmadog FR</SixteenCharacterName>
<Longitude>-4.126746</Longitude>
<Latitude>52.923882</Latitude>
</Station>
<Station>
<CrsCode>LSM</CrsCode>
<Name>Isle of Lismore</Name>
<SixteenCharacterName>Isle of Lismore</SixteenCharacterName>
<Longitude>-5.491786</Longitude>
<Latitude>56.511869</Latitude>
</Station>
<Station>
<CrsCode>BDC</CrsCode>
<Name>Brodick (Arran)</Name>
<SixteenCharacterName>Brodick Arran</SixteenCharacterName>
<Longitude>-5.136372</Longitude>
<Latitude>55.577074</Latitude>
</Station>
<Station>
<CrsCode>RSB</CrsCode>
<Name>Rosslare Harbour</Name>
<SixteenCharacterName>Rosslare Harbour</SixteenCharacterName>
<Longitude>-6.338626</Longitude>
<Latitude>52.255216</Latitude>
</Station>
<Station>
<CrsCode>SCB</CrsCode>
<Name>Scrabster Harbour</Name>
<SixteenCharacterName>Scrabster</SixteenCharacterName>
<Longitude>-3.544390</Longitude>
<Latitude>58.611545</Latitude>
</Station>
<Station>
<CrsCode>CTB</CrsCode>
<Name>Castlebay (Barra)</Name>
<SixteenCharacterName>Castlebay Bus</SixteenCharacterName>
<Longitude>-7.488614</Longitude>
<Latitude>56.954392</Latitude>
</Station>
<Station>
<CrsCode>ULP</CrsCode>
<Name>Ullapool</Name>
<SixteenCharacterName>Ullapool</SixteenCharacterName>
<Longitude>-5.160333</Longitude>
<Latitude>57.895064</Latitude>
</Station>
<Station>
<CrsCode>SOY</CrsCode>
<Name>Stornoway (Lewis)</Name>
<SixteenCharacterName>Stornoway</SixteenCharacterName>
<Longitude>-6.387503</Longitude>
<Latitude>58.206323</Latitude>
</Station>
<Station>
<CrsCode>CRU</CrsCode>
<Name>Craignure (Mull)</Name>
<SixteenCharacterName>Craignure</SixteenCharacterName>
<Longitude>-5.704677</Longitude>
<Latitude>56.471517</Latitude>
</Station>
<Station>
<CrsCode>CUL</CrsCode>
<Name>Great Cumbrae (Island)</Name>
<SixteenCharacterName>Cumbrae</SixteenCharacterName>
<Longitude>-4.897916</Longitude>
<Latitude>55.786682</Latitude>
</Station>
<Station>
<CrsCode>KCG</CrsCode>
<Name>Kilcreggan Pier</Name>
<SixteenCharacterName>Kilcreggan</SixteenCharacterName>
<Longitude>-4.819737</Longitude>
<Latitude>55.984028</Latitude>
</Station>
<Station>
<CrsCode>HVH</CrsCode>
<Name>Hoek van Holland</Name>
<SixteenCharacterName></SixteenCharacterName>
<Longitude>4.129120</Longitude>
<Latitude>51.974027</Latitude>
</Station>
<Station>
<CrsCode>DUO</CrsCode>
<Name>Dunoon Pier</Name>
<SixteenCharacterName>Dunoon</SixteenCharacterName>
<Longitude>-4.921664</Longitude>
<Latitude>55.945575</Latitude>
</Station>
<Station>
<CrsCode>LCB</CrsCode>
<Name>Lochboisdale (South Uist)</Name>
<SixteenCharacterName>Lochboisdale</SixteenCharacterName>
<Longitude>-7.303972</Longitude>
<Latitude>57.152210</Latitude>
</Station>
<Station>
<CrsCode>UIG</CrsCode>
<Name>Uig (Isle of Skye)</Name>
<SixteenCharacterName>Uig, Skye</SixteenCharacterName>
<Longitude>-6.371742</Longitude>
<Latitude>57.585249</Latitude>
</Station>
<Station>
<CrsCode>TBT</CrsCode>
<Name>Tarbert (Isle of Lewis)</Name>
<SixteenCharacterName>Tarbert, Lewis</SixteenCharacterName>
<Longitude>-6.799399</Longitude>
<Latitude>57.897030</Latitude>
</Station>
<Station>
<CrsCode>LCH</CrsCode>
<Name>Lochmaddy (North Uist)</Name>
<SixteenCharacterName>Lochmaddy</SixteenCharacterName>
<Longitude>-7.157484</Longitude>
<Latitude>57.596520</Latitude>
</Station>
<Station>
<CrsCode>LVS</CrsCode>
<Name>Liverpool Landing Stage</Name>
<SixteenCharacterName>Livpool Land Stg</SixteenCharacterName>
<Longitude>-2.998774</Longitude>
<Latitude>53.406600</Latitude>
</Station>
<Station>
<CrsCode>KWK</CrsCode>
<Name>Keswick Bus Station</Name>
<SixteenCharacterName>Keswick Bus Stn</SixteenCharacterName>
<Longitude>-3.141946</Longitude>
<Latitude>54.601462</Latitude>
</Station>
<Station>
<CrsCode>DGS</CrsCode>
<Name>Douglas (Isle of Man)</Name>
<SixteenCharacterName>Douglas IOM</SixteenCharacterName>
<Longitude>-4.471736</Longitude>
<Latitude>54.147904</Latitude>
</Station>
<Station>
<CrsCode>DEB</CrsCode>
<Name>Dereham Bus (Market Place)</Name>
<SixteenCharacterName>Dereham Bus</SixteenCharacterName>
<Longitude>-0.940602</Longitude>
<Latitude>52.681599</Latitude>
</Station>
<Station>
<CrsCode>EMA</CrsCode>
<Name>East Midlands Airport (Bus)</Name>
<SixteenCharacterName>E Midlands Aprt.</SixteenCharacterName>
<Longitude>-1.330462</Longitude>
<Latitude>52.825718</Latitude>
</Station>
<Station>
<CrsCode>SGQ</CrsCode>
<Name>Stone (Granville Square, Bus)</Name>
<SixteenCharacterName>Granville Square</SixteenCharacterName>
<Longitude>-2.148309</Longitude>
<Latitude>52.903549</Latitude>
</Station>
<Station>
<CrsCode>LUB</CrsCode>
<Name>Luton Airport (Bus)</Name>
<SixteenCharacterName>Luton Airport</SixteenCharacterName>
<Longitude>-0.375259</Longitude>
<Latitude>51.879070</Latitude>
</Station>
<Station>
<CrsCode>EDA</CrsCode>
<Name>Edinburgh Airport (Bus)</Name>
<SixteenCharacterName>Edinburgh Airpt</SixteenCharacterName>
<Longitude>-3.358012</Longitude>
<Latitude>55.947523</Latitude>
</Station>
<Station>
<CrsCode>SAI</CrsCode>
<Name>Sheffield Arena (Tram)</Name>
<SixteenCharacterName>Sheffield Arena</SixteenCharacterName>
<Longitude>-1.420300</Longitude>
<Latitude>53.398331</Latitude>
</Station>
<Station>
<CrsCode>XCF</CrsCode>
<Name>Cardiff Airport (Bus)</Name>
<SixteenCharacterName>Cardiff Airport</SixteenCharacterName>
<Longitude>-3.339034</Longitude>
<Latitude>51.398851</Latitude>
</Station>
<Station>
<CrsCode>XAA</CrsCode>
<Name>Galashiels Bus Station</Name>
<SixteenCharacterName>Galashiels Bus</SixteenCharacterName>
<Longitude>-2.805677</Longitude>
<Latitude>55.617594</Latitude>
</Station>
<Station>
<CrsCode>FRH</CrsCode>
<Name>Calais Frethun</Name>
<SixteenCharacterName>Calais Frethun</SixteenCharacterName>
<Longitude>1.821091</Longitude>
<Latitude>50.921963</Latitude>
</Station>
<Station>
<CrsCode>PBN</CrsCode>
<Name>Paris Gare du Nord</Name>
<SixteenCharacterName>Paris Nord</SixteenCharacterName>
<Longitude>2.355725</Longitude>
<Latitude>48.880557</Latitude>
</Station>
<Station>
<CrsCode>AMS</CrsCode>
<Name>Amsterdam Centraal</Name>
<SixteenCharacterName>Amsterdan Ctl</SixteenCharacterName>
<Longitude>4.900461</Longitude>
<Latitude>52.378672</Latitude>
</Station>
<Station>
<CrsCode>BXS</CrsCode>
<Name>Brussels Midi</Name>
<SixteenCharacterName>Brussels Midi</SixteenCharacterName>
<Longitude>4.336522</Longitude>
<Latitude>50.835096</Latitude>
</Station>
<Station>
<CrsCode>SGE</CrsCode>
<Name>Swanage (Swanage Rly)</Name>
<SixteenCharacterName>SWANAGE</SixteenCharacterName>
<Longitude>-1.960048</Longitude>
<Latitude>50.609976</Latitude>
</Station>
<Station>
<CrsCode>HAR</CrsCode>
<Name>Harmans Cross (Swanage Rly)</Name>
<SixteenCharacterName>Harmans Cross</SixteenCharacterName>
<Longitude>-2.027277</Longitude>
<Latitude>50.619897</Latitude>
</Station>
<Station>
<CrsCode>CFC</CrsCode>
<Name>Corfe Castle (Swanage Rly)</Name>
<SixteenCharacterName>Corfe Castle</SixteenCharacterName>
<Longitude>-2.054689</Longitude>
<Latitude>50.638107</Latitude>
</Station>
<Station>
<CrsCode>NOD</CrsCode>
<Name>Norden (Swanage Rly)</Name>
<SixteenCharacterName>Norden</SixteenCharacterName>
<Longitude>-2.062072</Longitude>
<Latitude>50.644630</Latitude>
</Station>
<Station>
<CrsCode>HEH</CrsCode>
<Name>Herston Halt (Swanage Rly)</Name>
<SixteenCharacterName>Herston Halt</SixteenCharacterName>
<Longitude>-1.980250</Longitude>
<Latitude>50.613084</Latitude>
</Station>
<Station>
<CrsCode>MHD</CrsCode>
<Name>Minehead (WSR/Bus)</Name>
<SixteenCharacterName>Minehead</SixteenCharacterName>
<Longitude>-3.469013</Longitude>
<Latitude>51.206834</Latitude>
</Station>
<Station>
<CrsCode>XDY</CrsCode>
<Name>Dunster (Bus)</Name>
<SixteenCharacterName>Dunster</SixteenCharacterName>
<Longitude>-3.444564</Longitude>
<Latitude>51.182943</Latitude>
</Station>
<Station>
<CrsCode>WCT</CrsCode>
<Name>Watchet (WSR/Bus)</Name>
<SixteenCharacterName>Watchet</SixteenCharacterName>
<Longitude>-3.329689</Longitude>
<Latitude>51.180929</Latitude>
</Station>
<Station>
<CrsCode>BIB</CrsCode>
<Name>Bishops Lydeard (WSR)</Name>
<SixteenCharacterName>Bishops Lydeard</SixteenCharacterName>
<Longitude>-3.193899</Longitude>
<Latitude>51.053827</Latitude>
</Station>
<Station>
<CrsCode>XLU</CrsCode>
<Name>Bishops Lydeard (Bus)</Name>
<SixteenCharacterName>Bishop Lyd (BUS)</SixteenCharacterName>
<Longitude>-3.187749</Longitude>
<Latitude>51.056697</Latitude>
</Station>
<Station>
<CrsCode>YVB</CrsCode>
<Name>Yeovil Bus Station</Name>
<SixteenCharacterName>Yeovil (BUS)</SixteenCharacterName>
<Longitude>-2.627254</Longitude>
<Latitude>50.942009</Latitude>
</Station>
<Station>
<CrsCode>FLZ</CrsCode>
<Name>Flamingo Land (Bus)</Name>
<SixteenCharacterName>Flamingo Land</SixteenCharacterName>
<Longitude>-0.808575</Longitude>
<Latitude>54.208536</Latitude>
</Station>
<Station>
<CrsCode>XBR</CrsCode>
<Name>Midsomer Norton (Bus)</Name>
<SixteenCharacterName>Midsomer Norton</SixteenCharacterName>
<Longitude>-2.482952</Longitude>
<Latitude>51.285678</Latitude>
</Station>
<Station>
<CrsCode>XEQ</CrsCode>
<Name>Radstock (Bus)</Name>
<SixteenCharacterName>Radstock</SixteenCharacterName>
<Longitude>-2.447870</Longitude>
<Latitude>51.291644</Latitude>
</Station>
<Station>
<CrsCode>XKW</CrsCode>
<Name>Blackwood Bus Station</Name>
<SixteenCharacterName>Blackwood</SixteenCharacterName>
<Longitude>-3.195482</Longitude>
<Latitude>51.665032</Latitude>
</Station>
</StationList>

View File

@ -1,14 +0,0 @@
{
"name": "merge-yaml",
"version": "1.0.0",
"description": "Contains OwlBoard provided data. Queried programatically by the OwlBoard dbmanager application to be loaded into the database.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"yaml": "^2.4.1"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,69 +0,0 @@
const fs = require('fs')
const yaml = require('yaml')
const directoryPath = './pis/'
function sortAndMergeYAMLFiles() {
try {
const files = fs.readdirSync(directoryPath);
let mergedData = [];
files.forEach(file => {
const data = fs.readFileSync(directoryPath + file, 'utf-8');
const parsedData = yaml.parse(data)
if (parsedData && typeof parsedData === 'object' && parsedData.pis) {
mergedData.push(...parsedData.pis)
} else {
if (Array.isArray(parsedData)) {
mergedData.push(...parsedData);
} else {
console.error("Incorrect YAML")
}
}
});
mergedData.sort((a, b) => {
const codeA = parseInt(a.code);
const codeB = parseInt(b.code);
return codeA - codeB
})
// Construct the output string, removing duplicates
let outputString = "pis:\n";
const seenCodes = new Set();
mergedData.forEach(item => {
if (!seenCodes.has(item.code) && item.stops.length > 0) {
seenCodes.add(item.code);
outputString += ` - code: "${item.code}"\n`;
outputString += ` stops: [${item.stops.map(stop => `${stop}`).join(',')}]\n`;
outputString += ` toc: "${item.toc || "gw"}"\n`;
}
});
try {
fs.writeFileSync('./pis/gw.yaml', outputString);
console.log("Overwritten gw.pis")
} catch (err) {
console.error("Error writing gw.pis", err)
}
// Remove any files created by dgp2
files.forEach(file => {
if (file.startsWith('auto-')) {
fs.unlinkSync(directoryPath + file);
console.log(`Deleted file: ${file}`);
}
});
} catch(err) {
console.error('Error merging YAML:', err)
}
}
sortAndMergeYAMLFiles();