Skip to content

Commit 3018eca

Browse files
authored
Merge pull request #330 from The-Strategy-Unit/327_create-json-schema
Create json schema for validating params
2 parents d7775cb + 2258533 commit 3018eca

File tree

5 files changed

+1468
-19
lines changed

5 files changed

+1468
-19
lines changed

.github/workflows/deploy_dev.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ on:
77
name: Deploy Dev
88

99
jobs:
10-
deploy-dev:
10+
deploy-dev-model:
1111
uses: ./.github/workflows/build_container.yaml
1212
with:
1313
app-version: dev
1414
data-version: dev
1515
secrets: inherit
16+
17+
deploy-dev-schema:
18+
uses: ./github/workflows/deploy_schema.yaml
19+
with:
20+
app-version: dev
21+
secrets: inherit
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
on:
2-
push:
3-
tags:
4-
- 'v*.*.*'
5-
6-
name: Deploy Production
7-
8-
jobs:
9-
deploy-production:
10-
11-
uses: ./.github/workflows/build_container.yaml
12-
with:
13-
app-version: ${{github.ref_name}}
14-
data-version: ${{vars.data_version}}
15-
latest: true
16-
secrets: inherit
1+
on:
2+
push:
3+
tags:
4+
- 'v*.*.*'
5+
6+
name: Deploy Production
7+
8+
jobs:
9+
deploy-production:
10+
11+
uses: ./.github/workflows/build_container.yaml
12+
with:
13+
app-version: ${{github.ref_name}}
14+
data-version: ${{vars.data_version}}
15+
latest: true
16+
secrets: inherit
17+
18+
deploy-schema:
19+
20+
uses: ./.github/workflows/deploy_schema.yaml
21+
with:
22+
app_version: ${{github.ref_name}}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy schema.json to GitHub Pages
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
app-version:
7+
required: true
8+
type: string
9+
10+
permissions:
11+
pages: write
12+
id-token: write
13+
contents: read
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Extract major-minor from app-version (non-dev)
23+
if: inputs.app-version != 'dev'
24+
id: version
25+
run: |
26+
full_version="${{ inputs.app-version }}"
27+
short_version=$(echo "$full_version" | grep -oP '^v\d+\.\d+' | sed 's/\./-/')
28+
echo "Stripped app version: $short_version"
29+
echo "version_dir=$short_version" >> $GITHUB_OUTPUT
30+
31+
- name: Set version_dir for dev
32+
if: inputs.app-version == 'dev'
33+
id: version
34+
run: |
35+
echo "Using dev version_dir"
36+
echo "version_dir=dev" >> $GITHUB_OUTPUT
37+
38+
- name: Clone existing GitHub Pages content
39+
run: |
40+
git clone --depth=1 --branch gh-pages https://github.com/${{ github.repository }} gh-pages || mkdir gh-pages
41+
mkdir -p output
42+
cp -r gh-pages/* output/ || true
43+
44+
- name: Copy schema to app version path
45+
run: |
46+
mkdir -p output/${{ steps.version.outputs.version_dir }}
47+
cp schemas/params-schema.json \
48+
output/${{ steps.version.outputs.version_dir }}/params-schema.json
49+
50+
- name: Upload to GitHub Pages
51+
uses: actions/upload-pages-artifact@v2
52+
with:
53+
path: output
54+
55+
deploy:
56+
needs: build
57+
runs-on: ubuntu-latest
58+
environment:
59+
name: github-pages
60+
url: ${{ steps.deployment.outputs.page_url }}
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v3

queue/sample_params.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@
14061406
0.95
14071407
]
14081408
},
1409-
"general_los_reduction_non-elective": {
1409+
"general_los_reduction_emergency": {
14101410
"type": "all",
14111411
"interval": [
14121412
0.84,
@@ -1563,7 +1563,7 @@
15631563
"day_procedures_occasionally_op": "linear",
15641564
"day_procedures_usually_dc": "linear",
15651565
"day_procedures_usually_op": "linear",
1566-
"general_los_reduction_non-elective": "linear",
1566+
"general_los_reduction_emergency": "linear",
15671567
"general_los_reduction_elective": "linear",
15681568
"virtual_wards_efficiencies_ari": "linear",
15691569
"virtual_wards_efficiencies_heart_failure": "linear"

0 commit comments

Comments
 (0)