PPHA-589: multiple types of smoking history#317
Merged
jamiefalcus merged 16 commits intomainfrom Mar 5, 2026
Merged
Conversation
f13067e to
0d0431e
Compare
59b3b06 to
d6c8c71
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the smoking-history flow to support multiple tobacco types per response set (including new cigar size variants and rolling tobacco), and standardizes how tobacco types are represented in URLs and user-facing strings.
Changes:
- Introduces
url_type()/by_url_type()routing for tobacco types and updates views to use it. - Expands tobacco-type handling (e.g., rolling tobacco, pipe, cigar size variants) and updates presenters/templates to use
get_type_display()/unit(). - Updates unit tests + Behave features to cover multi-type smoking history journeys.
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| lung_cancer_screening/questions/views/types_tobacco_smoking.py | Redirect uses the first tobacco history item’s url_type() instead of inflection. |
| lung_cancer_screening/questions/views/smoking_history_question_base_view.py | Normal-history lookup updated to use by_url_type(...).normal(). |
| lung_cancer_screening/questions/views/smoking_frequency.py | Passes normal-history item for changed levels via form kwargs. |
| lung_cancer_screening/questions/views/smoking_current.py | Passes the current tobacco history item into SmokingCurrentForm. |
| lung_cancer_screening/questions/views/smoking_change.py | Scopes change flow to the selected tobacco type via by_url_type(). |
| lung_cancer_screening/questions/views/smoked_total_years.py | Adds logic to progress to the next unanswered tobacco type after completion. |
| lung_cancer_screening/questions/views/responses.py | Back-link now uses TobaccoSmokingHistory.url_type(). |
| lung_cancer_screening/questions/views/mixins/ensure_smoking_history_for_type.py | Looks up history items via by_url_type() instead of camelizing the URL param. |
| lung_cancer_screening/questions/tests/unit/views/test_types_tobacco_smoking.py | Updates redirect expectation to use slugify(...). |
| lung_cancer_screening/questions/tests/unit/views/test_smoking_frequency.py | Factory usage updated to new traits (e.g., cigarettes=True). |
| lung_cancer_screening/questions/tests/unit/views/test_smoking_current.py | Updates factories and redirects to use url_type(). |
| lung_cancer_screening/questions/tests/unit/views/test_smoking_change.py | Adds regression coverage for multiple types when selecting change levels. |
| lung_cancer_screening/questions/tests/unit/views/test_smoked_total_years.py | Adds coverage for moving to the next tobacco type after increased/decreased flows. |
| lung_cancer_screening/questions/tests/unit/views/test_smoked_amount.py | Updates factories and removes a WIP tag. |
| lung_cancer_screening/questions/tests/unit/presenters/test_tobacco_smoking_history_presenter.py | Updates expected presenter strings for rolling tobacco naming/units. |
| lung_cancer_screening/questions/tests/unit/presenters/test_response_set_presenter.py | Updates types list expectations to new/renamed tobacco types. |
| lung_cancer_screening/questions/tests/unit/models/test_tobacco_smoking_history.py | Adds tests for url_type, by_url_type, unit, and per-type query helpers. |
| lung_cancer_screening/questions/tests/unit/models/test_smoked_amount_response.py | Updates factory usage to cigarettes=True. |
| lung_cancer_screening/questions/tests/unit/models/test_response_set.py | Adds test for distinct ordered tobacco types list. |
| lung_cancer_screening/questions/tests/unit/forms/test_types_tobacco_smoking_form.py | Updates factory usage to new traits. |
| lung_cancer_screening/questions/tests/unit/forms/test_smoking_frequency_form.py | Updates form signature usage (no response_set; adds normal-history param). |
| lung_cancer_screening/questions/tests/unit/forms/test_smoking_current_form.py | Verifies label/error messages are type-specific via passed history item. |
| lung_cancer_screening/questions/tests/unit/forms/test_smoking_change_form.py | Updates factories + adds test asserting label contains tobacco type. |
| lung_cancer_screening/questions/tests/unit/forms/test_smoked_total_years_form.py | Adds required error message test including tobacco unit/type. |
| lung_cancer_screening/questions/tests/unit/forms/test_smoked_amount_form.py | Updates expectations for medium cigars and new unit-aware labels/messages. |
| lung_cancer_screening/questions/tests/factories/tobacco_smoking_history_factory.py | Replaces/extends traits to include cigar sizes + rolling tobacco. |
| lung_cancer_screening/questions/presenters/tobacco_smoking_history_type_presenter.py | Uses get_type_display() for titles and summary labels. |
| lung_cancer_screening/questions/presenters/tobacco_smoking_history_presenter.py | Delegates URL/type display to model and uses unit() in sentences. |
| lung_cancer_screening/questions/presenters/response_set_presenter.py | Uses get_type_display() when listing tobacco types smoked. |
| lung_cancer_screening/questions/models/tobacco_smoking_history.py | Adds unit(), url_type(), by_url_type(), and expands tobacco type choices. |
| lung_cancer_screening/questions/models/response_set.py | Adds types_tobacco_smoking_history() helper for distinct ordered type list. |
| lung_cancer_screening/questions/migrations/0004_alter_tobaccosmokinghistory_level_and_more.py | Data migration for rolled→rolling and alters tobacco/history fields. |
| lung_cancer_screening/questions/jinja2/smoked_amount.jinja | Uses get_type_display() and unit() for headings/wording. |
| lung_cancer_screening/questions/jinja2/have_you_ever_smoked.jinja | Updates example copy (rolled → rolling tobacco). |
| lung_cancer_screening/questions/forms/smoking_frequency_form.py | Removes response_set dependency; uses passed normal-history item. |
| lung_cancer_screening/questions/forms/smoking_current_form.py | Label + required message now derived from injected tobacco history item. |
| lung_cancer_screening/questions/forms/smoking_change_form.py | Updates label/messages to use unit-aware strings; fixes existing-level scoping. |
| lung_cancer_screening/questions/forms/smoked_total_years_form.py | Unit-aware labels and required error message. |
| lung_cancer_screening/questions/forms/smoked_amount_form.py | Unit/suffix updates, especially for rolling tobacco and pipe. |
| features/types_tobacco_smoking.feature | Updates expected UI strings and adds a screenshot step. |
| features/steps/page_assertion_steps.py | Adds a step to assert the page title text. |
| features/steps/debug_steps.py | Adds debug step(s) to print smoking history. |
| features/smoking_history.feature | Adds an end-to-end scenario covering multiple tobacco histories. |
| .vscode/settings.json | Adds “kwargs” to spellchecker words and adjusts JSON formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lung_cancer_screening/questions/models/tobacco_smoking_history.py
Outdated
Show resolved
Hide resolved
lung_cancer_screening/questions/migrations/0004_alter_tobaccosmokinghistory_level_and_more.py
Show resolved
Hide resolved
lung_cancer_screening/questions/tests/unit/views/test_smoked_total_years.py
Show resolved
Hide resolved
lung_cancer_screening/questions/jinja2/have_you_ever_smoked.jinja
Outdated
Show resolved
Hide resolved
Use methods or scopes insted where possible
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Andy Mitchell <326561+Themitchell@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Andy Mitchell <326561+Themitchell@users.noreply.github.com>
45db521 to
27dee73
Compare
|
jamiefalcus
approved these changes
Mar 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What is the change?
Why are we making this change?