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

Calculate accountability end date #265

Merged
merged 5 commits into from
Aug 26, 2024
Merged

Calculate accountability end date #265

merged 5 commits into from
Aug 26, 2024

Conversation

Wambere
Copy link
Contributor

@Wambere Wambere commented Aug 22, 2024

Add functionality to calculate the accountability date using the product's accountability period

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes #264

Engineer Checklist

  • I have run ./gradlew spotlessApply to check my code follows the project's style guide
  • I have built and run the efsity jar to verify my change fixes the issue and/or does not break the application



def calculate_date(delivery_date: str, product_accountability_period: int) -> str:
delivery_datetime = datetime.strptime(delivery_date, "%Y-%m-%dT%H:%M:%S.%fZ")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@peterMuriuki is this date format assumption correct? or should we make this a parameter?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that looks correct, The format is YYYY, YYYY-MM, YYYY-MM-DD or YYYY-MM-DDThh:mm:ss+zz:zz,

ref: https://www.hl7.org/fhir/R4/datatypes.html#dateTime

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@peterMuriuki I was thinking more inline of the csv. Since those are not necessarily coming from the server
Unless someone exports the resources.
I'll create a separate issue to extend this just in case

Comment on lines 408 to 411
if (
character["code"]["coding"][0]["display"]
== "Accountability period (in months)"
):
Copy link
Contributor

@peterMuriuki peterMuriuki Aug 23, 2024

Choose a reason for hiding this comment

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

probably better to use the code.coding.system and code.coding.code, since those are less likely to be moving targets.

export const smartRegisterCodeSystem = 'http://smartregister.org/codes';
export const accountabilityCharacteristicCode = '67869606';

export const accountabilityCharacteristicCoding = {
  system: smartRegisterCodeSystem,
  code: accountabilityCharacteristicCode,
  display: 'Accountability period (in months)',
};

@Wambere Wambere mentioned this pull request Aug 23, 2024
@Wambere Wambere merged commit 20afab3 into main Aug 26, 2024
4 checks passed
@Wambere Wambere deleted the 264-remove-end-date branch August 26, 2024 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove accountability end date in inventory template
3 participants