@planning-inspectorate/data-model 2.7.0 → 2.9.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 (40) hide show
  1. package/docs/appeal-document.md +86 -63
  2. package/package.json +1 -1
  3. package/pins_data_model/models/model_appeal_document.py +24 -1
  4. package/pins_data_model/models/model_appeal_event.py +1 -1
  5. package/pins_data_model/models/model_appeal_event_estimate.py +1 -1
  6. package/pins_data_model/models/model_appeal_has.py +1 -1
  7. package/pins_data_model/models/model_appeal_representation.py +1 -1
  8. package/pins_data_model/models/model_appeal_s78.py +1 -1
  9. package/pins_data_model/models/model_dart_response.py +1 -1
  10. package/pins_data_model/models/model_entraid.py +1 -1
  11. package/pins_data_model/models/model_folder.py +1 -1
  12. package/pins_data_model/models/model_gettimesheets_response.py +1 -1
  13. package/pins_data_model/models/model_listed_building.py +1 -1
  14. package/pins_data_model/models/model_listed_buildings.py +1 -1
  15. package/pins_data_model/models/model_nsip_document.py +1 -1
  16. package/pins_data_model/models/model_nsip_exam_timetable.py +1 -1
  17. package/pins_data_model/models/model_nsip_invoice.py +1 -1
  18. package/pins_data_model/models/model_nsip_meeting.py +1 -1
  19. package/pins_data_model/models/model_nsip_project.py +1 -1
  20. package/pins_data_model/models/model_nsip_project_update.py +1 -1
  21. package/pins_data_model/models/model_nsip_representation.py +1 -1
  22. package/pins_data_model/models/model_nsip_subscription.py +1 -1
  23. package/pins_data_model/models/model_pins_inspector.py +1 -1
  24. package/pins_data_model/models/model_pins_lpa.py +1 -1
  25. package/pins_data_model/models/model_s51_advice.py +1 -1
  26. package/pins_data_model/models/model_service_user.py +1 -1
  27. package/schemas/appeal-document.schema.json +23 -0
  28. package/schemas/commands/appeals-components/environmental-impact-assessment.schema.json +68 -0
  29. package/schemas/commands/appeals-components/infrastructure-levy.schema.json +40 -0
  30. package/schemas/commands/appeals-components/lpa-questionnaire-enforcement.schema.json +73 -0
  31. package/schemas/commands/appeals-components/lpa-questionnaire-s78.schema.json +1 -137
  32. package/schemas/commands/appeals-components/site-designations-protections.schema.json +50 -0
  33. package/schemas/commands/appellant-submission.schema.json +1 -1
  34. package/schemas/commands/lpa-questionnaire.schema.json +27 -2
  35. package/src/enums.cjs +23 -0
  36. package/src/enums.d.ts +23 -0
  37. package/src/enums.js +23 -0
  38. package/src/index.cjs +23 -0
  39. package/src/schemas.d.ts +137 -74
  40. package/tests/appeals/commands/enforcement-questionnaire.test.js +109 -0
package/src/schemas.d.ts CHANGED
@@ -145,6 +145,14 @@ export interface AppealDocument {
145
145
  | 'environmentalAssessment'
146
146
  | 'appealNotification'
147
147
  | 'historicEnglandConsultation'
148
+ | 'stopNotice'
149
+ | 'article4Direction'
150
+ | 'enforcementList'
151
+ | 'localDevelopmentOrder'
152
+ | 'planningPermission'
153
+ | 'lpaEnforcementNotice'
154
+ | 'lpaEnforcementNoticePlan'
155
+ | 'planningContraventionNotice'
148
156
  | null;
149
157
  /**
150
158
  * The system mastering the metadata for the current document
@@ -4235,45 +4243,89 @@ export type LPAQHASSubmissionProperties = {
4235
4243
  */
4236
4244
  export type LPAQS78SubmissionProperties = {
4237
4245
  /**
4238
- * A list of changed listed building IDs from Historic England
4246
+ * Indicates that a scheduled monument is affected
4239
4247
  */
4240
- changedListedBuildingNumbers?: string[] | null;
4248
+ affectsScheduledMonument?: boolean | null;
4241
4249
  /**
4242
- * A grant or loan has been made to preserve the listed building
4250
+ * Indicates a TPO (tree preservation order)
4243
4251
  */
4244
- preserveGrantLoan?: boolean | null;
4252
+ hasTreePreservationOrder?: boolean | null;
4245
4253
  /**
4246
- * Are Historic England to be consulted?
4254
+ * Indicates a PROW (public right of way)
4247
4255
  */
4248
- consultHistoricEngland?: boolean | null;
4256
+ isPublicRightOfWay?: boolean | null;
4249
4257
  /**
4250
- * Indicates that a scheduled monument is affected
4258
+ * Indicates statutory consultees
4251
4259
  */
4252
- affectsScheduledMonument?: boolean | null;
4260
+ hasStatutoryConsultees?: boolean | null;
4253
4261
  /**
4254
- * Indicates the existence of protected species
4262
+ * The details of the bodies consulted
4255
4263
  */
4256
- hasProtectedSpecies?: boolean | null;
4264
+ consultedBodiesDetails?: string | null;
4257
4265
  /**
4258
- * Indicates an area of outstanding beauty (National Landscape)
4266
+ * Indicates consultation responses
4259
4267
  */
4260
- isAonbNationalLandscape?: boolean | null;
4268
+ hasConsultationResponses?: boolean | null;
4261
4269
  /**
4262
- * The designated site names
4270
+ * Indicates emerging plans
4263
4271
  */
4264
- designatedSitesNames?: string[] | null;
4272
+ hasEmergingPlan?: boolean | null;
4265
4273
  /**
4266
- * Indicates a TPO (tree preservation order)
4274
+ * Indicates supplementary planning documents
4267
4275
  */
4268
- hasTreePreservationOrder?: boolean | null;
4276
+ hasSupplementaryPlanningDocs?: boolean | null;
4277
+ };
4278
+ /**
4279
+ * Schema defining LPA procedure preference properties
4280
+ */
4281
+ export type LPAProcedurePreferenceProperties = {
4269
4282
  /**
4270
- * Indicates a traveller site
4283
+ * The procedure preference indicated by the LPA
4271
4284
  */
4272
- isGypsyOrTravellerSite?: boolean | null;
4285
+ lpaProcedurePreference?: 'written' | 'hearing' | 'inquiry' | null;
4273
4286
  /**
4274
- * Indicates a PROW (public right of way)
4287
+ * The procedure details preference indicated by the LPA
4275
4288
  */
4276
- isPublicRightOfWay?: boolean | null;
4289
+ lpaProcedurePreferenceDetails?: string | null;
4290
+ /**
4291
+ * The duration of enquiry indicated by the LPA
4292
+ */
4293
+ lpaProcedurePreferenceDuration?: number | null;
4294
+ };
4295
+ /**
4296
+ * Schema defining changed-listed-building-numbers
4297
+ */
4298
+ export type ChangedListedBuildingNumbersProperties = {
4299
+ /**
4300
+ * A list of changed listed building IDs from Historic England
4301
+ */
4302
+ changedListedBuildingNumbers?: string[] | null;
4303
+ };
4304
+ /**
4305
+ * Schema defining infrastructure levy properties
4306
+ */
4307
+ export type InfrastructureLevyProperties = {
4308
+ /**
4309
+ * Indicates the existence of an infrastructure levy
4310
+ */
4311
+ hasInfrastructureLevy?: boolean | null;
4312
+ /**
4313
+ * Indicates if the infrastructure levy is formally adopted
4314
+ */
4315
+ isInfrastructureLevyFormallyAdopted?: boolean | null;
4316
+ /**
4317
+ * The date of the infrastructure levy adoption
4318
+ */
4319
+ infrastructureLevyAdoptedDate?: string | null;
4320
+ /**
4321
+ * The expected date of the infrastructure levy
4322
+ */
4323
+ infrastructureLevyExpectedDate?: string | null;
4324
+ };
4325
+ /**
4326
+ * Schema defining environmental impact assessment properties
4327
+ */
4328
+ export type EnvironmentalImpactAssessmentProperties = {
4277
4329
  /**
4278
4330
  * The impact schedule from EIA
4279
4331
  */
@@ -4316,68 +4368,31 @@ export type LPAQS78SubmissionProperties = {
4316
4368
  * EIA completed environmental statement required
4317
4369
  */
4318
4370
  eiaCompletedEnvironmentalStatement?: boolean | null;
4319
- /**
4320
- * Indicates statutory consultees
4321
- */
4322
- hasStatutoryConsultees?: boolean | null;
4323
- /**
4324
- * The details of the bodies consulted
4325
- */
4326
- consultedBodiesDetails?: string | null;
4327
- /**
4328
- * Indicates consultation responses
4329
- */
4330
- hasConsultationResponses?: boolean | null;
4331
- /**
4332
- * Indicates emerging plans
4333
- */
4334
- hasEmergingPlan?: boolean | null;
4335
- /**
4336
- * Indicates supplementary planning documents
4337
- */
4338
- hasSupplementaryPlanningDocs?: boolean | null;
4339
- /**
4340
- * Indicates the existence of an infrastructure levy
4341
- */
4342
- hasInfrastructureLevy?: boolean | null;
4343
- /**
4344
- * Indicates if the infrastructure levy is formally adopted
4345
- */
4346
- isInfrastructureLevyFormallyAdopted?: boolean | null;
4347
- /**
4348
- * The date of the infrastructure levy adoption
4349
- */
4350
- infrastructureLevyAdoptedDate?: string | null;
4351
- /**
4352
- * The expected date of the infrastructure levy
4353
- */
4354
- infrastructureLevyExpectedDate?: string | null;
4355
4371
  };
4356
4372
  /**
4357
- * Schema defining LPA procedure preference properties
4373
+ * Schema defining site designations and protection specific properties
4358
4374
  */
4359
- export type LPAProcedurePreferenceProperties = {
4375
+ export type SiteDesignationsAndProtectionSpecificProperties = {
4360
4376
  /**
4361
- * The procedure preference indicated by the LPA
4377
+ * Indicates that a scheduled monument is affected
4362
4378
  */
4363
- lpaProcedurePreference?: 'written' | 'hearing' | 'inquiry' | null;
4379
+ affectsScheduledMonument?: boolean | null;
4364
4380
  /**
4365
- * The procedure details preference indicated by the LPA
4381
+ * Indicates the existence of protected species
4366
4382
  */
4367
- lpaProcedurePreferenceDetails?: string | null;
4383
+ hasProtectedSpecies?: boolean | null;
4368
4384
  /**
4369
- * The duration of enquiry indicated by the LPA
4385
+ * Indicates an area of outstanding beauty (National Landscape)
4370
4386
  */
4371
- lpaProcedurePreferenceDuration?: number | null;
4372
- };
4373
- /**
4374
- * Schema defining changed-listed-building-numbers
4375
- */
4376
- export type ChangedListedBuildingNumbersProperties = {
4387
+ isAonbNationalLandscape?: boolean | null;
4377
4388
  /**
4378
- * A list of changed listed building IDs from Historic England
4389
+ * The designated site names
4379
4390
  */
4380
- changedListedBuildingNumbers?: string[] | null;
4391
+ designatedSitesNames?: string[] | null;
4392
+ /**
4393
+ * Indicates a traveller site
4394
+ */
4395
+ isGypsyOrTravellerSite?: boolean | null;
4381
4396
  };
4382
4397
  /**
4383
4398
  * Schema defining any advert specific properties for LPAQ submissions
@@ -4424,6 +4439,33 @@ export type LPAQCasAdvertSubmissionProperties = {
4424
4439
  */
4425
4440
  didAppellantSubmitCompletePhotosAndPlans?: boolean | null;
4426
4441
  };
4442
+ /**
4443
+ * Schema defining any enfrocement specific properties for LPAQ submissions
4444
+ */
4445
+ export type LPAQEnforcementSubmissionProperties = {
4446
+ noticeRelatesToBuildingEngineeringMiningOther?: boolean | null;
4447
+ /**
4448
+ * The site area, in square meters
4449
+ */
4450
+ siteAreaSquareMetres?: number | null;
4451
+ hasAllegedBreachArea?: boolean | null;
4452
+ doesAllegedBreachCreateFloorSpace?: boolean | null;
4453
+ changeOfUseRefuseOrWaste?: boolean | null;
4454
+ changeOfUseMineralExtraction?: boolean | null;
4455
+ changeOfUseMineralStorage?: boolean | null;
4456
+ relatesToErectionOfBuildingOrBuildings?: boolean | null;
4457
+ relatesToBuildingWithAgriculturalPurpose?: boolean | null;
4458
+ relatesToBuildingSingleDwellingHouse?: boolean | null;
4459
+ /**
4460
+ * Name of trunk road within 67M of site
4461
+ */
4462
+ affectedTrunkRoadName?: string | null;
4463
+ isSiteOnCrownLand?: boolean | null;
4464
+ /**
4465
+ * What permitted develpoment rights are affected by the Article 4 Direction
4466
+ */
4467
+ article4AffectedDevelopmentRights?: string | null;
4468
+ };
4427
4469
 
4428
4470
  /**
4429
4471
  * Schema defining the data produced by the Front-Office when an LPA Questionnaire is submitted
@@ -4440,7 +4482,10 @@ export interface LPAQuestionnaireCommand {
4440
4482
  LPAQHASSubmissionProperties &
4441
4483
  LPAQS78SubmissionProperties &
4442
4484
  LPAProcedurePreferenceProperties &
4443
- ChangedListedBuildingNumbersProperties)
4485
+ ChangedListedBuildingNumbersProperties &
4486
+ InfrastructureLevyProperties &
4487
+ EnvironmentalImpactAssessmentProperties &
4488
+ SiteDesignationsAndProtectionSpecificProperties)
4444
4489
  | ({
4445
4490
  caseType?: 'ZA';
4446
4491
  } & LPAQCommonSubmissionProperties &
@@ -4453,7 +4498,17 @@ export interface LPAQuestionnaireCommand {
4453
4498
  LPAQHASSubmissionProperties &
4454
4499
  LPAQCasAdvertSubmissionProperties &
4455
4500
  LPAProcedurePreferenceProperties &
4456
- ChangedListedBuildingNumbersProperties);
4501
+ ChangedListedBuildingNumbersProperties)
4502
+ | ({
4503
+ caseType?: 'C';
4504
+ } & LPAQCommonSubmissionProperties &
4505
+ LPAQHASSubmissionProperties &
4506
+ LPAProcedurePreferenceProperties &
4507
+ ChangedListedBuildingNumbersProperties &
4508
+ InfrastructureLevyProperties &
4509
+ EnvironmentalImpactAssessmentProperties &
4510
+ SiteDesignationsAndProtectionSpecificProperties &
4511
+ LPAQEnforcementSubmissionProperties);
4457
4512
  documents: {
4458
4513
  /**
4459
4514
  * The unique identifier for the document
@@ -4513,7 +4568,15 @@ export interface LPAQuestionnaireCommand {
4513
4568
  | 'eiaScopingOpinion'
4514
4569
  | 'communityInfrastructureLevy'
4515
4570
  | 'definitiveMapStatement'
4516
- | 'historicEnglandConsultation';
4571
+ | 'historicEnglandConsultation'
4572
+ | 'stopNotice'
4573
+ | 'article4Direction'
4574
+ | 'enforcementList'
4575
+ | 'localDevelopmentOrder'
4576
+ | 'planningPermission'
4577
+ | 'enforcementNotice'
4578
+ | 'enforcementNoticePlan'
4579
+ | 'planningContraventionNotice';
4517
4580
  [k: string]: unknown;
4518
4581
  }[];
4519
4582
  [k: string]: unknown;
@@ -0,0 +1,109 @@
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert';
3
+ import Ajv from 'ajv';
4
+ import addFormats from 'ajv-formats';
5
+ import { loadAllSchemasSync } from '../../../src/index.js';
6
+
7
+ const schema = 'lpa-questionnaire.schema.json';
8
+
9
+ const document = {
10
+ documentId: 'deserunt sint aliqua adipisicing dolore',
11
+ filename: 'ut dolore',
12
+ originalFilename: 'Lorem amet fugiat adipisicing Excepteur',
13
+ size: -90476934,
14
+ mime: 'magna labore exercitation ut',
15
+ documentURI: 'ut reprehenderit',
16
+ dateCreated: '1933-04-03T03:24:38.0Z',
17
+ documentType: 'plansDrawings'
18
+ };
19
+
20
+ const exampleEnforcementQuestionnaireSchema = {
21
+ casedata: {
22
+ caseType: 'C',
23
+ caseReference: 'est ea elit in nulla',
24
+ lpaQuestionnaireSubmittedDate: null,
25
+ siteAccessDetails: ['velit adipisicing fugiat dolor ullamco'],
26
+ siteSafetyDetails: ['ut', 'dolore ut sint Duis', 'magna consequat quis laboris officia'],
27
+ nearbyCaseReferences: ['nulla', 'incididunt eu nostrud eiusmod', 'exercitation', 'Ut nostrud', 'eiusmod cillum eu'],
28
+ neighbouringSiteAddresses: null,
29
+ isCorrectAppealType: true,
30
+ affectedListedBuildingNumbers: null,
31
+ isGreenBelt: null,
32
+ inConservationArea: null,
33
+ newConditionDetails: null,
34
+ notificationMethod: ['irure', 'cillum tempor incididunt labore in'],
35
+ lpaCostsAppliedFor: true,
36
+ lpaStatement: 'ex laborum cupidatat',
37
+ changedListedBuildingNumbers: null,
38
+ affectsScheduledMonument: true,
39
+ hasProtectedSpecies: false,
40
+ isAonbNationalLandscape: true,
41
+ designatedSitesNames: ['quis nulla eu officia exercitation'],
42
+ hasTreePreservationOrder: null,
43
+ isGypsyOrTravellerSite: true,
44
+ isPublicRightOfWay: null,
45
+ eiaEnvironmentalImpactSchedule: 'schedule-2',
46
+ eiaDevelopmentDescription: 'production-processing-of-metals',
47
+ eiaSensitiveAreaDetails: null,
48
+ eiaColumnTwoThreshold: false,
49
+ eiaScreeningOpinion: false,
50
+ eiaRequiresEnvironmentalStatement: null,
51
+ eiaCompletedEnvironmentalStatement: true,
52
+ hasStatutoryConsultees: true,
53
+ consultedBodiesDetails: 'in in labore irure nostrud',
54
+ hasConsultationResponses: null,
55
+ hasEmergingPlan: null,
56
+ hasSupplementaryPlanningDocs: null,
57
+ hasInfrastructureLevy: true,
58
+ isInfrastructureLevyFormallyAdopted: false,
59
+ infrastructureLevyAdoptedDate: '1913-06-14T10:40:33.0Z',
60
+ infrastructureLevyExpectedDate: '1912-06-14T10:40:33.0Z',
61
+ lpaProcedurePreference: null,
62
+ lpaProcedurePreferenceDetails: 'in reprehenderit',
63
+ lpaProcedurePreferenceDuration: -34480053.16630782,
64
+ noticeRelatesToBuildingEngineeringMiningOther: null,
65
+ siteAreaSquareMetres: null,
66
+ hasAllegedBreachArea: null,
67
+ doesAllegedBreachCreateFloorSpace: null,
68
+ changeOfUseRefuseOrWaste: null,
69
+ changeOfUseMineralExtraction: null,
70
+ changeOfUseMineralStorage: null,
71
+ relatesToErectionOfBuildingOrBuildings: null,
72
+ relatesToBuildingWithAgriculturalPurpose: null,
73
+ relatesToBuildingSingleDwellingHouse: null,
74
+ affectedTrunkRoadName: null,
75
+ isSiteOnCrownLand: null,
76
+ article4AffectedDevelopmentRights: null
77
+ },
78
+ documents: [document]
79
+ };
80
+
81
+ describe('Enforcement questionnaire command schema', () => {
82
+ const schemas = loadAllSchemasSync();
83
+ const flatSchemas = Object.values(schemas).reduce((a, c) => ({ ...a, ...c }), {});
84
+ const ajv = new Ajv({ schemas: flatSchemas, allErrors: true });
85
+ addFormats(ajv);
86
+
87
+ it('should allow valid schema for Enforcement', () => {
88
+ const validationResult = ajv.validate(schema, exampleEnforcementQuestionnaireSchema);
89
+ assert.strictEqual(validationResult, true);
90
+ });
91
+
92
+ it('should reject missing caseReference', () => {
93
+ const test = structuredClone(exampleEnforcementQuestionnaireSchema);
94
+ delete test.casedata.caseReference;
95
+ const validationResult = ajv.validate(schema, test);
96
+ assert.strictEqual(validationResult, false);
97
+ assert.strictEqual(
98
+ ajv.errors.some((x) => x.message === "must have required property 'caseReference'"),
99
+ true
100
+ );
101
+ });
102
+
103
+ it('should allow additional props', () => {
104
+ const test = structuredClone(exampleEnforcementQuestionnaireSchema);
105
+ test.test = 1;
106
+ const validationResult = ajv.validate(schema, test);
107
+ assert.strictEqual(validationResult, true);
108
+ });
109
+ });