Skip to content

Commit 7a38607

Browse files
Lint JavaScript using standard.js (#23)
* Swap linting to standard.js style with addittions
1 parent 80c147d commit 7a38607

18 files changed

+822
-498
lines changed

app/config.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Use this file to change prototype configuration.
2-
const path = require('path');
3-
2+
const path = require('path')
43

54
module.exports = {
65
// Service name
@@ -20,7 +19,7 @@ module.exports = {
2019
useDocumentation: true,
2120

2221
paths: {
23-
generatedData: path.join(__dirname, 'data/generated')
22+
generatedData: path.join(__dirname, 'data/generated'),
2423
},
2524

2625
// Clinic settings
@@ -42,21 +41,21 @@ module.exports = {
4241
screening: {
4342
outcomes: {
4443
screening: {
45-
'clear': 0.95,
46-
'needs_further_tests': 0.04,
47-
'cancer_detected': 0.01
44+
clear: 0.95,
45+
needs_further_tests: 0.04,
46+
cancer_detected: 0.01,
4847
},
4948
assessment: {
50-
'clear': 0.4,
51-
'needs_further_tests': 0.45,
52-
'cancer_detected': 0.15
53-
}
54-
}
49+
clear: 0.4,
50+
needs_further_tests: 0.45,
51+
cancer_detected: 0.15,
52+
},
53+
},
5554
},
5655

5756
// Data generation settings
5857
generation: {
5958
numberOfParticipants: 1000,
6059
bookingProbability: 0.8, // 80% of slots are booked
61-
}
62-
};
60+
},
61+
}

app/data/breast-screening-units.js

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
11
// app/data/breast-screening-units.js
2-
const generateId = require('../lib/utils/id-generator');
32

43
module.exports = [
54
{
6-
id: "m5ekcxvu", // Must be hardcoded so it matches generated data
7-
name: "West Sussex BSS",
5+
id: 'm5ekcxvu', // Must be hardcoded so it matches generated data
6+
name: 'West Sussex BSS',
87
address: {
9-
line1: "Breast Screening Unit",
10-
line2: "Worthing Hospital",
11-
line3: "Lyndhurst Rd",
12-
line4: "Headington",
13-
city: "Worthing",
14-
postcode: "BN11 2DH"
8+
line1: 'Breast Screening Unit',
9+
line2: 'Worthing Hospital',
10+
line3: 'Lyndhurst Rd',
11+
line4: 'Headington',
12+
city: 'Worthing',
13+
postcode: 'BN11 2DH',
1514
},
16-
phoneNumber: "01865235621",
17-
abbreviation: "WSB",
18-
clinicTypes: ['screening', 'assessment'], // Can do both
15+
phoneNumber: '01865235621',
16+
abbreviation: 'WSB',
17+
clinicTypes: ['screening', 'assessment'], // Can do both
1918
// Default operating hours for the BSU
2019
sessionPatterns: [
2120
{
2221
name: 'full_day',
2322
type: 'single',
2423
sessions: [
25-
{ startTime: "09:00", endTime: "17:00" }
26-
]
24+
{ startTime: '09:00', endTime: '17:00' },
25+
],
2726
},
2827
{
2928
name: 'split_day',
3029
type: 'paired',
3130
sessions: [
32-
{ startTime: "09:00", endTime: "12:00"},
33-
{ startTime: "13:00", endTime: "17:00"}
34-
]
35-
}
31+
{ startTime: '09:00', endTime: '12:00' },
32+
{ startTime: '13:00', endTime: '17:00' },
33+
],
34+
},
3635
],
3736
locations: [
3837
{
39-
id: "duif1ywp", // Must be hardcoded so it matches generated data
40-
name: "West Sussex BSS",
41-
type: "hospital",
38+
id: 'duif1ywp', // Must be hardcoded so it matches generated data
39+
name: 'West Sussex BSS',
40+
type: 'hospital',
4241
isMainSite: true,
4342
address: {
44-
line1: "Breast Screening Unit",
45-
line2: "Worthing Hospital",
46-
line3: "Lyndhurst Rd",
47-
line4: "Headington",
48-
city: "Worthing",
49-
postcode: "BN11 2DH"
50-
}
43+
line1: 'Breast Screening Unit',
44+
line2: 'Worthing Hospital',
45+
line3: 'Lyndhurst Rd',
46+
line4: 'Headington',
47+
city: 'Worthing',
48+
postcode: 'BN11 2DH',
49+
},
5150
},
5251
// {
5352
// id: generateId(),
@@ -62,40 +61,40 @@ module.exports = [
6261
// }
6362
// },
6463
{
65-
id: "2yt5dukk", // Must be hardcoded so it matches generated data
66-
name: "Mobile Unit JA1 CP7",
67-
type: "mobile_unit",
64+
id: '2yt5dukk', // Must be hardcoded so it matches generated data
65+
name: 'Mobile Unit JA1 CP7',
66+
type: 'mobile_unit',
6867
isMainSite: false,
69-
clinicTypes: ['screening'], // Can only do screening
70-
registration: "JA1 CP7",
68+
clinicTypes: ['screening'], // Can only do screening
69+
registration: 'JA1 CP7',
7170
// Override BSU session patterns for this location
7271
sessionPatterns: [
7372
{
7473
name: 'full_day',
7574
type: 'single',
7675
sessions: [
77-
{ startTime: "09:00", endTime: "17:00" }
78-
]
79-
}
80-
]
76+
{ startTime: '09:00', endTime: '17:00' },
77+
],
78+
},
79+
],
8180
},
8281
{
83-
id: "acxcdcnj", // Must be hardcoded so it matches generated data
84-
name: "Mobile Unit WX71 HCR",
85-
type: "mobile_unit",
82+
id: 'acxcdcnj', // Must be hardcoded so it matches generated data
83+
name: 'Mobile Unit WX71 HCR',
84+
type: 'mobile_unit',
8685
isMainSite: false,
87-
clinicTypes: ['screening'], // Can only do screening
88-
registration: "WX71 HCR",
86+
clinicTypes: ['screening'], // Can only do screening
87+
registration: 'WX71 HCR',
8988
// Override BSU session patterns for this location
9089
sessionPatterns: [
9190
{
9291
name: 'full_day',
9392
type: 'single',
9493
sessions: [
95-
{ startTime: "09:00", endTime: "17:00" }
96-
]
97-
}
98-
]
94+
{ startTime: '09:00', endTime: '17:00' },
95+
],
96+
},
97+
],
9998
},
10099
// {
101100
// id: "acjdcnj", // Must be hardcoded so it matches generated data
@@ -115,6 +114,6 @@ module.exports = [
115114
// }
116115
// ]
117116
// }
118-
]
119-
}
120-
];
117+
],
118+
},
119+
]

app/data/ethnicities.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
module.exports = {
2-
"Asian or Asian British": [
3-
"Bangladeshi",
4-
"Chinese",
5-
"Indian",
6-
"Pakistani",
7-
"Another Asian background"
2+
'Asian or Asian British': [
3+
'Bangladeshi',
4+
'Chinese',
5+
'Indian',
6+
'Pakistani',
7+
'Another Asian background',
88
],
9-
"Black, African, Black British or Caribbean": [
10-
"African",
11-
"Caribbean",
12-
"Another black background"
9+
'Black, African, Black British or Caribbean': [
10+
'African',
11+
'Caribbean',
12+
'Another black background',
1313
],
14-
"Mixed or multiple ethnic groups": [
15-
"Asian and White",
16-
"Black African and White",
17-
"Black Caribbean and White",
18-
"Another mixed background",
14+
'Mixed or multiple ethnic groups': [
15+
'Asian and White',
16+
'Black African and White',
17+
'Black Caribbean and White',
18+
'Another mixed background',
1919
],
20-
"White": [
21-
"British, English, Northern Irish, Scottish, or Welsh",
22-
"Irish",
23-
"Irish Traveller or Gypsy",
24-
"Another White background"
20+
White: [
21+
'British, English, Northern Irish, Scottish, or Welsh',
22+
'Irish',
23+
'Irish Traveller or Gypsy',
24+
'Another White background',
25+
],
26+
'Another ethnic group': [
27+
'Arab',
28+
'Another ethnic background',
2529
],
26-
"Another ethnic group": [
27-
"Arab",
28-
"Another ethnic background"
29-
]
3030
}

app/data/session-data-defaults.js

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
11
// app/data/session-data-defaults.js
22

3-
const users = require("./users");
4-
const breastScreeningUnits = require("./breast-screening-units");
5-
const ethnicities = require("./ethnicities");
6-
const path = require('path');
7-
const fs = require('fs');
8-
const dayjs = require('dayjs');
9-
const { needsRegeneration } = require('../lib/utils/regenerate-data');
3+
const users = require('./users')
4+
const breastScreeningUnits = require('./breast-screening-units')
5+
const path = require('path')
6+
const fs = require('fs')
7+
const { needsRegeneration } = require('../lib/utils/regenerate-data')
108

119
// Check if generated data folder exists and create if needed
12-
const generatedDataPath = path.join(__dirname, 'generated');
10+
const generatedDataPath = path.join(__dirname, 'generated')
1311
if (!fs.existsSync(generatedDataPath)) {
14-
fs.mkdirSync(generatedDataPath);
12+
fs.mkdirSync(generatedDataPath)
1513
}
1614

17-
let participants = [];
18-
let clinics = [];
19-
let events = [];
15+
let participants = []
16+
let clinics = []
17+
let events = []
2018
let generationInfo = {
2119
generatedAt: 'Never',
22-
stats: { participants: 0, clinics: 0, events: 0 }
23-
};
20+
stats: { participants: 0, clinics: 0, events: 0 },
21+
}
2422

2523
// Load generation info
26-
const generationInfoPath = path.join(generatedDataPath, 'generation-info.json');
24+
const generationInfoPath = path.join(generatedDataPath, 'generation-info.json')
2725
if (fs.existsSync(generationInfoPath)) {
2826
try {
29-
generationInfo = JSON.parse(fs.readFileSync(generationInfoPath));
27+
generationInfo = JSON.parse(fs.readFileSync(generationInfoPath))
3028
} catch (err) {
31-
console.warn('Error reading generation info:', err);
29+
console.warn('Error reading generation info:', err)
3230
}
3331
}
3432

3533
// Generate or load data
3634
if (needsRegeneration(generationInfo)) {
37-
console.log('Generating new seed data...');
38-
require('../lib/generate-seed-data.js')();
39-
35+
console.log('Generating new seed data...')
36+
require('../lib/generate-seed-data.js')()
37+
4038
// Save generation info
4139
fs.writeFileSync(
42-
generationInfoPath,
40+
generationInfoPath,
4341
JSON.stringify({ generatedAt: new Date().toISOString() })
44-
);
42+
)
4543
}
4644

4745
// Load generated data
4846
try {
49-
participants = require("./generated/participants.json").participants;
50-
clinics = require("./generated/clinics.json").clinics;
51-
events = require("./generated/events.json").events;
47+
participants = require('./generated/participants.json').participants
48+
clinics = require('./generated/clinics.json').clinics
49+
events = require('./generated/events.json').events
5250
} catch (err) {
53-
console.warn('Error loading generated data:', err);
51+
console.warn('Error loading generated data:', err)
5452
}
5553

5654
module.exports = {
@@ -60,5 +58,5 @@ module.exports = {
6058
participants,
6159
clinics,
6260
events,
63-
generationInfo
64-
};
61+
generationInfo,
62+
}

app/data/users.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module.exports = [
22
{
3-
firstName: "Jane",
4-
lastName: "Hitchin",
5-
role: "mammographer",
6-
7-
id: "ae7537b3-aed1-4620-87fd-9dc5b5bdc8cb",
8-
breastScreeningUnit: "m5ekcxvu"
9-
}
3+
firstName: 'Jane',
4+
lastName: 'Hitchin',
5+
role: 'mammographer',
6+
7+
id: 'ae7537b3-aed1-4620-87fd-9dc5b5bdc8cb',
8+
breastScreeningUnit: 'm5ekcxvu',
9+
},
1010
]

0 commit comments

Comments
 (0)