Skip to content
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

POLIO-1716: add stock history #1801

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Conversation

quang-le
Copy link
Member

@quang-le quang-le commented Nov 14, 2024

Save state of vaccine stock 14 days after round end and make that data available for openhexa

Related JIRA tickets : POLIO-1716

Self proofreading checklist

  • Did I use eslint and black formatters
  • Is my code clear enough and well documented
  • Are my typescript files well typed
  • New translations have been added or updated if new strings have been introduced in the frontend
  • My migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Doc

Tell us where the doc can be found (docs folder, wiki, in the code...).

Changes

  • Add VaccineStockHistory model

  • Update VaccineStockCalculator be able to compute for a certain date

  • Add task to create VaccineStockHistory for a certain date, computing the values with VaccineStockCalculator

  • Add command to update existing DB

  • Add /api/polio/dashboards/vaccine_stock_history endpoint for OpenHexa. It's a basic endpoint with a couple of filters.

  • Breakdown:

The key method is archive_stock_for_round. It takes a Round, a VaccineStock and a date and create the VaccineStockHistory with the required values, if and only if there's not already a VaccineStockHistory for the round+vaccine stock

The task and the command have a similar behaviour:
- The task will take the reference date and select all rounds that ended on reference_date - 14 days, then update them
- The command will update all rounds for every vaccine, starting with the oldest, which is the key part to avoud having multiple rounds with the same stock history data.

How to test

  • restore the test Db we made for this feature
  • run the command
  • launch the task

Print screen / video

Nothing to show in the UI

Notes

WHAT THIS FEATURE DOES NOT DO

  • Update the history if data is changed "in the past", e.g.: a Form A is input today for a campaign over for a month
  • Automatically update/archive the stock data: This will either be done via a cron job or an OpenHexa pipeline
  • Improve performance of the Stocks page: the archived stock data is not used to save computation of the stock page

Follow the Conventional Commits specification

The merge message of a pull request must follow the Conventional Commits specification.

This convention helps to automatically generate release notes.

Use lowercase for consistency.

Example:

fix: empty instance pop up

Refs: IA-3665

Note that the Jira reference is preceded by a line break.

Both the line break and the Jira reference are entered in the Add an optional extended description… field.

@quang-le quang-le marked this pull request as draft November 14, 2024 16:52
@quang-le quang-le marked this pull request as ready for review November 14, 2024 17:09
@quang-le quang-le added the release Should be released in production at next deploy label Nov 14, 2024
@beygorghor beygorghor removed the release Should be released in production at next deploy label Nov 18, 2024
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.

3 participants