@planning-inspectorate/data-model 2.48.1 → 2.50.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.
Files changed (35) hide show
  1. package/docs/README.md +23 -1
  2. package/docs/address.md +366 -0
  3. package/docs/appeal-has.md +10 -7
  4. package/docs/applications-application-defs-address.md +108 -0
  5. package/docs/applications-application-defs-contact.md +98 -0
  6. package/docs/applications-application-defs-organisation.md +117 -0
  7. package/docs/applications-application-defs.md +3 -0
  8. package/docs/{application-update.md → applications-application-update.md} +22 -22
  9. package/docs/applications-application.md +2250 -0
  10. package/docs/applications-notify-email-defs-contact.md +93 -0
  11. package/docs/applications-notify-email-defs.md +3 -0
  12. package/docs/applications-notify-email.md +458 -0
  13. package/docs/applications-representation-definitions-contact.md +93 -0
  14. package/docs/applications-representation-definitions-representationdocument.md +152 -0
  15. package/docs/applications-representation-definitions.md +3 -0
  16. package/docs/applications-representation.md +834 -0
  17. package/package.json +1 -1
  18. package/pins_data_model/models/model_address.py +69 -0
  19. package/pins_data_model/models/model_appeal_has.py +3 -0
  20. package/pins_data_model/models/model_applications_application.py +518 -0
  21. package/pins_data_model/models/model_applications_application_update.py +55 -0
  22. package/pins_data_model/models/model_applications_notify_email.py +124 -0
  23. package/pins_data_model/models/model_applications_representation.py +207 -0
  24. package/schemas/address.schema.json +87 -0
  25. package/schemas/appeal-has.schema.json +2 -2
  26. package/schemas/{application-update.schema.json → applications-application-update.schema.json} +1 -1
  27. package/schemas/applications-application.schema.json +539 -0
  28. package/schemas/applications-notify-email.schema.json +118 -0
  29. package/schemas/applications-representation.schema.json +202 -0
  30. package/src/enums.cjs +147 -7
  31. package/src/enums.d.ts +131 -6
  32. package/src/enums.js +131 -6
  33. package/src/index.cjs +147 -7
  34. package/src/schemas.d.ts +679 -2
  35. package/tests/appeals/appeal-has.test.js +34 -0
@@ -0,0 +1,124 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: applications-notify-email.schema.json
3
+
4
+ from __future__ import annotations
5
+
6
+ from enum import Enum
7
+
8
+ from pydantic import AwareDatetime, BaseModel, ConfigDict, EmailStr, Field
9
+
10
+
11
+ class EmailStatus(Enum):
12
+ """
13
+ Outcome of the email (status)
14
+ """
15
+
16
+ Sending = "Sending"
17
+ Delivered = "Delivered"
18
+ Permanent_failure = "Permanent failure"
19
+ Temporary_failure = "Temporary failure"
20
+ Technical_failure = "Technical failure"
21
+
22
+
23
+ class ContactPreference(Enum):
24
+ """
25
+ Preferred contact method
26
+ """
27
+
28
+ email = "email"
29
+ post = "post"
30
+
31
+
32
+ class Contact(BaseModel):
33
+ """
34
+ Contact the email was sent to
35
+ """
36
+
37
+ contactId: str = Field(..., examples=["AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"])
38
+ """
39
+ Source PK for Contact
40
+ """
41
+ contactPreference: ContactPreference | None = Field(None, examples=["email"])
42
+ """
43
+ Preferred contact method
44
+ """
45
+ writtenRepOrgName: str | None = None
46
+ writtenRepJobTitleorRole: str | None = None
47
+
48
+
49
+ class EmailNotificationRecordSchema(BaseModel):
50
+ """
51
+ Email Notifications for Casework Projects
52
+ """
53
+
54
+ model_config = ConfigDict(
55
+ extra="allow",
56
+ )
57
+ id: str = Field(..., examples=["AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"])
58
+ """
59
+ Internal Identifier UUID
60
+ """
61
+ notifyId: str | None = None
62
+ """
63
+ Id used by Notify
64
+ """
65
+ reference: str | None = None
66
+ """
67
+ Reference passed to notify (used to identify the case or representation it relates to)
68
+ """
69
+ caseReference: str = Field(..., examples=["CROWN/2025/12345"])
70
+ """
71
+ Business Key for the related case
72
+ """
73
+ caseId: str = Field(..., examples=["AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"])
74
+ """
75
+ The unique ID for the case this notification belongs to.
76
+ """
77
+ caseType: str = Field(..., examples=["Crown Development Application"])
78
+ """
79
+ The type of case this notification is for.
80
+ """
81
+ createdDate: AwareDatetime | None = None
82
+ """
83
+ Date the email was created
84
+ """
85
+ createdBy: str | None = None
86
+ """
87
+ Name of the person that triggered the email (only applies when done manually)
88
+ """
89
+ completedDate: AwareDatetime | None = None
90
+ """
91
+ When the email completed (succeeded or failed)
92
+ """
93
+ email: EmailStr | None = None
94
+ """
95
+ Email address sent to if unable to be linked to an LPA or Contact
96
+ """
97
+ contact: list[Contact] | None = None
98
+ """
99
+ Contact(s) the email was sent to
100
+ """
101
+ lpaCode: str = Field(..., examples=["Z0116"])
102
+ """
103
+ Planning Body code
104
+ """
105
+ emailStatus: EmailStatus | None = Field(None, examples=["Delivered"])
106
+ """
107
+ Outcome of the email (status)
108
+ """
109
+ templateId: str | None = None
110
+ """
111
+ The id of the template sent in Notify
112
+ """
113
+ templateVersion: int | None = None
114
+ """
115
+ The version of the template sent
116
+ """
117
+ body: str | None = None
118
+ """
119
+ The full HTML/plain text body of the email
120
+ """
121
+ subject: str | None = None
122
+ """
123
+ The full HTML/plain text subject of the email
124
+ """
@@ -0,0 +1,207 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: applications-representation.schema.json
3
+
4
+ from __future__ import annotations
5
+
6
+ from enum import Enum
7
+
8
+ from pydantic import AwareDatetime, BaseModel, ConfigDict, Field
9
+
10
+
11
+ class RepresentationStatus(Enum):
12
+ Awaiting_review = "Awaiting review"
13
+ Accepted = "Accepted"
14
+ Rejected = "Rejected"
15
+ Withdrawn = "Withdrawn"
16
+
17
+
18
+ class SubmittedFor(Enum):
19
+ Myself = "Myself"
20
+ On_behalf_of_another_person_or_an_organisation = (
21
+ "On behalf of another person or an organisation"
22
+ )
23
+
24
+
25
+ class SubmittedReceivedMethod(Enum):
26
+ """
27
+ How we received the representation
28
+ """
29
+
30
+ Online = "Online"
31
+ Phone = "Phone"
32
+ Email = "Email"
33
+ Post = "Post"
34
+ In_person = "In person"
35
+
36
+
37
+ class RepresentedType(Enum):
38
+ """
39
+ When representation is on behalf of a person/org/group
40
+ """
41
+
42
+ A_person = "A person"
43
+ An_organisation_or_charity_I_work_or_volunteer_for = (
44
+ "An organisation or charity I work or volunteer for"
45
+ )
46
+ An_organisation_or_charity_I_do_not_work_or_volunteer_for = (
47
+ "An organisation or charity I do not work or volunteer for"
48
+ )
49
+
50
+
51
+ class RepresentedCategory(Enum):
52
+ Consultees = "Consultees"
53
+ Interested_party = "Interested party"
54
+
55
+
56
+ class WithdrawalReason(Enum):
57
+ """
58
+ Reason for the withdrawal
59
+ """
60
+
61
+ Change_of_opinion = "Change of opinion"
62
+ Mistaken_Submission = "Mistaken Submission"
63
+ Misunderstanding = "Misunderstanding"
64
+ Personal_Reasons = "Personal Reasons"
65
+
66
+
67
+ class ContactPreference(Enum):
68
+ email = "email"
69
+ post = "post"
70
+
71
+
72
+ class Contact(BaseModel):
73
+ contactId: str = Field(..., examples=["AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"])
74
+ """
75
+ Source PK for Contact
76
+ """
77
+ contactPreference: ContactPreference | None = Field(None, examples=["email"])
78
+ writtenRepOrgName: str | None = None
79
+ writtenRepJobTitleorRole: str | None = None
80
+
81
+
82
+ class Status(Enum):
83
+ """
84
+ The status of the document
85
+ """
86
+
87
+ Awaiting_review = "Awaiting review"
88
+ Accepted = "Accepted"
89
+ Rejected = "Rejected"
90
+ Withdrawn = "Withdrawn"
91
+
92
+
93
+ class RepresentationDocument(BaseModel):
94
+ id: str = Field(..., examples=["AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"])
95
+ """
96
+ Source Key for Representation Document
97
+ """
98
+ representationId: str = Field(
99
+ ..., examples=["AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"]
100
+ )
101
+ """
102
+ The representation this relates to
103
+ """
104
+ itemId: str
105
+ """
106
+ The id of the item in SharePoint
107
+ """
108
+ fileName: str
109
+ """
110
+ The name of the file
111
+ """
112
+ redactedItemId: str | None = None
113
+ """
114
+ The id of the redacted version of the item in sharepoint
115
+ """
116
+ redactedFileName: str | None = None
117
+ """
118
+ the name of the redacted file
119
+ """
120
+ status: Status
121
+ """
122
+ The status of the document
123
+ """
124
+
125
+
126
+ class CaseworkRepresentationSchema(BaseModel):
127
+ """
128
+ Representations and related document metadata for Casework Projects
129
+ """
130
+
131
+ model_config = ConfigDict(
132
+ extra="allow",
133
+ )
134
+ id: str = Field(..., examples=["AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"])
135
+ """
136
+ Primary key
137
+ """
138
+ reference: str
139
+ """
140
+ Auto-generated hexadecimal reference: AAAAA-BBBBB
141
+ """
142
+ caseReference: str = Field(..., examples=["CROWN/2025/12345"])
143
+ """
144
+ Business Key for the related case
145
+ """
146
+ caseId: str = Field(..., examples=["AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"])
147
+ """
148
+ The unique ID for the case this representation belongs to.
149
+ """
150
+ caseType: str = Field(..., examples=["Crown Development Application"])
151
+ """
152
+ The type of case this representation is for.
153
+ """
154
+ representationStatus: RepresentationStatus | None = None
155
+ submittedFor: SubmittedFor
156
+ submittedByContact: list[Contact] | None = None
157
+ submittedByAgentFlag: bool | None = None
158
+ submittedByAgentOrgName: str | None = None
159
+ submittedDate: AwareDatetime
160
+ submittedReceivedMethod: SubmittedReceivedMethod | None = None
161
+ """
162
+ How we received the representation
163
+ """
164
+ submissionMethodReason: str | None = None
165
+ comment: str
166
+ commentRedacted: str | None = None
167
+ """
168
+ redacted version of the comment, null if not redacted
169
+ """
170
+ representedType: RepresentedType | None = None
171
+ """
172
+ When representation is on behalf of a person/org/group
173
+ """
174
+ representedContact: list[Contact] | None = None
175
+ """
176
+ When representation is on behalf of a person/org/group
177
+ """
178
+ representedCategory: RepresentedCategory | None = None
179
+ wantsToBeHeard: bool | None = None
180
+ """
181
+ Internal: wants to be heard at a hearing
182
+ """
183
+ containsAttachments: bool | None = None
184
+ """
185
+ Is a document attached to the representation
186
+ """
187
+ sharePointFolderCreated: bool | None = None
188
+ """
189
+ to avoid creating new folders for documents when managing representations
190
+ """
191
+ distressingContentInRepresentation: bool | None = None
192
+ """
193
+ Flags the representation as containing distressing content
194
+ """
195
+ withdrawalRequestDate: AwareDatetime | None = None
196
+ """
197
+ Date the representing party requested that the representation be withdrawn
198
+ """
199
+ withdrawalReason: WithdrawalReason | None = None
200
+ """
201
+ Reason for the withdrawal
202
+ """
203
+ dateWithdrawn: AwareDatetime | None = None
204
+ """
205
+ Date the representation was withdrawn
206
+ """
207
+ representationDocuments: list[RepresentationDocument] | None = None
@@ -0,0 +1,87 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "address.schema.json",
4
+ "title": "PINS Address Schema",
5
+ "description": "A schema to define the structure of an Address object in PINS.",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": ["addressDimKey", "caseReference", "caseId", "caseType"],
9
+ "properties": {
10
+ "addressDimKey": {
11
+ "type": "number",
12
+ "description": "Primary Key for an Address.",
13
+ "example": 12345
14
+ },
15
+ "addressType": {
16
+ "type": "string",
17
+ "description": "The type of thing this address is for.",
18
+ "example": "site",
19
+ "enum": ["site", "neighbouring", "organisation", "contact"]
20
+ },
21
+ "caseReference": {
22
+ "type": "string",
23
+ "description": "Business Key for the related case",
24
+ "example": "CROWN/2025/12345"
25
+ },
26
+ "caseId": {
27
+ "type": "string",
28
+ "description": "The unique ID for the case this representation belongs to.",
29
+ "example": "AAAAAAAA-1234-1234-1234-AAAAAAAAAAAA"
30
+ },
31
+ "caseType": {
32
+ "type": "string",
33
+ "description": "The type of case this representation is for.",
34
+ "example": "Crown Development Application"
35
+ },
36
+ "description": {
37
+ "type": ["string", "null"],
38
+ "description": "Some sites may have a postcode, but do not have postal addresses.",
39
+ "example": "The field behind the crown pub"
40
+ },
41
+ "line1": {
42
+ "type": ["string", "null"]
43
+ },
44
+ "line2": {
45
+ "type": ["string", "null"]
46
+ },
47
+ "townCity": {
48
+ "type": ["string", "null"]
49
+ },
50
+ "county": {
51
+ "type": ["string", "null"]
52
+ },
53
+ "postcode": {
54
+ "type": ["string", "null"]
55
+ },
56
+ "country": {
57
+ "type": ["string", "null"]
58
+ },
59
+ "easting": {
60
+ "type": ["string", "null"],
61
+ "example": "358267"
62
+ },
63
+ "northing": {
64
+ "type": ["string", "null"],
65
+ "example": "172797"
66
+ },
67
+ "latitudeWGS84": {
68
+ "type": ["number", "null"],
69
+ "example": 51.452608
70
+ },
71
+ "longitudeWGS84": {
72
+ "type": ["number", "null"],
73
+ "example": -2.6019821
74
+ },
75
+ "UPRN": {
76
+ "type": ["string", "null"],
77
+ "example": 100023336956,
78
+ "description": "The Unique Property Reference Number (UPRN) is a unique number (a geocode) for every addressable location—e.g., a building, a bus stop, a post box, a feature in the landscape, or a defibrillator—in Great Britain."
79
+ },
80
+ "dependentRequired": {
81
+ "easting": ["northing"],
82
+ "northing": ["easting"],
83
+ "latitudeWGS84": ["longitudeWGS84"],
84
+ "longitudeWGS84": ["latitudeWGS84"]
85
+ }
86
+ }
87
+ }
@@ -135,8 +135,8 @@
135
135
  "description": "The internal code for an appeal type, e.g. D (Householder)"
136
136
  },
137
137
  "caseProcedure": {
138
- "type": "string",
139
- "enum": ["written", "hearing", "inquiry"],
138
+ "type": ["string", "null"],
139
+ "enum": ["written", "hearing", "inquiry", "writtenPart1", "writtenPart2", null],
140
140
  "description": "The type of procedure for the appeal"
141
141
  },
142
142
  "lpaCode": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "application-update.schema.json",
3
+ "$id": "applications-application-update.schema.json",
4
4
  "title": "Application Update Schema",
5
5
  "description": "Application Update for Casework Project",
6
6
  "type": "object",