Skip to content

Commit b85b001

Browse files
Requesting priors (#254)
* Generate prior mammograms * Work on requesting priors * Add support for local dev settings * Prior mammogram summaries and code cleanup
1 parent 0c06761 commit b85b001

21 files changed

Lines changed: 1404 additions & 68 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ coverage
7777

7878
# LLM instructions
7979
.github
80-
CLAUDE.md
80+
CLAUDE.md
81+
82+
# Local setting overrides (personal dev preferences, not for committing)
83+
*.local.js

app/assets/sass/_misc.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,28 @@ body.js-enabled .app-no-js-only {
101101
0 0 0 calc(2px + $nhsuk-focus-width) $nhsuk-focus-text-colour,
102102
0 0 0 calc(2px + $nhsuk-focus-width + 4px) $nhsuk-focus-colour;
103103
}
104+
105+
// Button styled as a link - for inline form submissions
106+
.app-link-button {
107+
background: none;
108+
border: none;
109+
padding: 0;
110+
color: $nhsuk-link-colour;
111+
text-decoration: underline;
112+
cursor: pointer;
113+
font-size: inherit;
114+
font-family: inherit;
115+
116+
&:hover {
117+
color: $nhsuk-link-hover-colour;
118+
}
119+
120+
&:focus {
121+
@include nhsuk-focused-text;
122+
}
123+
}
124+
125+
// Inline form with no extra spacing
126+
.app-inline-form {
127+
display: inline;
128+
}

app/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ module.exports = {
7777
// Data generation settings
7878
generation: {
7979
numberOfParticipants: 1000,
80-
bookingProbability: 0.8 // 80% of slots are booked
80+
bookingProbability: 0.8, // 80% of slots are booked
81+
previousMammogramRate: 0.05 // Rate of completed events with reported previous mammograms
8182
}
8283
}

app/data/session-data-defaults.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// app/data/session-data-defaults.js
22

3+
const _ = require('lodash')
34
const users = require('./users')
45
// Used to simulate in prototype
56
const breastScreeningUnits = require('./breast-screening-units')
@@ -80,7 +81,7 @@ const defaultSettings = {
8081
}
8182
}
8283

83-
module.exports = {
84+
const defaults = {
8485
users,
8586
currentUserId: users[0].id,
8687
currentUser: users[0],
@@ -99,3 +100,13 @@ module.exports = {
99100
repeatReasons,
100101
symptomTypes
101102
}
103+
104+
// Load local overrides if they exist (gitignored, not committed)
105+
let localOverrides = {}
106+
try {
107+
localOverrides = require('./session-data-defaults.local')
108+
} catch (err) {
109+
// No local overrides file - that's fine
110+
}
111+
112+
module.exports = _.merge({ ...defaults }, localOverrides)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// app/data/session-data-defaults.local.example.js
2+
//
3+
// Copy this file to session-data-defaults.local.js to apply local overrides.
4+
// That file is gitignored and won't be committed.
5+
// Only include the settings you want to change - they're deep-merged on top of defaults.
6+
7+
module.exports = {
8+
settings: {
9+
debugMode: 'true',
10+
reading: {
11+
enableOpinionDelay: 'false'
12+
}
13+
}
14+
}

app/lib/generators/event-generator.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const {
1414
generateSpecialAppointment
1515
} = require('./special-appointment-generator')
1616
const { generateAppointmentNote } = require('./appointment-note-generator')
17+
const { generatePreviousMammograms } = require('./previous-mammogram-generator')
1718
const { getImageSetForEvent } = require('../utils/mammogram-images')
1819
const users = require('../../data/users')
1920
const screeningRooms = require('../../data/screening-rooms')
@@ -291,8 +292,14 @@ const generateEvent = ({
291292
}
292293
}
293294

294-
// Pretend some events have previous images requested
295-
event.hasRequestedImages = weighted.select({ true: 0.3, false: 0.7 })
295+
// Generate previous mammograms (reported mammograms from other facilities)
296+
const previousMammograms = generatePreviousMammograms({
297+
eventDate: event.timing.actualEndTime || event.timing.actualStartTime,
298+
addedByUserId: event.sessionDetails.startedBy
299+
})
300+
if (previousMammograms) {
301+
event.previousMammograms = previousMammograms
302+
}
296303

297304
// Generate medical information (symptoms, medical history, etc.)
298305
// All attributed to the user who ran the appointment

0 commit comments

Comments
 (0)