diff --git a/schema/schema.json b/schema/schema.json index dca8c546..5039eb3d 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -72,54 +72,7 @@ "type": "string" }, "ownership": { - "additionalProperties": false, - "properties": { - "certificate": { - "enum": [ - "a", - "b", - "c", - "d" - ], - "type": "string" - }, - "noticeGiven": { - "type": "boolean" - }, - "owners": { - "items": { - "additionalProperties": false, - "properties": { - "address": { - "anyOf": [ - { - "$ref": "#/definitions/AddressInput" - }, - { - "type": "string" - } - ] - }, - "name": { - "type": "string" - }, - "noticeDate": { - "$ref": "#/definitions/Date" - } - }, - "required": [ - "name", - "address" - ], - "type": "object" - }, - "type": "array" - } - }, - "required": [ - "certificate" - ], - "type": "object" + "$ref": "#/definitions/Ownership" }, "siteContact": { "$ref": "#/definitions/SiteContact" @@ -162,39 +115,7 @@ "description": "Information about this planning application", "properties": { "declaration": { - "additionalProperties": false, - "properties": { - "accurate": { - "type": "boolean" - }, - "connection": { - "additionalProperties": false, - "properties": { - "description": { - "type": "string" - }, - "value": { - "enum": [ - "employee", - "relation.employee", - "electedMember", - "relation.electedMember", - "none" - ], - "type": "string" - } - }, - "required": [ - "value" - ], - "type": "object" - } - }, - "required": [ - "accurate", - "connection" - ], - "type": "object" + "$ref": "#/definitions/ApplicationDeclaration" }, "fee": { "$ref": "#/definitions/ApplicationFee" @@ -213,6 +134,43 @@ ], "type": "object" }, + "ApplicationDeclaration": { + "$id": "#ApplicationDeclaration", + "additionalProperties": false, + "description": "Declarations about the accuracy of this application and any personal connections to the receiving authority", + "properties": { + "accurate": { + "type": "boolean" + }, + "connection": { + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "value": { + "enum": [ + "employee", + "relation.employee", + "electedMember", + "relation.electedMember", + "none" + ], + "type": "string" + } + }, + "required": [ + "value" + ], + "type": "object" + } + }, + "required": [ + "accurate", + "connection" + ], + "type": "object" + }, "ApplicationFee": { "$id": "#ApplicationFee", "additionalProperties": false, @@ -940,54 +898,7 @@ "type": "string" }, "ownership": { - "additionalProperties": false, - "properties": { - "certificate": { - "enum": [ - "a", - "b", - "c", - "d" - ], - "type": "string" - }, - "noticeGiven": { - "type": "boolean" - }, - "owners": { - "items": { - "additionalProperties": false, - "properties": { - "address": { - "anyOf": [ - { - "$ref": "#/definitions/AddressInput" - }, - { - "type": "string" - } - ] - }, - "name": { - "type": "string" - }, - "noticeDate": { - "$ref": "#/definitions/Date" - } - }, - "required": [ - "name", - "address" - ], - "type": "object" - }, - "type": "array" - } - }, - "required": [ - "certificate" - ], - "type": "object" + "$ref": "#/definitions/Ownership" }, "siteContact": { "$ref": "#/definitions/SiteContact" @@ -1965,7 +1876,9 @@ "type": "object" }, "LondonDetails": { + "$id": "#LondonDetails", "additionalProperties": false, + "description": "Proposal details for project sites within the Greater London Authority (GLA) area", "properties": { "extend": { "additionalProperties": false, @@ -2605,7 +2518,7 @@ "LondonProperty": { "$id": "#LondonProperty", "additionalProperties": false, - "description": "Property details for sites within London", + "description": "Property details for sites within the Greater London Authority (GLA) area", "properties": { "EPC": { "additionalProperties": false, @@ -2676,6 +2589,7 @@ "type": "array" }, "region": { + "const": "London", "type": "string" }, "titleNumber": { @@ -2952,6 +2866,58 @@ ], "type": "object" }, + "Ownership": { + "$id": "#Ownership", + "additionalProperties": false, + "description": "Information about the ownership certificate and owners, if different than the applicant", + "properties": { + "certificate": { + "enum": [ + "a", + "b", + "c", + "d" + ], + "type": "string" + }, + "noticeGiven": { + "type": "boolean" + }, + "owners": { + "items": { + "additionalProperties": false, + "properties": { + "address": { + "anyOf": [ + { + "$ref": "#/definitions/AddressInput" + }, + { + "type": "string" + } + ] + }, + "name": { + "type": "string" + }, + "noticeDate": { + "$ref": "#/definitions/Date" + } + }, + "required": [ + "name", + "address" + ], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "certificate" + ], + "type": "object" + }, "PlanningConstraint": { "$id": "#PlanningConstraint", "anyOf": [ @@ -17193,16 +17159,7 @@ "type": "object" }, "date": { - "additionalProperties": false, - "properties": { - "completion": { - "$ref": "#/definitions/Date" - }, - "start": { - "$ref": "#/definitions/Date" - } - }, - "type": "object" + "$ref": "#/definitions/ProposalDates" }, "description": { "type": "string" @@ -17223,6 +17180,20 @@ ], "type": "object" }, + "ProposalDates": { + "$id": "#ProposalDates", + "additionalProperties": false, + "description": "When the proposed works will start and be completed by, not required for all application types", + "properties": { + "completion": { + "$ref": "#/definitions/Date" + }, + "start": { + "$ref": "#/definitions/Date" + } + }, + "type": "object" + }, "ProposalDetails": { "$id": "#ProposalDetails", "anyOf": [ @@ -18037,7 +18008,7 @@ "type": "array" }, "region": { - "type": "string" + "$ref": "#/definitions/UKRegion" }, "type": { "$ref": "#/definitions/PropertyType" @@ -18051,6 +18022,22 @@ ], "type": "object" }, + "UKRegion": { + "$id": "#UKRegion", + "description": "UK regions sourced from planning.data.gov.uk/dataset/region, where London is a proxy for the Greater London Authority (GLA) area", + "enum": [ + "North East", + "North West", + "Yorkshire and The Humber", + "East Midlands", + "West Midlands", + "East of England", + "London", + "South East", + "South West" + ], + "type": "string" + }, "URL": { "format": "uri", "pattern": "^https?://", diff --git a/types/enums/PropertyTypes.ts b/types/enums/PropertyTypes.ts index b3169405..037757d4 100644 --- a/types/enums/PropertyTypes.ts +++ b/types/enums/PropertyTypes.ts @@ -1,5 +1,5 @@ /** - * Values of `data.property.type` + * Values of `data.property.type`, derived from Basic Land and Property Unit (BLPU) classification codes */ export const PropertyTypes = { commercial: 'Commercial', diff --git a/types/schema/data/Applicant.ts b/types/schema/data/Applicant.ts index bbb81d0c..5e8477ad 100644 --- a/types/schema/data/Applicant.ts +++ b/types/schema/data/Applicant.ts @@ -14,20 +14,26 @@ export type Applicant = BaseApplicant | Agent; export interface BaseApplicant { type: 'individual' | 'company' | 'charity' | 'public' | 'parishCouncil'; interest?: 'owner.sole' | 'owner.co' | 'tenant' | 'occupier' | 'other'; - ownership?: { - certificate: 'a' | 'b' | 'c' | 'd'; - noticeGiven?: boolean; - owners?: { - name: string; - address: AddressInput | string; - noticeDate?: Date; - }[]; - }; + ownership?: Ownership; contact: UserContact; address: UserAddress; siteContact: SiteContact; } +/** + * @id #Ownership + * @description Information about the ownership certificate and owners, if different than the applicant + */ +export interface Ownership { + certificate: 'a' | 'b' | 'c' | 'd'; + noticeGiven?: boolean; + owners?: { + name: string; + address: AddressInput | string; + noticeDate?: Date; + }[]; +} + /** * @id #Agent * @description Information about the user who completed the application on behalf of someone else diff --git a/types/schema/data/Application.ts b/types/schema/data/Application.ts index f7a4aa9c..6e6b1648 100644 --- a/types/schema/data/Application.ts +++ b/types/schema/data/Application.ts @@ -8,18 +8,7 @@ import {Date} from '../../utils'; export interface Application { type: ApplicationType; fee: ApplicationFee; - declaration: { - accurate: boolean; - connection: { - value: - | 'employee' - | 'relation.employee' - | 'electedMember' - | 'relation.electedMember' - | 'none'; - description?: string; - }; - }; + declaration: ApplicationDeclaration; preApp?: PreApplication; } @@ -45,6 +34,23 @@ export interface ApplicationFee { }; } +/** + * @id #ApplicationDeclaration + * @description Declarations about the accuracy of this application and any personal connections to the receiving authority + */ +export interface ApplicationDeclaration { + accurate: boolean; + connection: { + value: + | 'employee' + | 'relation.employee' + | 'electedMember' + | 'relation.electedMember' + | 'none'; + description?: string; + }; +} + /** * @id #PreApplication * @description Details of the pre-application, if applicable diff --git a/types/schema/data/Property.ts b/types/schema/data/Property.ts index 483183fb..132a558e 100644 --- a/types/schema/data/Property.ts +++ b/types/schema/data/Property.ts @@ -9,13 +9,28 @@ import {Area, URL} from '../../utils'; */ export type Property = UKProperty | LondonProperty; +/** + * @id #UKRegion + * @description UK regions sourced from planning.data.gov.uk/dataset/region, where London is a proxy for the Greater London Authority (GLA) area + */ +export type UKRegion = + | 'North East' + | 'North West' + | 'Yorkshire and The Humber' + | 'East Midlands' + | 'West Midlands' + | 'East of England' + | 'London' + | 'South East' + | 'South West'; + /** * @id #UKProperty * @description Property details for sites anywhere in the UK */ export interface UKProperty { address: ProposedAddress | OSAddress; - region: string; + region: UKRegion; localAuthorityDistrict: string[]; type: PropertyType; boundary?: { @@ -29,9 +44,10 @@ export interface UKProperty { /** * @id #LondonProperty - * @description Property details for sites within London + * @description Property details for sites within the Greater London Authority (GLA) area */ export interface LondonProperty extends UKProperty { + region: Extract; titleNumber: { known: 'Yes' | 'No'; number?: string; diff --git a/types/schema/data/Proposal.ts b/types/schema/data/Proposal.ts index 38a42031..77a0caeb 100644 --- a/types/schema/data/Proposal.ts +++ b/types/schema/data/Proposal.ts @@ -14,13 +14,19 @@ export interface Proposal { site: GeoJSON; area: Area; }; - date?: { - start?: Date; - completion?: Date; - }; + date?: ProposalDates; details?: ProposalDetails; } +/** + * @id #ProposalDates + * @description When the proposed works will start and be completed by, not required for all application types + */ +export interface ProposalDates { + start?: Date; + completion?: Date; +} + /** * @id #ProposalDetails * @description Details about the changes being proposed @@ -41,6 +47,10 @@ export interface BaseDetails { }; } +/** + * @id #LondonDetails + * @description Proposal details for project sites within the Greater London Authority (GLA) area + */ export interface LondonDetails extends BaseDetails { vehicleParking: { type: VehicleParking[];