Repository navigation
Conversation
Member
|
Hi @Aliussman, we should be having a frontend implementation for that feature. Feel free to create issue and PR. Thanks, |
Collaborator
|
Hey @Aliussman, thanks for putting this together, it's a big one and the tests look really thorough! Before I review it for merge there are a few things. Like Marc said, this needs a frontend side, so could you open an issue + PR in fireform-frontend and link them here? It's also conflicting with development in router.py now, so it'll need a rebase. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements periodic report generation API endpoints and async worker execution for monthly, quarterly, and annual department reporting in FireForm as outlined in #557 (part of contract tracker #541).
Key Additions:
POST /api/v1/reports/generate: Asynchronously kicks off periodic report generation; returns202 Acceptedwithreport_id,job_id, andpoll_url.GET /api/v1/reports/{report_id}: Polling and result retrieval. Returns202 Acceptedwithretry_after_secondswhile generating; returns200 OKwith PDF binary or JSON payload (PeriodicReportschema) upon completion; returns404 Not Foundif missing.contracts/path/reporting.yamlandcontracts/schemas/reporting.yaml, mounted incontracts/openapi.yaml.app/api/schemas/reporting.pyand updatedAsyncJobResponseinapp/api/schemas/common.py.create_report,get_report,update_report,get_incidents_in_date_range(with strict UTC timezone awareness),get_forms_for_incidents, andget_extractions_by_idsinapp/db/repositories.py.app/services/reporting.pywith period boundary computation & validation, future period rejection (422 Unprocessable Entitywith codeFUTURE_PERIOD), metrics aggregation (incident types, statuses, forms generated, completeness score, processing time), compliance metrics (NERIS submission rate, delay, overdue count), and ReportLab-based PDF generation.generate_periodic_reportinapp/tasks/report.pyand registered it inapp/core/celery.py.reportlabtorequirements.txtfor PDF rendering.Fixes #557
Type of change
How Has This Been Tested?
tests/test_v1_reports.py(18 tests):POST /api/v1/reports/generate-> 202).422 Unprocessable EntitywithFUTURE_PERIOD).GET /api/v1/reports/{id}-> 202).Content-Type: application/pdf).PeriodicReportschema.404 Not Found).503 Service Unavailable).PYTHONPATH=. pytest→ 331 passed.python -m ruff check app/ tests/→ All checks passed!Test Configuration:
Checklist: