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

Feat message management #378

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

Feat message management #378

wants to merge 16 commits into from

Conversation

osundwajeff
Copy link
Contributor

WIP

Fix #308

Copy link

github-actions bot commented Jan 21, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
16414 15457 94% 0% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: cb680a0 by action🐍

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 91.30435% with 8 lines in your changes missing coverage. Please review.

Project coverage is 94.04%. Comparing base (dad4f7e) to head (cb680a0).

Files with missing lines Patch % Lines
django_project/dcas/pipeline.py 64.70% 6 Missing ⚠️
django_project/dcas/functions.py 95.23% 1 Missing ⚠️
django_project/dcas/outputs.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #378   +/-   ##
=======================================
  Coverage   94.04%   94.04%           
=======================================
  Files         259      259           
  Lines       15841    15932   +91     
=======================================
+ Hits        14898    14984   +86     
- Misses        943      948    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@osundwajeff
Copy link
Contributor Author

Hey @danangmassandy I might need your assistance on testing this, as i realised the farm crop parquet files are sent to an S3 bucket.

@osundwajeff osundwajeff marked this pull request as ready for review February 10, 2025 04:25
@@ -465,13 +473,62 @@ def extract_csv_output(self):

return file_path

def filter_message_output(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be done in process_farm_registry_data, right before writing to final parquet file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

also need to add a config from Preferences whether to run the message checks or not.

:rtype: pd.Timestamp or None
"""
# Read historical messages
historical_data = read_grid_crop_data(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should read to parquet file in minio with date filter, similar to
https://github.com/kartoza/tomorrownow_gap/blob/main/django_project/dcas/queries.py#L287

if pd.isna(message_code):
continue # Skip empty messages

last_sent_date = get_last_message_date(
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we query once to get all messages for given a farm from min_allowed_date? then do the check against this list. This is to avoid too many query by each code and farm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants