Skip to content

Conversation

thomasleese
Copy link
Contributor

@thomasleese thomasleese commented Jun 5, 2025

This refactors how consents forms model the information related to giving consent to multiple programmes in the same form. This change isn't strictly related to Flu, but future work will build upon it.

The main change is to move whether a programme has been given consent for or not out of the ConsentForm model and in to the individual ConsentFormProgramme models. At the moment we only support up to two programmes in a single consent form, but this would open the door to allowing more than two programmes in a single consent form.

Where before the model looked something like:

  • ConsentForm with many programmes
    • response one of given, given_one or refused
    • chosen_vaccines either nil or hpv, menacwy, td_ipv

The model now looks something like:

  • ConsentForm with many programmes
    • Each programme
      • response one of either given or refused

I've made this change in preparation for Flu where we will also need to store the preferred vaccine method or methods and the ConsentFormProgramme seemed like the right place for it. Although this could be done without this refactor, there was a mismatch between where we were storing the consent response and where we were storing preferences specific to the programme.

Jira Issue

@thomasleese thomasleese added this to the v2.2.5 milestone Jun 5, 2025
@thomasleese thomasleese requested a review from a team as a code owner June 5, 2025 18:07
@thomasleese thomasleese added the refactor Improving maintainability label Jun 5, 2025
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 5, 2025 18:09 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 78c5a60 to 03806b0 Compare June 5, 2025 18:12
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 5, 2025 18:12 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 03806b0 to ea2dde9 Compare June 5, 2025 18:39
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 5, 2025 18:39 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from ea2dde9 to 5a6c15e Compare June 5, 2025 19:39
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 5, 2025 19:39 Inactive
@thomasleese thomasleese modified the milestones: v2.2.5, v2.2.6 Jun 5, 2025
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 5a6c15e to 7a5454c Compare June 5, 2025 19:57
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 5, 2025 19:58 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 7a5454c to c91ce92 Compare June 5, 2025 20:00
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 5, 2025 20:01 Inactive
@thomasleese thomasleese modified the milestones: v2.2.6, v2.3.0 Jun 6, 2025
@thomasleese thomasleese marked this pull request as draft June 6, 2025 07:07
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from c91ce92 to 662d944 Compare June 6, 2025 07:24
@thomasleese thomasleese changed the base branch from main to remove-contact-injection June 6, 2025 07:25
@thomasleese thomasleese modified the milestones: v2.3.0, v2.2.6 Jun 6, 2025
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 6, 2025 07:25 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 662d944 to efa5f59 Compare June 6, 2025 07:41
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 6, 2025 07:41 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from efa5f59 to c290f1c Compare June 6, 2025 07:42
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 6, 2025 07:42 Inactive
@thomasleese thomasleese force-pushed the remove-contact-injection branch from 373360f to 531d6da Compare June 6, 2025 07:46
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from c290f1c to 1750686 Compare June 6, 2025 07:47
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 6, 2025 07:47 Inactive
@thomasleese thomasleese marked this pull request as ready for review June 6, 2025 11:41
Base automatically changed from remove-contact-injection to main June 6, 2025 15:55
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 1750686 to 0f773b2 Compare June 7, 2025 06:29
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 7, 2025 06:29 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 0f773b2 to e77b6d2 Compare June 7, 2025 18:30
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 7, 2025 18:30 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from e77b6d2 to 025f61e Compare June 9, 2025 06:52
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 9, 2025 06:52 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 025f61e to 826fb64 Compare June 9, 2025 15:54
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 9, 2025 15:54 Inactive
@thomasleese thomasleese force-pushed the consent-form-programme-response branch 2 times, most recently from bbc6a1b to 400875c Compare June 10, 2025 18:24
@thomasleese thomasleese requested a review from a team as a code owner June 10, 2025 18:24
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 400875c to eb14122 Compare June 11, 2025 09:47
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from eb14122 to a98037f Compare June 11, 2025 13:59
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from a98037f to 8770c64 Compare June 12, 2025 13:57
@thomasleese thomasleese changed the base branch from main to next June 12, 2025 13:58
This refactors how consents forms model the information related to
giving consent to multiple programmes in the same form. This change
isn't strictly related to Flu, but future work will build upon it.

The main change is to move whether a programme has been given consent
for or not out of the `ConsentForm` model and in to the individual
`ConsentFormProgramme` models. At the moment we only support up to two
programmes in a single consent form, but this would open the door to
allowing more than two programmes in a single consent form.

Where before the model looked something like:

- `ConsentForm` with many programmes
  - `response` one of `given`, `given_one` or `refused`
  - `chosen_vaccines` either `nil` or `hpv`, `menacwy`, `td_ipv`

The model now looks something like:

- `ConsentForm` with many programmes
  - Each programme
    - `response` one of either `given` or `refused`

I've made this change in preparation for Flu where we will also need to
store the preferred vaccine method or methods and the
`ConsentFormProgramme` seemed like the right place for it. Although this
could be done without this refactor, there was a mismatch between where
we were storing the consent response and where we were storing
preferences specific to the programme.

Jira-Issue: MAV-1230
@thomasleese thomasleese force-pushed the consent-form-programme-response branch from 8770c64 to bf19acc Compare June 12, 2025 14:21
@tvararu tvararu temporarily deployed to mavis-pr-3669 June 12, 2025 14:22 Inactive
Copy link

@thomasleese thomasleese merged commit f136fd2 into next Jun 12, 2025
9 checks passed
@thomasleese thomasleese deleted the consent-form-programme-response branch June 12, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Improving maintainability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants