Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Nov 8, 2023
2 parents 6973546 + 05fe2df commit dd26f60
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 50 deletions.
2 changes: 1 addition & 1 deletion examples/data/ldcE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export const validLDCE: Schema = {
date: {},
},
},
result: [
preAssessment: [
{
value: 'Planning permission / Immune',
description:
Expand Down
2 changes: 1 addition & 1 deletion examples/data/ldcP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export const validLDCP: Schema = {
},
},
},
result: [
preAssessment: [
{
value: 'Planning permission / Permitted development',
description:
Expand Down
2 changes: 1 addition & 1 deletion examples/data/planningPermission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ export const validPlanningPermission: Schema = {
},
},
},
result: [],
preAssessment: [],
responses: [
{
question: 'Is the property in Lambeth?',
Expand Down
2 changes: 1 addition & 1 deletion examples/data/priorApproval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export const validPriorApproval: Schema = {
},
},
},
result: [
preAssessment: [
{
value: 'Planning permission / Prior approval',
description:
Expand Down
32 changes: 17 additions & 15 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5372,6 +5372,14 @@
],
"type": "object"
},
"PreAssessment": {
"$id": "#PreAssessment",
"description": "The result of the application based on information provided by the applicant, prior to assessment by a planning officer. Results are determined by flags corresponding to responses; each application can have up to one result per flagset",
"items": {
"$ref": "#/definitions/ResultFlag"
},
"type": "array"
},
"ProjectType": {
"$id": "#ProjectType",
"anyOf": [
Expand Down Expand Up @@ -17517,9 +17525,12 @@
"type": "string"
},
"url": {
"type": "string"
"$ref": "#/definitions/URL"
}
},
"required": [
"text"
],
"type": "object"
},
"type": "array"
Expand Down Expand Up @@ -17581,14 +17592,6 @@
},
"type": "array"
},
"Result": {
"$id": "#Result",
"description": "The result of the application. Results are determined by flags corresponding to responses; each application can have up to one result per flagset",
"items": {
"$ref": "#/definitions/ResultFlag"
},
"type": "array"
},
"ResultFlag": {
"$id": "#ResultFlag",
"anyOf": [
Expand Down Expand Up @@ -18837,19 +18840,18 @@
"metadata": {
"$ref": "#/definitions/Metadata"
},
"preAssessment": {
"$ref": "#/definitions/PreAssessment"
},
"responses": {
"$ref": "#/definitions/Responses"
},
"result": {
"$ref": "#/definitions/Result"
}
},
"required": [
"data",
"result",
"metadata",
"responses",
"files"
"files",
"metadata"
],
"title": "Digital Planning Application",
"type": "object"
Expand Down
8 changes: 4 additions & 4 deletions types/Schema.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {Result} from './schema/Result';
import {File} from './schema/File';
import {Metadata} from './schema/Metadata';
import {PreAssessment} from './schema/PreAssessment';
import {Responses} from './schema/Responses';
import {Applicant} from './schema/data/Applicant';
import {Application} from './schema/data/Application';
import {Property} from './schema/data/Property';
import {Proposal} from './schema/data/Proposal';
import {User} from './schema/data/User';
import {File} from './schema/File';

/**
* @title Digital Planning Application
Expand All @@ -20,8 +20,8 @@ export interface Schema {
property: Property;
proposal: Proposal;
};
result: Result;
metadata: Metadata;
preAssessment?: PreAssessment;
responses: Responses;
files: File[];
metadata: Metadata;
}
24 changes: 24 additions & 0 deletions types/schema/PreAssessment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Flags} from '../enums/Flags';

/**
* @id #PreAssessment
* @description The result of the application based on information provided by the applicant, prior to assessment by a planning officer. Results are determined by flags corresponding to responses; each application can have up to one result per flagset
*/
export type PreAssessment = ResultFlag[]; // @todo validate/restrict array to one result per flagset

type FlagKeys = keyof typeof Flags;

type GenericFlag<TKey extends FlagKeys> = {
value: TKey;
description: (typeof Flags)[TKey];
};

type FlagMap = {
[K in FlagKeys]: GenericFlag<K>;
};

/**
* @id #ResultFlag
* @description The result of a single flagset
*/
export type ResultFlag = FlagMap[keyof FlagMap];
8 changes: 5 additions & 3 deletions types/schema/Responses.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {URL} from './../utils';

/**
* @id #Responses
* @description The ordered list of questions, answers, and their metadata for the application
Expand All @@ -7,14 +9,14 @@ export type Responses = QuestionAndResponses[];
export interface QuestionMetaData {
autoAnswered?: boolean;
policyRefs?: Array<{
url?: string;
text?: string;
text: string;
url?: URL;
}>;
sectionName?: string;
}

export interface ResponseMetaData {
flags?: Array<string>; // @todo connect to result/flags enum
flags?: Array<string>; // @todo connect to result/flags enum, is this actually a list?
options?: Array<string> | Array<Response>;
}

Expand Down
24 changes: 0 additions & 24 deletions types/schema/Result.ts

This file was deleted.

0 comments on commit dd26f60

Please sign in to comment.