|
7 | 7 | import json |
8 | 8 | import os |
9 | 9 | from collections import defaultdict |
10 | | -from dataclasses import dataclass, field |
| 10 | +from dataclasses import asdict, dataclass, field |
11 | 11 | from typing import Any, TypedDict |
12 | 12 |
|
13 | 13 | import boto3 |
|
27 | 27 | from app.services.pipeline import ( |
28 | 28 | AugmentationRun, |
29 | 29 | ConditionInput, |
| 30 | + RefinementMetrics, |
| 31 | + RefinementReport, |
30 | 32 | RefinementResult, |
31 | 33 | create_augmentation_run_from_xml_files, |
32 | 34 | discover_reportable_conditions, |
@@ -633,6 +635,29 @@ def process_condition( |
633 | 635 |
|
634 | 636 | state.metadata[jurisdiction_code][rsg_code] = True |
635 | 637 |
|
| 638 | + log_refinement_summary( |
| 639 | + rsg_code=rsg_code, |
| 640 | + jurisdiction_code=jurisdiction_code, |
| 641 | + metrics=result.metrics, |
| 642 | + report=result.report, |
| 643 | + ) |
| 644 | + |
| 645 | + |
| 646 | +def log_refinement_summary( |
| 647 | + rsg_code: str, |
| 648 | + jurisdiction_code: str, |
| 649 | + metrics: RefinementMetrics, |
| 650 | + report: RefinementReport, |
| 651 | +) -> None: |
| 652 | + logger.info( |
| 653 | + "Refinement complete.", |
| 654 | + rsg_code=rsg_code, |
| 655 | + jurisidiction_code=jurisdiction_code, |
| 656 | + metrics=asdict(metrics), |
| 657 | + report=asdict(report), |
| 658 | + operation="log_condition_summary", |
| 659 | + ) |
| 660 | + |
636 | 661 |
|
637 | 662 | def load_condition_mapping_for_jurisdiction( |
638 | 663 | s3_client, |
@@ -808,7 +833,7 @@ def write_refined_outputs( |
808 | 833 | state.output_files.add(rr_output_key) |
809 | 834 |
|
810 | 835 | logger.info( |
811 | | - "Condition refinement complete.", |
| 836 | + "Writing refined output files.", |
812 | 837 | eicr_key=eicr_output_key, |
813 | 838 | rr_key=rr_output_key, |
814 | 839 | eicr_size_reduction_percentage=result.metrics.eicr.size_reduction_percentage, |
|
0 commit comments