12 Commits

Author SHA1 Message Date
88b75e3e62 Add additional codes, 4601 & 6594
All checks were successful
Generate Release / validate_and_release (push) Successful in 4s
2026-04-02 11:20:50 +01:00
a241b992ac Add future considerations
All checks were successful
Generate Release / validate_and_release (push) Successful in 6s
2026-03-19 06:35:11 +00:00
5722e5b631 Update README.md
All checks were successful
Generate Release / validate_and_release (push) Successful in 7s
2026-03-18 19:24:05 +00:00
eac8d71613 Force new PIS Generation
All checks were successful
Generate Release / validate_and_release (push) Successful in 8s
2026-03-02 23:07:36 +00:00
f08a579246 Add semi-colons to match personal code style
All checks were successful
Generate Release / validate_and_release (push) Successful in 8s
2026-02-21 19:43:17 +00:00
adb538cbc4 Fix JSONL inclusion?
All checks were successful
Generate Release / validate_and_release (push) Successful in 6s
2026-01-03 23:42:06 +00:00
d00eb5cf6c Try fix included files again
All checks were successful
Generate Release / validate_and_release (push) Successful in 6s
2026-01-03 23:39:28 +00:00
247a997353 Fix path to JSONL
All checks were successful
Generate Release / validate_and_release (push) Successful in 5s
2026-01-03 23:38:24 +00:00
cc14397588 Fix YAML Parsing in jsonl generator
All checks were successful
Generate Release / validate_and_release (push) Successful in 5s
2026-01-03 23:36:43 +00:00
d058ba8eed Add jsonl output to releases
Some checks failed
Generate Release / validate_and_release (push) Failing after 7s
2026-01-03 23:35:58 +00:00
36243c7457 Remove 'toc' from output files, this will be handled by data-ingress 2026-01-03 23:11:43 +00:00
1969e90394 pis-update-20251204 (#1)
All checks were successful
Generate Release / validate_and_release (push) Successful in 5s
Merge new PIS Updates

Co-authored-by: Fred Boniface <fred@fjla.uk>
Co-authored-by: Robotic Owl <owlbot@owlboard.info>
Reviewed-on: #1
2025-12-04 21:36:29 +00:00
8 changed files with 93 additions and 34 deletions

View File

@@ -9,7 +9,7 @@ on:
- pis-* - pis-*
jobs: jobs:
validate_and_release: validate_and_PR:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
@@ -27,9 +27,10 @@ jobs:
run: node ./scripts/merge-yaml.js run: node ./scripts/merge-yaml.js
- name: Commit Changes - name: Commit Changes
id: commit
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5 uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
with: with:
commit_message: Sort & Merge PIS Files commit_message: Sort & Merge PIS Files
commit_user_name: owlbot commit_user_name: owlbot
commit_user_email: owlbot@owlboard.info commit_user_email: owlbot@owlboard.info
commit_author: Robotic Owl <owlbot@owlboard.info> commit_author: Robotic Owl <owlbot@owlboard.info>

View File

@@ -20,6 +20,21 @@ jobs:
id: timestamp id: timestamp
run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M%S')" run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M%S')"
- name: Install Dependencies
run: npm i
- name: Create JSON Lines
run: node ./scripts/ndjson-out.js ./pis/codes.yaml
- name: Verify JSONL Output
run: |
if [ ! -s pis-objects.jsonl ]; then
echo "Error: pis-objects.jsonl is empty or missong"
exit 1
fi
echo "File verified"
pwd
- name: Create Release - name: Create Release
if: success() if: success()
uses: akkuman/gitea-release-action@v1 uses: akkuman/gitea-release-action@v1
@@ -30,3 +45,5 @@ jobs:
tag_name: ${{ steps.timestamp.outputs.date }} tag_name: ${{ steps.timestamp.outputs.date }}
name: ${{ steps.timestamp.outputs.date }} name: ${{ steps.timestamp.outputs.date }}
token: ${{ secrets.OWLBOT_KEY }} token: ${{ secrets.OWLBOT_KEY }}
files: |-
pis-objects.jsonl

2
.gitignore vendored Normal file
View File

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

View File

@@ -2,4 +2,25 @@
APIS Codes for GWR Class 150, 158 & 16x units APIS Codes for GWR Class 150, 158 & 16x units
Re-initialised in a new repository on 04/12/2025. This decision was made to keep one data type, in one repository to maintain separation of data-ingress services in preparation for the 2026 data-ingress project. Re-initialised in a new repository on 04/12/2025. This decision was made to keep one data type, in one repository to maintain separation of data-ingress services in preparation for the 2026 data-ingress project.
Data is prepared for the data-ingress service using Gitea actions, any changes made to the actions require care to ensure it doesn't break the ingress of data to OwlBoard.
## Making Changes
Updates should be made in a branch following the naming pattern:
```
branches:
- auto-*
- pis-*
```
Updated should be placed in to a new file in the /pis/ directory.
Code deletions must be made in the 'main' branch.
## Future Considerations
Adding traction type field to cover 80x generic headcodes, and whatever 175's use if not the same as other units.

View File

@@ -1,4 +1,8 @@
pis: pis:
- code: "4601"
stops: [cdf,nwp,stj,fit,bri,bth,boa,tro,wsb,wmn,sal,rom,sou,frm]
- code: "6594"
stops: [gcr,yae,bpw,fit,asd,srd,lwh,bri]
- code: "0106" - code: "0106"
stops: [slo,wnc] stops: [slo,wnc]
toc: "gw" toc: "gw"
@@ -1835,12 +1839,6 @@ pis:
- code: "5351" - code: "5351"
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,egg,umb,bnp] stops: [exc,exd,ntc,cdi,yeo,cop,mrd,egg,umb,bnp]
toc: "gw" toc: "gw"
- code: "5351"
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,egg,umb,bnp]
toc: "gw"
- code: "5352"
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,lap,egg,kgn,pma,umb,cpn,bnp]
toc: "gw"
- code: "5352" - code: "5352"
stops: [exc,exd,ntc,cdi,yeo,cop,mrd,lap,egg,kgn,pma,umb,cpn,bnp] stops: [exc,exd,ntc,cdi,yeo,cop,mrd,lap,egg,kgn,pma,umb,cpn,bnp]
toc: "gw" toc: "gw"
@@ -1931,9 +1929,6 @@ pis:
- code: "5381" - code: "5381"
stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,ext,scs,dww,dwl,tgm,nta,trr,tqy,pgn] stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,ext,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw" toc: "gw"
- code: "5381"
stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,ext,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw"
- code: "5382" - code: "5382"
stops: [exm,lym,top,nco,dig,exc,exd,dwl,tgm,nta,trr,tqy,pgn] stops: [exm,lym,top,nco,dig,exc,exd,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw" toc: "gw"
@@ -3857,9 +3852,6 @@ pis:
- code: "6051" - code: "6051"
stops: [exc,exd,ntc,cdi,oke] stops: [exc,exd,ntc,cdi,oke]
toc: "gw" toc: "gw"
- code: "6051"
stops: [exc,exd,ntc,cdi,oke]
toc: "gw"
- code: "6052" - code: "6052"
stops: [exd,cdi,oke] stops: [exd,cdi,oke]
toc: "gw" toc: "gw"
@@ -4202,9 +4194,6 @@ pis:
- code: "6182" - code: "6182"
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn] stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw" toc: "gw"
- code: "6182"
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw"
- code: "6183" - code: "6183"
stops: [pgn,tqy,trr,nta,tgm,dwl,dww,scs,mbt,ext,exd,exc,dig,nco,top,lym,exm] stops: [pgn,tqy,trr,nta,tgm,dwl,dww,scs,mbt,ext,exd,exc,dig,nco,top,lym,exm]
toc: "gw" toc: "gw"
@@ -4415,9 +4404,6 @@ pis:
- code: "6293" - code: "6293"
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dwl,tgm,nta,trr,tqy,pgn] stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw" toc: "gw"
- code: "6293"
stops: [exm,lym,top,nco,dig,exc,exd,ext,mbt,scs,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw"
- code: "6294" - code: "6294"
stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,dwl,tgm,nta,trr,tqy,pgn] stops: [exm,lym,lyc,exn,top,nco,dig,pol,sjp,exc,exd,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw" toc: "gw"
@@ -4622,6 +4608,9 @@ pis:
- code: "6384" - code: "6384"
stops: [bri,lwh,srd,asd,fit] stops: [bri,lwh,srd,asd,fit]
toc: "gw" toc: "gw"
- code: "6404"
stops: [cdf,nwp,fit,bri,bth,boa,tro,wsb,wmn,sal]
toc: "gw"
- code: "6406" - code: "6406"
stops: [pmh,pms,ftn,csa,frm,sou] stops: [pmh,pms,ftn,csa,frm,sou]
toc: "gw" toc: "gw"
@@ -4637,6 +4626,9 @@ pis:
- code: "6413" - code: "6413"
stops: [exm,lym,lyc,exn,top,dig,pol,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn] stops: [exm,lym,lyc,exn,top,dig,pol,exc,exd,ext,mbt,scs,dww,dwl,tgm,nta,trr,tqy,pgn]
toc: "gw" toc: "gw"
- code: "6417"
stops: [sal,wmn,wsb,tro,boa,brh,bri,fit,stj,nwp,cdf]
toc: "gw"
- code: "6418" - code: "6418"
stops: [cdf,nwp,fit,bri,bth,boa,tro,wsb,wmn] stops: [cdf,nwp,fit,bri,bth,boa,tro,wsb,wmn]
toc: "gw" toc: "gw"

View File

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

27
scripts/ndjson-out.js Normal file
View File

@@ -0,0 +1,27 @@
const fs = require('fs');
const yaml = require('yaml');
const inputFile = process.argv[2];
const outputFile = 'pis-objects.jsonl';
if (!inputFile) {
console.error('Please provide an input YAML file');
process.exit(1);
}
try {
const fileContent = fs.readFileSync(inputFile, 'utf8');
const data = yaml.parse(fileContent);
if (!data || !data.pis || !Array.isArray(data.pis)) {
throw new Error('Invalid structure: Expected object with "pis" array.');
}
const jsonl = data.pis.map(item => JSON.stringify(item));
fs.writeFileSync(outputFile, jsonl.join('\n') + '\n');
console.log(`Successfully processed ${data.pis.length} items.`);
} catch (e) {
console.error("Conversion failed: ", e.message);
process.exit(1);
}

0
scripts/test.yaml Normal file
View File