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-1540 Create new tab sub activities for all campaigns polio and non polio #1313

Conversation

mathvdh
Copy link
Collaborator

@mathvdh mathvdh commented May 21, 2024

Introduce SubActivity Model in Polio Plugin and the related APIs

Related JIRA tickets : POLIO-1540

Self proofreading checklist

  • Did I use eslint and black formatters
  • Is my code clear enough and well documented
  • My migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Doc

In the docs/pages/dev/campaigns/subactivities.md file included in this PR.

Changes

  • Added a new model SubActivity which represents a sub-activity within a round of a campaign. It has fields for name, age unit, minimum age, maximum age, start date, and end date.
  • Added SubActivityScope model to represent the scope of a SubActivity with respect to vaccines.
  • The SubActivity model is linked to the Round model via a foreign key, allowing each round to have multiple sub-activities.
  • The SubActivityScope model is linked to the SubActivity model via a foreign key, allowing each sub-activity to have multiple scopes.

How to test

As this only includes the APIs and no frontend code, you can use /swagger to test and/or use django admin.

@mathvdh mathvdh marked this pull request as ready for review May 22, 2024 08:01
Copy link
Member

@quang-le quang-le left a comment

Choose a reason for hiding this comment

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

I tried the POST and PUT in the front-end, it works fine, but shouldn't we check the values against those of the round? eg:

  • start and end date should be within the round dates
  • scope should be a subset of round scopes
  • vaccines should be a subset of round vaccines

class SubActivityCreateUpdateSerializer(serializers.ModelSerializer):
round_number = serializers.IntegerField(write_only=True, required=False)
campaign = serializers.CharField(write_only=True, required=False)
scopes = SubActivityScopeSerializer(many=True, required=False)
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't the scopes be mandatory?

Copy link
Member

Choose a reason for hiding this comment

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

I think not, you could have first just the encoding of dates and reason of activity and the scope coming later

quang-le added 9 commits May 30, 2024 15:27
- make baseUrl optional in useTabs
- Add useTableState hook
- export polio viruses
- fix query key in useSaveCampaigns
- Pass campaign as prop i.o getting it via formik context
- Add useFilteredDistricts hook to allow filtering on different scopes
- Pass availableVaccines to scopes map to enable more flexible vaccine selection
- Add new components
- update polio dialog tabs
- prevent modal from closing when clicking Confirm
- Show spinner while mutation is performed
- close modal onSuccess. This allows the mutation hook to invalidate the query key and make sure the data is refetched
@madewulf madewulf added the release Should be released in production at next deploy label Jun 3, 2024
quang-le and others added 2 commits June 3, 2024 11:08
@madewulf madewulf merged commit d184c54 into main Jun 4, 2024
3 checks passed
@madewulf madewulf deleted the POLIO-1540-create-new-tab-sub-activities-for-all-campaigns-polio-and-non-polio branch June 4, 2024 07:52
@kemar kemar added Released and removed release Should be released in production at next deploy labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants