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

Add purpose primary and secondary models #1088

Merged
merged 15 commits into from
Jun 13, 2024

Conversation

Cruikshanks
Copy link
Member

https://eaflood.atlassian.net/browse/WATER-4442

Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to generate return requirements from the licence's abstraction data. On the /setup page, they can select this option and the service is expected to generate return requirements using the source abstraction data against the licence. The other options are to copy existing return requirements or set them up manually.

When you setup a return requirement you have to specify the frequency (daily, weekly or monthly) meter readings need to be collected and reported.

  • collected - visit the meter and record the reading
  • reported - when submitting the readings how they are to be provided

Generally they are the same, but there are scenarios where we may ask for readings to be collected more frequently than they are reported.

In order to generate the requirements automatically, we need to determine what frequencies to use based on the licence's abstraction data. A specific scenario is licences for the purpose of electricity generation; P-ELC-200 and P-ELC-240.

  • P is the 'purpose primary' code
  • ELC is the 'purpose secondary' code
  • 200 is the 'purpose' legacy ID

We record all 3 against a LicenceVersionPurpose but currently the only one that exists as a model is 'purpose'. To support this work, we also need to know what the primary and secondary purposes on a LicenceVersionPurposeModel are.

So, this change adds the migrations, helpers and models for PurposePrimary and PurposeSecondary and sets up the relationships between them and LicenceVersionPurposeModel.

It then adds a modifier to LicenceVersionPurpose to automate fetching them, along with a custom model instance method that can be used to determine if a LicenceVersionPurposeModel is for the purpose of electricity generation.

https://eaflood.atlassian.net/browse/WATER-4442

> Part of the work to replace NALD for handling return requirements

We want to be able to offer users the option to generate return requirements from the licence's abstraction data. On the `/setup` page they can select this option and the service is expected to generate return requirements using the source abstraction data against the licence. The other options are copy existing return requirements or set them up manually.

When you setup a return requirement you have to specify the frequency (daily, weekly or monthly) meter readings need to be collected and reported.

- collected - visit the meter and record the reading
- reported - when submitting the readings how they are to be provided

Generally they are the same, but there are scenarios where we may ask for readings to be collected more frequently than they are reported.

In order to generate the requirements we need to determine what frequencies to use based on the licence's abstraction data. A specific scenario is licences for the purpose of electricity generation; P-ELC-200 and P-ELC-240.

- `P` is the 'purpose primary' code
- `ELC` is the 'purpose secondary' code
- `200` is the 'purpose' legacy ID

We record all 3 against a `LicenceVersionPurpose` but currently the only one that exists as a model is 'purpose'. To support this work we also need to know what the primary and secondary purpose on a `LicenceVersionPurposeModel` is.

So, this change adds the migrations, helpers and models for `PurposePrimary` and `PurposeSecondary` and sets up the relationships between them and `LicenceVersionPurposeModel`.
@Cruikshanks Cruikshanks added the enhancement New feature or request label Jun 11, 2024
@Cruikshanks Cruikshanks self-assigned this Jun 11, 2024
@Cruikshanks Cruikshanks marked this pull request as ready for review June 13, 2024 07:20
@Cruikshanks Cruikshanks merged commit 0a9d58b into main Jun 13, 2024
6 checks passed
@Cruikshanks Cruikshanks deleted the add-purpose-primary-secondary-models branch June 13, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant