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/2646 total errors aggregates #2800

Merged
merged 25 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
58ddd8d
total_errors_by_month aggregator
jtimpe Jan 5, 2024
b86e66f
impl total_errors aggregator
jtimpe Jan 5, 2024
15be219
submission history component structure
jtimpe Jan 5, 2024
525c18c
total errors frontend impl
jtimpe Jan 5, 2024
52f1025
Merge branch 'develop' into feat/2646-total-errors-aggregates
jtimpe Jan 5, 2024
da3f2b0
add section 3/4 aggregates to tests
jtimpe Jan 17, 2024
f3a20ed
Merge branch 'develop' into feat/2646-total-errors-aggregates
jtimpe Jan 19, 2024
6b6410c
lint
jtimpe Jan 19, 2024
6d4f282
fix null coalescing
jtimpe Jan 19, 2024
dd039b1
fix+add aggregates tests
jtimpe Jan 19, 2024
cd5f733
add tribal tests, positive case test
jtimpe Jan 23, 2024
b1889aa
remove unused code from total_errors aggregate func
jtimpe Jan 23, 2024
850bbd0
remove unnecessary saves
jtimpe Jan 23, 2024
d671e2a
Merge branch 'develop' into feat/2646-total-errors-aggregates
jtimpe Jan 23, 2024
1c2ce4f
move total_errors to aggregates.py
jtimpe Jan 23, 2024
7c3180c
extra blank line
jtimpe Jan 23, 2024
54e98e5
undo formatter changes
jtimpe Jan 23, 2024
1124d5a
extra space
jtimpe Jan 23, 2024
579b526
Merge branch 'develop' into feat/2646-total-errors-aggregates
jtimpe Feb 13, 2024
12c3d6b
make the query more efficient
jtimpe Feb 13, 2024
51a5a09
Merge branch 'develop' into feat/2646-total-errors-aggregates
ADPennington Feb 21, 2024
13a7c18
Merge branch 'develop' into feat/2646-total-errors-aggregates
ADPennington Feb 22, 2024
94f2477
Merge branch 'develop' into feat/2646-total-errors-aggregates
jtimpe Feb 26, 2024
f836320
rm unused code
jtimpe Feb 26, 2024
b0e063a
fix error report url
jtimpe Feb 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions tdrs-backend/tdpservice/parsers/aggregates.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,28 @@ def case_aggregates_by_month(df, dfs_status):
aggregate_data['rejected'] = ParserError.objects.filter(file=df).filter(case_number=None).count()

return aggregate_data


def total_errors_by_month(df, dfs_status):
"""Return total errors for each month in the reporting period."""
calendar_year, calendar_qtr = fiscal_to_calendar(df.year, df.quarter)
month_list = transform_to_months(calendar_qtr)

total_errors_data = {"months": []}

errors = ParserError.objects.all().filter(file=df)

for month in month_list:
if dfs_status == "Rejected":
total_errors_data["months"].append(
{"month": month, "total_errors": "N/A"})
continue

month_int = month_to_int(month)
rpt_month_year = int(f"{calendar_year}{month_int}")

error_count = errors.filter(rpt_month_year=rpt_month_year).count()
total_errors_data["months"].append(
{"month": month, "total_errors": error_count})

return total_errors_data
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
HEADER20204S06 TAN1 N
T720204700006853700680540068454103000312400000000003180104000347400036460003583106000044600004360000325299000506200036070003385202000039100002740000499
TRAILER0000001
Loading
Loading