Skip to content

Commit

Permalink
Feature/sir 1103 (#238)
Browse files Browse the repository at this point in the history
* schema and question set update to support ICS create a report application

* updating answer and question IDs for CREATE_A_REPORT question set

* Fixing schema file reads

* removing createareport boolean
  • Loading branch information
teddmason authored Dec 16, 2024
1 parent 81b4536 commit 74579ef
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 13 deletions.
66 changes: 62 additions & 4 deletions server/schemas/sirp-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,71 @@
100,
200,
300,
400
400,
500,
600,
700,
800,
900,
1000,
1100,
1200,
1300,
1400,
1500,
1600,
1700,
1800,
1900,
2000,
2100,
2200,
2300,
2400,
2500,
2600,
2700,
2800,
2900,
3000,
3100,
3200,
3300
],
"meta:enum": {
"100": "Water Pollution",
"100": "Water pollution",
"200": "Odour",
"300": "Illegal Fishing",
"400": "Flooding"
"300": "Blockage in a watercourse",
"400": "Abstraction/low levels",
"500": "Alteration to a water course",
"600": "Beach pollution",
"700": "Burning of waste",
"800": "Damage to nature",
"900": "Dust",
"1000": "Fire",
"1100": "Fish disease",
"1200": "Fish kill",
"1300": "Flies",
"1400": "Flooding - external report",
"1500": "Flooding - internal report",
"1600": "Flytipping",
"1700": "Healthy concern",
"1800": "Illegal fishing",
"1900": "Illegal waste site",
"2000": "Invasive species",
"2100": "Land contamination",
"2200": "Litter",
"2300": "Mud",
"2400": "Navigation incident",
"2500": "Noise",
"2600": "Oil and chemical spills",
"2700": "Radioactive and nuclear",
"2800": "Reservoir incident",
"2900": "Road traffic collision",
"3000": "Suspected permit breach",
"3100": "Vermin",
"3200": "Waste carrier",
"3300": "Other"
}
},
"datetimeReported": {
Expand Down
5 changes: 3 additions & 2 deletions server/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import fs from 'fs'
import constants from './constants.js'
import Ajv from 'ajv'
import addFormats from 'ajv-formats'
import dirname from '../../dirname.cjs'

const sirpSchema = JSON.parse(fs.readFileSync('./server/schemas/sirp-schema.json'))
const feedbackSchema = JSON.parse(fs.readFileSync('./server/schemas/feedback-schema.json'))
const sirpSchema = JSON.parse(fs.readFileSync(`${dirname}/server/schemas/sirp-schema.json`))
const feedbackSchema = JSON.parse(fs.readFileSync(`${dirname}/server/schemas/feedback-schema.json`))

const getErrorSummary = () => {
return JSON.parse(JSON.stringify(constants.errorSummary))
Expand Down
69 changes: 62 additions & 7 deletions server/utils/question-sets.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,13 +703,68 @@ const questionSets = {
}
}
},
ILLEGAL_FISHING: {
questionSetId: 300,
questions: {}
},
FLOODING: {
questionSetId: 400,
questions: {}
CREATE_A_REPORT: {
questionSetId: 0,
questions: {
REPORTED_BY_EMAIL: {
questionId: 3800,
text: 'Reported by email?',
answers: {
yes: {
answerId: 3801,
text: 'Yes'
},
no: {
answerId: 3802,
text: 'No'
}
}
},
REPORTED_PHOTOS_OR_VIDEOS: {
questionId: 3900,
text: 'Has photos or videos of problem',
answers: {
yes: {
answerId: 3901,
text: 'Yes'
},
no: {
answerId: 3902,
text: 'NO'
}
}
},
EXTERNAL_ORGANISATION_REPORT: {
questionId: 4000,
text: 'External organisation report',
answers: {
water: {
answerId: 4001,
text: 'Water company'
},
other: {
answerId: 4002,
text: 'Public organisation'
},
name: {
answerId: 4003,
text: 'Name of company or organisation'
}
}
},
INCIDENT_LOCATION: {
questionId: 4100,
text: 'Location of incident',
answers: {
nationalGridReference: {
answerId: 4101
},
locationDescription: {
answerId: 4102
}
}
}
}
}
}

Expand Down

0 comments on commit 74579ef

Please sign in to comment.