-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PI-2670 - Common-platform-and-delius - Feature flag to toggle data creation #4490
base: main
Are you sure you want to change the base?
Conversation
- Added wiremock mappings files - Fixed failing tests
- Adds a feature flag that when enabled will save records to the database, and when disabled will not save records to the database - Expanded telemetry logging to include further details about record creation
"firstName" to savedEntities.person.forename, | ||
"surname" to savedEntities.person.surname, | ||
"dob" to savedEntities.person.dateOfBirth.toString(), | ||
"genderCode" to savedEntities.person.gender.description, | ||
"pnc" to savedEntities.person.pncNumber.toString(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be careful not to log PII to application insights, so probably best to stick with the identifiers in here (e.g. CRN / hearing / defendant id).
I know this makes the "dry run" events a bit useless, but we can at least get an idea of how many we would create. And maybe we could make a call to the prepare a case system to get more details.
dateOfBirth.let { | ||
val age = Period.between(it, LocalDate.now()).years | ||
require(age > 10) { | ||
"Date of birth would indicate person is under ten years old: $it" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it simplify things to move this out into the Handler, or into a "validate" method?
That way you could perform this validation regardless of the feature flag, and only call insertPerson
if the flag is enabled - e.g. the Handler would become something like:
// this could potentially be moved to a validate method:
val dateOfBirth = requireNotNull(defendant.personDefendant?.personDetails?.dateOfBirth) { "Date of birth not found in message" }
val age = Period.between(dateOfBirth, LocalDate.now()).years
require(age > 10) { "Date of birth would indicate person is under ten years old: $it" }
// only need to check the flag in one place:
if (featureFlags.enabled("common-platform-record-creation-toggle")) {
val (person, address) = personService.insertPerson(defendant, notification.message.hearing.courtCentre.code)
notifier.caseCreated(person)
address?.let { notifier.addressCreated(it) }
telemetryService.trackEvent("PersonCreated", mapOf("hearingId" to ..., "defendantId" to ..., "crn" to ..., etc))
} else {
telemetryService.trackEvent("SimulatedPersonCreated", mapOf("hearingId" to ..., "defendantId" to ...))
}
I'm possibly missing some important detail though, so please let me know if I am! 😄
@@ -54,19 +54,44 @@ class Handler( | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we haven't discussed this previously, but probably worth adding an event here too when we find a match - so we can see how many we get that already exist in Delius.
No description provided.