@planning-inspectorate/data-model 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.azure/ci.yml +60 -0
- package/.azure/release.yml +57 -0
- package/.github/dependabot.yml +11 -0
- package/.husky/install.mjs +7 -0
- package/.husky/pre-commit +1 -0
- package/.prettierignore +11 -0
- package/.prettierrc +19 -0
- package/LICENSE +21 -0
- package/README.md +237 -0
- package/commitlint.config.js +8 -0
- package/docs/README.md +85 -0
- package/docs/appeal-document.md +776 -0
- package/docs/appeal-event-estimate.md +108 -0
- package/docs/appeal-event.md +404 -0
- package/docs/appeal-has.md +1960 -0
- package/docs/appeal-representation.md +375 -0
- package/docs/appeal-s78.md +3607 -0
- package/docs/appeal.md +1879 -0
- package/docs/case-schedule.md +8 -0
- package/docs/dart-response.md +1413 -0
- package/docs/employee.md +70 -0
- package/docs/entraid.md +108 -0
- package/docs/folder.md +147 -0
- package/docs/gettimesheets-response.md +188 -0
- package/docs/interested-party.md +284 -0
- package/docs/listed-building.md +113 -0
- package/docs/listed-buildings.md +113 -0
- package/docs/nsip-document.md +966 -0
- package/docs/nsip-exam-timetable-defs-event.md +223 -0
- package/docs/nsip-exam-timetable-defs-line-item.md +51 -0
- package/docs/nsip-exam-timetable-defs.md +3 -0
- package/docs/nsip-exam-timetable-submission.md +113 -0
- package/docs/nsip-exam-timetable.md +352 -0
- package/docs/nsip-project-update.md +163 -0
- package/docs/nsip-project.md +2098 -0
- package/docs/nsip-representation-defs-attachment.md +133 -0
- package/docs/nsip-representation-defs.md +3 -0
- package/docs/nsip-representation.md +448 -0
- package/docs/nsip-subscription.md +193 -0
- package/docs/pins-inspector.md +184 -0
- package/docs/pins-lpa.md +260 -0
- package/docs/s51-advice.md +460 -0
- package/docs/service-user.md +575 -0
- package/eslint.config.js +21 -0
- package/jsconfig.json +12 -0
- package/package.json +55 -0
- package/pins_data_model/__init__.py +0 -0
- package/pins_data_model/gen_models.py +51 -0
- package/pins_data_model/load_schemas.py +51 -0
- package/pins_data_model/models/__init__.py +0 -0
- package/pins_data_model/models/model_appeal_document.py +294 -0
- package/pins_data_model/models/model_appeal_event.py +117 -0
- package/pins_data_model/models/model_appeal_event_estimate.py +37 -0
- package/pins_data_model/models/model_appeal_has.py +585 -0
- package/pins_data_model/models/model_appeal_representation.py +132 -0
- package/pins_data_model/models/model_appeal_s78.py +864 -0
- package/pins_data_model/models/model_case_schedule.py +11 -0
- package/pins_data_model/models/model_dart_response.py +292 -0
- package/pins_data_model/models/model_entraid.py +37 -0
- package/pins_data_model/models/model_folder.py +56 -0
- package/pins_data_model/models/model_gettimesheets_response.py +45 -0
- package/pins_data_model/models/model_listed_building.py +33 -0
- package/pins_data_model/models/model_listed_buildings.py +33 -0
- package/pins_data_model/models/model_nsip_document.py +199 -0
- package/pins_data_model/models/model_nsip_exam_timetable.py +90 -0
- package/pins_data_model/models/model_nsip_project.py +488 -0
- package/pins_data_model/models/model_nsip_project_update.py +60 -0
- package/pins_data_model/models/model_nsip_representation.py +83 -0
- package/pins_data_model/models/model_nsip_subscription.py +60 -0
- package/pins_data_model/models/model_pins_inspector.py +53 -0
- package/pins_data_model/models/model_pins_lpa.py +69 -0
- package/pins_data_model/models/model_s51_advice.py +109 -0
- package/pins_data_model/models/model_service_user.py +121 -0
- package/requirements.txt +2 -0
- package/schemas/__init__.py +0 -0
- package/schemas/appeal-document.schema.json +250 -0
- package/schemas/appeal-event-estimate.schema.json +31 -0
- package/schemas/appeal-event.schema.json +123 -0
- package/schemas/appeal-has.schema.json +576 -0
- package/schemas/appeal-representation.schema.json +131 -0
- package/schemas/appeal-s78.schema.json +1060 -0
- package/schemas/commands/__init__.py +0 -0
- package/schemas/commands/appeal-common-submission.schema.json +202 -0
- package/schemas/commands/appeal-has-submission.schema.json +82 -0
- package/schemas/commands/appeal-representation-submission.schema.json +192 -0
- package/schemas/commands/appeal-s78-submission.schema.json +100 -0
- package/schemas/commands/appellant-submission.schema.json +164 -0
- package/schemas/commands/interested-party.schema.json +80 -0
- package/schemas/commands/lpa-questionnaire-common.schema.json +110 -0
- package/schemas/commands/lpa-questionnaire-has.schema.json +69 -0
- package/schemas/commands/lpa-questionnaire-s78.schema.json +218 -0
- package/schemas/commands/lpa-questionnaire.schema.json +125 -0
- package/schemas/commands/new-deadline-submission.schema.json +59 -0
- package/schemas/commands/nsip-exam-timetable-submission.schema.json +27 -0
- package/schemas/commands/register-nsip-subscription.schema.json +32 -0
- package/schemas/commands/register-representation.schema.json +51 -0
- package/schemas/dart-response.schema.json +350 -0
- package/schemas/entraid.schema.json +31 -0
- package/schemas/folder.schema.json +49 -0
- package/schemas/gettimesheets-response.schema.json +46 -0
- package/schemas/listed-building.schema.json +31 -0
- package/schemas/listed-buildings.schema.json +31 -0
- package/schemas/nsip-document.schema.json +235 -0
- package/schemas/nsip-exam-timetable.schema.json +101 -0
- package/schemas/nsip-project-update.schema.json +49 -0
- package/schemas/nsip-project.schema.json +539 -0
- package/schemas/nsip-representation.schema.json +110 -0
- package/schemas/nsip-subscription.schema.json +52 -0
- package/schemas/pins-inspector.schema.json +47 -0
- package/schemas/pins-lpa.schema.json +63 -0
- package/schemas/s51-advice.schema.json +113 -0
- package/schemas/service-user.schema.json +152 -0
- package/setup.py +15 -0
- package/src/enums.cjs +632 -0
- package/src/enums.d.ts +573 -0
- package/src/enums.js +573 -0
- package/src/gen-docs.js +34 -0
- package/src/gen-enums.js +119 -0
- package/src/gen-types.js +70 -0
- package/src/index.cjs +746 -0
- package/src/index.d.ts +18 -0
- package/src/index.js +34 -0
- package/src/lib/load.js +78 -0
- package/src/schemas.d.ts +4570 -0
- package/tests/appeals/appeal-event.test.js +62 -0
- package/tests/appeals/commands/appeal-representation-submission.test.js +107 -0
- package/tests/appeals/commands/has-questionnaire.test.js +92 -0
- package/tests/appeals/commands/has-submission.test.js +113 -0
- package/tests/appeals/commands/s78-questionnaire.test.js +96 -0
- package/tests/appeals/commands/s78-submission.test.js +119 -0
- package/tests/schemas.test.js +97 -0
package/.azure/ci.yml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
trigger:
|
|
2
|
+
branches:
|
|
3
|
+
include:
|
|
4
|
+
- main # run on main before build
|
|
5
|
+
# trigger for merge queue branches
|
|
6
|
+
- gh-readonly-queue/*
|
|
7
|
+
|
|
8
|
+
pr:
|
|
9
|
+
branches:
|
|
10
|
+
include:
|
|
11
|
+
- '*'
|
|
12
|
+
|
|
13
|
+
resources:
|
|
14
|
+
repositories:
|
|
15
|
+
- repository: templates
|
|
16
|
+
type: github
|
|
17
|
+
endpoint: Planning-Inspectorate
|
|
18
|
+
name: Planning-Inspectorate/common-pipeline-templates
|
|
19
|
+
ref: refs/tags/release/3.18.2
|
|
20
|
+
|
|
21
|
+
extends:
|
|
22
|
+
template: stages/wrapper_ci.yml@templates
|
|
23
|
+
parameters:
|
|
24
|
+
skipAzureAuth: true
|
|
25
|
+
validationJobs:
|
|
26
|
+
- name: Run Checks
|
|
27
|
+
steps:
|
|
28
|
+
- template: ../steps/node_script.yml
|
|
29
|
+
parameters:
|
|
30
|
+
nodeVersion: 22
|
|
31
|
+
script: npm ci
|
|
32
|
+
- template: ../steps/node_script.yml
|
|
33
|
+
parameters:
|
|
34
|
+
nodeVersion: 22
|
|
35
|
+
script: npm run commitlint
|
|
36
|
+
- template: ../steps/node_script.yml
|
|
37
|
+
parameters:
|
|
38
|
+
nodeVersion: 22
|
|
39
|
+
script: npm run lint
|
|
40
|
+
- template: ../steps/node_script.yml
|
|
41
|
+
parameters:
|
|
42
|
+
nodeVersion: 22
|
|
43
|
+
script: npm run format-check
|
|
44
|
+
- template: ../steps/node_script.yml
|
|
45
|
+
parameters:
|
|
46
|
+
nodeVersion: 22
|
|
47
|
+
script: npm run gen
|
|
48
|
+
- template: ../steps/node_script.yml
|
|
49
|
+
parameters:
|
|
50
|
+
nodeVersion: 22
|
|
51
|
+
script: node --test
|
|
52
|
+
- script: |
|
|
53
|
+
git status --porcelain
|
|
54
|
+
if [[ `git status --porcelain` ]]; then
|
|
55
|
+
# Changes - generated files out of date! Show changes:
|
|
56
|
+
git diff
|
|
57
|
+
# fail pipeline run
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
displayName: Check no generated files out of date
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
parameters:
|
|
2
|
+
- name: dryRun
|
|
3
|
+
displayName: Dry Run
|
|
4
|
+
type: boolean
|
|
5
|
+
default: false
|
|
6
|
+
|
|
7
|
+
trigger: none
|
|
8
|
+
pr: none
|
|
9
|
+
|
|
10
|
+
resources:
|
|
11
|
+
repositories:
|
|
12
|
+
- repository: templates
|
|
13
|
+
type: github
|
|
14
|
+
endpoint: Planning-Inspectorate
|
|
15
|
+
name: Planning-Inspectorate/common-pipeline-templates
|
|
16
|
+
ref: refs/tags/release/3.23.0
|
|
17
|
+
pipelines:
|
|
18
|
+
- pipeline: pr
|
|
19
|
+
source: PR
|
|
20
|
+
trigger:
|
|
21
|
+
branches:
|
|
22
|
+
include:
|
|
23
|
+
- main
|
|
24
|
+
|
|
25
|
+
variables:
|
|
26
|
+
- group: data-model-release
|
|
27
|
+
- name: dryRunFlag
|
|
28
|
+
${{ if eq(parameters.dryRun, true) }}:
|
|
29
|
+
value: '--dry-run'
|
|
30
|
+
${{ if eq(parameters.dryRun, false) }}:
|
|
31
|
+
value: ''
|
|
32
|
+
|
|
33
|
+
pool: pins-odt-agent-pool
|
|
34
|
+
|
|
35
|
+
jobs:
|
|
36
|
+
- deployment: Release
|
|
37
|
+
displayName: Release
|
|
38
|
+
environment: 'NPM'
|
|
39
|
+
strategy:
|
|
40
|
+
runOnce:
|
|
41
|
+
deploy:
|
|
42
|
+
steps:
|
|
43
|
+
- download: none
|
|
44
|
+
- checkout: self
|
|
45
|
+
- template: steps/node_script.yml@templates
|
|
46
|
+
parameters:
|
|
47
|
+
nodeVersion: 22
|
|
48
|
+
script: npm ci
|
|
49
|
+
- template: steps/node_script.yml@templates
|
|
50
|
+
parameters:
|
|
51
|
+
nodeVersion: 22
|
|
52
|
+
script: npx semantic-release --branches main --tag-format '${version}' ${{ variables.dryRunFlag }}
|
|
53
|
+
environmentVariables:
|
|
54
|
+
GH_TOKEN: $(GITHUB_TOKEN)
|
|
55
|
+
NPM_TOKEN: $(NPM_TOKEN)
|
|
56
|
+
workspace:
|
|
57
|
+
clean: all
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: 'npm'
|
|
9
|
+
directory: '/' # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: 'weekly'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged && npm run format
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"printWidth": 120,
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"useTabs": true,
|
|
6
|
+
"semi": true,
|
|
7
|
+
"trailingComma": "none",
|
|
8
|
+
"bracketSpacing": true,
|
|
9
|
+
"arrowParens": "always",
|
|
10
|
+
"plugins": [],
|
|
11
|
+
"overrides": [
|
|
12
|
+
{
|
|
13
|
+
"files": "*.json",
|
|
14
|
+
"options": {
|
|
15
|
+
"useTabs": false
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Planning Inspectorate
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Data Model
|
|
2
|
+
|
|
3
|
+
JSON Schemas for the Planning Inspectorate's Data Model.
|
|
4
|
+
|
|
5
|
+
All messages over the enterprise service bus are in Data Model compliant formats, the schema's in this repository defined those formats.
|
|
6
|
+
|
|
7
|
+
## Rules of engagement
|
|
8
|
+
* Schema names should use the singular form (for example, `service-user` rather than `service-users`).
|
|
9
|
+
* Messages broadcast over the service bus must be pre-validated against the schema.
|
|
10
|
+
* Each service bus topic corresponds to one schema.
|
|
11
|
+
* Each message encompasses the complete state of an entity (as defined by [ECST](https://blogs.mulesoft.com/api-integration/strategy/event-carried-state-messages/)) and does not delineate specific changes (the delta).
|
|
12
|
+
* Consumers must support processing related messages received through different topics regardless of the order in which they are sent.
|
|
13
|
+
* Values required by the Data Model cannot be null, while optional values must be null if they have no value.
|
|
14
|
+
|
|
15
|
+
## Schema Changes
|
|
16
|
+
|
|
17
|
+
**Always consult a Data Architect about the proposed change - who will consider the change in terms of affect on other services and continuity with the overall data model.**
|
|
18
|
+
|
|
19
|
+
Since we are using these schemas across a distributed system we must ensure backwards and forwards compatibility. This enables systems to adopt new schema versions independently of one another. Also, consumers don't need to know the schema version of the messages they have received, as it should validate against any version.
|
|
20
|
+
|
|
21
|
+
Backwards compatibility ensures that messages using a newer schema version can be understood and processed by consumers that have not been updated to support the new version.
|
|
22
|
+
|
|
23
|
+
Forwards compatibility ensures that messages using an older schema version can be understood and processed by consumers that have been updated to support a newer schema version.
|
|
24
|
+
|
|
25
|
+
### Rules
|
|
26
|
+
|
|
27
|
+
To ensure compatibility, the following rules must be followed:
|
|
28
|
+
|
|
29
|
+
1. No fields can be removed from the schema
|
|
30
|
+
2. No fields can be removed from the `required` list
|
|
31
|
+
3. Optional fields must support the `null` type
|
|
32
|
+
4. Fields cannot be renamed
|
|
33
|
+
5. Any new fields must be optional
|
|
34
|
+
6. Any enum changes must only add options
|
|
35
|
+
7. `additionalProperties` must always be true
|
|
36
|
+
|
|
37
|
+
### Examples
|
|
38
|
+
|
|
39
|
+
Given a simple schema at v1:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"type": "object",
|
|
44
|
+
"title": "Book",
|
|
45
|
+
"required": ["id", "title"]
|
|
46
|
+
"additionalProperties": true,
|
|
47
|
+
"properties": {
|
|
48
|
+
"id": {
|
|
49
|
+
"type": "integer",
|
|
50
|
+
"description": "The unique identifier"
|
|
51
|
+
},
|
|
52
|
+
"title": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "The title or name of this book"
|
|
55
|
+
},
|
|
56
|
+
"blurb": {
|
|
57
|
+
"type": ["string", "null"],
|
|
58
|
+
"description": "The blurb"
|
|
59
|
+
},
|
|
60
|
+
"category": {
|
|
61
|
+
"type": ["string", "null"],
|
|
62
|
+
"description": "The top-level category",
|
|
63
|
+
"enum": [
|
|
64
|
+
"fiction",
|
|
65
|
+
"non-fiction",
|
|
66
|
+
null
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
An example valid message at v1 could be:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"id": 85347,
|
|
78
|
+
"title": "Mastering the Rubik's Cube",
|
|
79
|
+
"blurb": null,
|
|
80
|
+
"category": "non-fiction"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Let's make a v2 schema:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"type": "object",
|
|
89
|
+
"title": "Book",
|
|
90
|
+
"required": ["id", "title"]
|
|
91
|
+
"additionalProperties": true,
|
|
92
|
+
"properties": {
|
|
93
|
+
"id": {
|
|
94
|
+
"type": "integer",
|
|
95
|
+
"description": "The unique identifier"
|
|
96
|
+
},
|
|
97
|
+
"title": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "The title or name of this book"
|
|
100
|
+
},
|
|
101
|
+
"blurb": {
|
|
102
|
+
"type": ["string", "null"],
|
|
103
|
+
"description": "The blurb"
|
|
104
|
+
},
|
|
105
|
+
"category": {
|
|
106
|
+
"type": ["string", "null"],
|
|
107
|
+
"description": "The top-level category",
|
|
108
|
+
"enum": [
|
|
109
|
+
"fiction",
|
|
110
|
+
"non-fiction",
|
|
111
|
+
"ai-generated",
|
|
112
|
+
null
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"subCategory": {
|
|
116
|
+
"type": ["string", "null"],
|
|
117
|
+
"description": "The sub category",
|
|
118
|
+
"enum": [
|
|
119
|
+
"manuals",
|
|
120
|
+
"stories",
|
|
121
|
+
null
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Two changes have been made:
|
|
129
|
+
1. a new enum valid for `category`
|
|
130
|
+
2. a new field, `subCategory`
|
|
131
|
+
|
|
132
|
+
Now the original v1 message still validates against this schema. And a new v2 message, for example:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"id": 85347,
|
|
137
|
+
"title": "Mastering the Rubik's Cube",
|
|
138
|
+
"blurb": null,
|
|
139
|
+
"category": "non-fiction",
|
|
140
|
+
"subCategory": "manuals"
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
validates against the _old schema_ and the new schema!
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## Structure
|
|
148
|
+
|
|
149
|
+
* `docs`: generated documentation from the JSON schemas
|
|
150
|
+
* `pins_data_model`: Python library code (inc. generated Pydantic models)
|
|
151
|
+
* `schemas`: JSON schemas
|
|
152
|
+
* `src`: Node.js library code
|
|
153
|
+
|
|
154
|
+
## Commands
|
|
155
|
+
|
|
156
|
+
There are some messages, primarily used from Front Office to Back Office systems that aren't strictly compliant to the model, since the Front Office doesn't author the data. These are known as _commands_ (or submissions) and are usually a combination or subset of Data Model entities in a single message.
|
|
157
|
+
|
|
158
|
+
## Schemas
|
|
159
|
+
|
|
160
|
+
The schemas in this repository are written in jsonc (JSON with comments), and can be parsed with [node-jsonc-parser](https://github.com/Microsoft/node-jsonc-parser), or [jsonc-parser](https://github.com/NickolaiBeloguzov/jsonc-parser) for Python.
|
|
161
|
+
|
|
162
|
+
>While we'd prefer to use something with a standard, such as JSON5, this has less support with our current workflows. The jsonc format is the same format that VSCode uses for settings.
|
|
163
|
+
|
|
164
|
+
## Node.js Usage
|
|
165
|
+
|
|
166
|
+
To use these schemas in a Node project, add this repo as a dependency (with a particular tag or commit as the version):
|
|
167
|
+
|
|
168
|
+
`npm i -s Planning-Inspectorate/data-model#some-tag-or-commit`
|
|
169
|
+
|
|
170
|
+
Then import as required:
|
|
171
|
+
|
|
172
|
+
```es6
|
|
173
|
+
import {loadAllSchemas} from 'pins-data-model';
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
or to import enum constants, for example:
|
|
177
|
+
|
|
178
|
+
```es6
|
|
179
|
+
import { APPEAL_CASE_STATUS } from 'pins-data-model';
|
|
180
|
+
|
|
181
|
+
if (someAppeal.status === APPEAL_CASE_STATUS.COMPLETE) {
|
|
182
|
+
console.log(`we're done!`);
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
To upgrade to a different version, simply doing npm command does not seem to get the correct version, so we need to first uninstall and then reinstall. You can do this by running:
|
|
187
|
+
|
|
188
|
+
`npm uninstall pins-data-model && npm prune && npm i -s github:Planning-Inspectorate/data-model#some-tag-or-commit`
|
|
189
|
+
|
|
190
|
+
### Tests
|
|
191
|
+
|
|
192
|
+
We are starting to add js tests to the models using node test runner
|
|
193
|
+
|
|
194
|
+
These are run automatically by the pipeline and can be run locally with:
|
|
195
|
+
|
|
196
|
+
`node --test`
|
|
197
|
+
|
|
198
|
+
Please continue to expand this test suite going forward to help avoid breaking changes impacting consumers of the model
|
|
199
|
+
|
|
200
|
+
## Python usage
|
|
201
|
+
|
|
202
|
+
To use these schemas in a Python project, add this repo as a dependency (with a particular tag or commit as the version):
|
|
203
|
+
|
|
204
|
+
`pip install git+https://github.com/Planning-Inspectorate/data-model@task/python-setup#egg=pins_data_model`
|
|
205
|
+
|
|
206
|
+
install deps from requirements.txt: `pip install -r requirements.txt`
|
|
207
|
+
|
|
208
|
+
> you may want to run python in a virtual environment (handle python version/deps separately from system installed)
|
|
209
|
+
|
|
210
|
+
create a venv in a folder (.venv is git ignored): `python -m venv .venv`
|
|
211
|
+
|
|
212
|
+
you can specify a python version with: `python3.13.2 -m venv .venv`
|
|
213
|
+
|
|
214
|
+
activate it before running any python script: `source .venv/bin/activate`
|
|
215
|
+
|
|
216
|
+
deactivate once finished: `deactivate`
|
|
217
|
+
|
|
218
|
+
```python
|
|
219
|
+
from pins_data_model.load_schemas import load_all_schemas
|
|
220
|
+
|
|
221
|
+
schemas = load_all_schemas()
|
|
222
|
+
print(schemas)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Contributing
|
|
226
|
+
|
|
227
|
+
Once you have updated the schemas, before committing, ensure the generated code/documentation is up to date by running:
|
|
228
|
+
|
|
229
|
+
`npm run gen`
|
|
230
|
+
|
|
231
|
+
and
|
|
232
|
+
|
|
233
|
+
`python pins_data_model/gen_models.py`
|
|
234
|
+
|
|
235
|
+
Commits must follow conventional commits, and the commit types will be used by semantic-release to determine the next version number. For example `feat` commits will result in a minor version bump, while `fix` commits will result in a patch version bump.
|
|
236
|
+
|
|
237
|
+
The package will be released automatically using semantic-release, on merge to main. This will include a git tag for the release, and publishing to NPM.
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# README
|
|
2
|
+
|
|
3
|
+
## Top-level Schemas
|
|
4
|
+
|
|
5
|
+
* [Appeal Document](./appeal-document.md "Schema defining the metadata for appeal documents") – `appeal-document.schema.json`
|
|
6
|
+
|
|
7
|
+
* [Appeal Event](./appeal-event.md "Schema defining the metadata for appeal events, such as site visits, inquiries, hearings") – `appeal-event.schema.json`
|
|
8
|
+
|
|
9
|
+
* [Appeal Event Estimate](./appeal-event-estimate.md "All event estimates belong to a case") – `appeal-event-estimate.schema.json`
|
|
10
|
+
|
|
11
|
+
* [Appeal HAS Case](./appeal-has.md "Schema defining the metadata for an appeal") – `appeal-has.schema.json`
|
|
12
|
+
|
|
13
|
+
* [Appeal Representation](./appeal-representation.md "Schema defining the metadata for appeal representations, such as statements, third-party comments and final comments") – `appeal-representation.schema.json`
|
|
14
|
+
|
|
15
|
+
* [Appeal S78 Case](./appeal-s78.md "Schema defining the metadata for an appeal (S78)") – `appeal-s78.schema.json`
|
|
16
|
+
|
|
17
|
+
* [DaRT API response](./dart-response.md "Schema defining the data returned by the DaRT API") – `dart-response.schema.json`
|
|
18
|
+
|
|
19
|
+
* [Entra ID User Objects](./entraid.md "A list of users from EntraID") – `entraid.schema.json`
|
|
20
|
+
|
|
21
|
+
* [Examination Timetable](./nsip-exam-timetable.md "Examination Timetable for an NSIP Project") – `nsip-exam-timetable.schema.json`
|
|
22
|
+
|
|
23
|
+
* [Folder](./folder.md "Folders can have optional parents") – `folder.schema.json`
|
|
24
|
+
|
|
25
|
+
* [Get Timesheets API response](./gettimesheets-response.md "Schema defining the data returned by the DaRT API") – `gettimesheets-response.schema.json`
|
|
26
|
+
|
|
27
|
+
* [Listed Building](./listed-building.md "Delta of listed building data pushed by the ODW") – `listed-building.schema.json`
|
|
28
|
+
|
|
29
|
+
* [Listed Buildings](./listed-buildings.md "Temporary copy of listed-building to ensure compatibility until ODW is updated") – `listed-buildings.schema.json`
|
|
30
|
+
|
|
31
|
+
* [NSIP Document](./nsip-document.md "NSIP document schema") – `nsip-document.schema.json`
|
|
32
|
+
|
|
33
|
+
* [NSIP Project](./nsip-project.md "Subset of Pins Data Model \[Case]") – `nsip-project.schema.json`
|
|
34
|
+
|
|
35
|
+
* [NSIP Project Update](./nsip-project-update.md "NSIP Project Update (formerly known as Banners)") – `nsip-project-update.schema.json`
|
|
36
|
+
|
|
37
|
+
* [PINS Inspector](./pins-inspector.md "Inspector attributes as per Horizon") – `pins-inspector.schema.json`
|
|
38
|
+
|
|
39
|
+
* [PINS LPA](./pins-lpa.md "Local Planning Authority (LPA) attributes as per Horizon") – `pins-lpa.schema.json`
|
|
40
|
+
|
|
41
|
+
* [Representation](./nsip-representation.md "NSIP Representation schema") – `nsip-representation.schema.json`
|
|
42
|
+
|
|
43
|
+
* [S51 Advice](./s51-advice.md "Section 51 Advice schema") – `s51-advice.schema.json`
|
|
44
|
+
|
|
45
|
+
* [Service User](./service-user.md "Service User of the planning inspectorate") – `service-user.schema.json`
|
|
46
|
+
|
|
47
|
+
* [nsip-subscription](./nsip-subscription.md "Subscribers are a subset of Service Users, part of the PINS Data Model") – `nsip-subscription.schema.json`
|
|
48
|
+
|
|
49
|
+
## Other Schemas
|
|
50
|
+
|
|
51
|
+
### Objects
|
|
52
|
+
|
|
53
|
+
* [Untitled object in Appeal HAS Case](./appeal-has-properties-neighbouringsiteaddresses-items.md) – `appeal-has.schema.json#/properties/neighbouringSiteAddresses/items`
|
|
54
|
+
|
|
55
|
+
* [Untitled object in Appeal S78 Case](./appeal-s78-properties-neighbouringsiteaddresses-items.md) – `appeal-s78.schema.json#/properties/neighbouringSiteAddresses/items`
|
|
56
|
+
|
|
57
|
+
* [Untitled object in DaRT API response](./dart-response-properties-neighbouringsiteaddresses-items.md) – `dart-response.schema.json#/properties/neighbouringSiteAddresses/items`
|
|
58
|
+
|
|
59
|
+
* [Untitled object in Examination Timetable](./nsip-exam-timetable-defs-event.md) – `nsip-exam-timetable.schema.json#/$defs/event`
|
|
60
|
+
|
|
61
|
+
* [Untitled object in Examination Timetable](./nsip-exam-timetable-defs-line-item.md) – `nsip-exam-timetable.schema.json#/$defs/line-item`
|
|
62
|
+
|
|
63
|
+
### Arrays
|
|
64
|
+
|
|
65
|
+
* [Untitled array in Appeal Representation](./appeal-representation-properties-documentids.md "An array of documentIds") – `appeal-representation.schema.json#/properties/documentIds`
|
|
66
|
+
|
|
67
|
+
* [Untitled array in Examination Timetable](./nsip-exam-timetable-properties-events.md) – `nsip-exam-timetable.schema.json#/properties/events`
|
|
68
|
+
|
|
69
|
+
* [Untitled array in Examination Timetable](./nsip-exam-timetable-defs-event-properties-eventlineitems.md) – `nsip-exam-timetable.schema.json#/$defs/event/properties/eventLineItems`
|
|
70
|
+
|
|
71
|
+
* [Untitled array in NSIP Project](./nsip-project-properties-regions.md) – `nsip-project.schema.json#/properties/regions`
|
|
72
|
+
|
|
73
|
+
* [Untitled array in NSIP Project](./nsip-project-properties-nsipofficerids.md) – `nsip-project.schema.json#/properties/nsipOfficerIds`
|
|
74
|
+
|
|
75
|
+
* [Untitled array in NSIP Project](./nsip-project-properties-nsipadministrationofficerids.md) – `nsip-project.schema.json#/properties/nsipAdministrationOfficerIds`
|
|
76
|
+
|
|
77
|
+
* [Untitled array in NSIP Project](./nsip-project-properties-inspectorids.md) – `nsip-project.schema.json#/properties/inspectorIds`
|
|
78
|
+
|
|
79
|
+
* [Untitled array in Representation](./nsip-representation-properties-attachmentids.md) – `nsip-representation.schema.json#/properties/attachmentIds`
|
|
80
|
+
|
|
81
|
+
* [Untitled array in S51 Advice](./s51-advice-properties-attachmentids.md) – `s51-advice.schema.json#/properties/attachmentIds`
|
|
82
|
+
|
|
83
|
+
## Version Note
|
|
84
|
+
|
|
85
|
+
The schemas linked above follow the JSON Schema Spec version: `http://json-schema.org/draft-07/schema#`
|