Skip to content

PPHA-713: Script to create email export list for incentive#443

Open
stephhou wants to merge 15 commits intomainfrom
PPHA-713-Participants-eligible-for-incentive
Open

PPHA-713: Script to create email export list for incentive#443
stephhou wants to merge 15 commits intomainfrom
PPHA-713-Participants-eligible-for-incentive

Conversation

@stephhou
Copy link
Copy Markdown
Contributor

@stephhou stephhou commented Apr 13, 2026

What is the change?

Created a script to run weekly to:

  • Import partner data - new records only
  • Export email addresses, given name and family name for participants to receive incentives.
  • Create a new questions_incentivised table to timestamp when a participant email address has been exported.

Why are we making this change?

  • To create a list of email addresses that are sent to incentive partner. They will use the email address to send the incentive email.

Diagram of tables and their relationships for this query

Lung_IncentiveExportTable

@stephhou stephhou marked this pull request as ready for review April 22, 2026 08:46
Copilot AI review requested due to automatic review settings April 22, 2026 08:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a workflow to export eligible participant email addresses for incentives and records incentive issuance in the database via a new Incentivised model/table.

Changes:

  • Add a psql-oriented SQL script to import weekly partner CSV data, export eligible emails, and mark exported users as incentivised.
  • Introduce a new Incentivised Django model and register it in the questions.models package.
  • Add a Django migration to create the Incentivised table (and also alter WhenYouQuitSmokingResponse.value validators).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
scripts/sql/export_email_addresses_for_incentives.sql New operational script to load partner data, generate an incentive email export, and insert rows into questions_incentivised.
lung_cancer_screening/questions/models/incentivised.py New Django model intended to track incentivisation per user/response set.
lung_cancer_screening/questions/models/init.py Exposes the new Incentivised model from the models package.
lung_cancer_screening/questions/migrations/0012_alter_whenyouquitsmokingresponse_value_incentivised.py Creates Incentivised table and alters a separate field validator.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/sql/export_email_addresses_for_incentives.sql
Comment thread scripts/sql/export_email_addresses_for_incentives.sql Outdated
Comment thread scripts/sql/export_email_addresses_for_incentives.sql
Comment thread scripts/sql/export_email_addresses_for_incentives.sql Outdated
Comment thread lung_cancer_screening/questions/models/incentivised.py Outdated
stephhou and others added 3 commits April 22, 2026 10:39
…uitsmokingresponse_value_incentivised.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Steph Housden <167300771+stephhou@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Steph Housden <167300771+stephhou@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Steph Housden <167300771+stephhou@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@stephhou stephhou changed the title PPHA-713: Creating export list for incentive PPHA-713: Script to create email export list for incentive Apr 23, 2026
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants