Adding inital data comparison#5206
Conversation
Not linted, but it is tested. Want to get other people's eyes on it.
|
This pull request is not up to date with main. Please merge main into this brach or rebase this branch onto main. This PR should not be approved until all status checks pass. If you see this message, please rerun all status checks before merging. |
|
Terraform plan for meta No changes. Your infrastructure matches the configuration.📝 Plan generated in Pull Request Checks #651 |
|
Terraform plan for dev Plan: 1 to add, 0 to change, 1 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# module.dev.module.cors.null_resource.cors_header must be replaced
-/+ resource "null_resource" "cors_header" {
!~ id = "*******************" -> (known after apply)
!~ triggers = { # forces replacement
!~ "always_run" = "2026-03-27T12:43:52Z" -> (known after apply)
}
}
Plan: 1 to add, 0 to change, 1 to destroy.📝 Plan generated in Pull Request Checks #651 |
Visit http://localhost:8000/audit/compare/2023-12-GSAFAC-0000058119/2023-12-GSAFAC-0000065436 to see a pair of audits compared. These are a "resubmission." For two that are very different: http://localhost:8000/audit/compare/2023-12-GSAFAC-0000058119/2023-09-GSAFAC-0000016690 This assumes *full* data loaded. No need to truncate.
|
This pull request is not up to date with main. Please merge main into this brach or rebase this branch onto main. This PR should not be approved until all status checks pass. If you see this message, please rerun all status checks before merging. |
|
This pull request is not up to date with main. Please merge main into this brach or rebase this branch onto main. This PR should not be approved until all status checks pass. If you see this message, please rerun all status checks before merging. |
Adding more info to what comes back, so that we can present it better. More consistent across categories of difference, for ease of rendering. Improved layout.
|
This pull request is not up to date with main. Please merge main into this brach or rebase this branch onto main. This PR should not be approved until all status checks pass. If you see this message, please rerun all status checks before merging. |
This would be what it looks like if we only show what changed. The page gets much shorter. And, perhaps, more understandable, because we are not showing things that did not change. Less to parse.
|
This pull request is not up to date with main. Please merge main into this brach or rebase this branch onto main. This PR should not be approved until all status checks pass. If you see this message, please rerun all status checks before merging. |
More tests. The "compare_with_previous" code can serve as test code for resubmission generation, in a way. This fixes how we initiate a resubmission. It eliminates most data being copied over. We should largely end up with an empty audit, save for some metadata. Correctly yields differences.
|
This pull request is not up to date with main. Please merge main into this brach or rebase this branch onto main. This PR should not be approved until all status checks pass. If you see this message, please rerun all status checks before merging. |
Not sure where it happens. However, it cannot be allowed to happen. When we do a resub, it cannot modify the original.
|
This pull request is not up to date with main. Please merge main into this brach or rebase this branch onto main. This PR should not be approved until all status checks pass. If you see this message, please rerun all status checks before merging. |
- add url pattern for resub comparison page(s) - fix sac comparison logic and tests
diff --git a/backend/audit/test_viewlib/test_compare_submissions.py b/backend/audit/test_viewlib/test_compare_submissions.py index 8dba783..5aceaec 100644 --- a/backend/audit/test_viewlib/test_compare_submissions.py +++ b/backend/audit/test_viewlib/test_compare_submissions.py @@ -1,4 +1,3 @@ -import unittest from django.test import TestCase from audit.viewlib.compare_two_submissions import ( compare_report_ids, @@ -372,8 +371,6 @@ class CompareSubmissionTests(TestCase): res = compare_lists_of_objects(d1, d2, ["b"], lambda o: o["value"]) - print(f"res --> {res}") - self.assertEqual( # res, {"status": "changed", "in_r1": ["2"], "in_r2": ["3"], "in_both": []} # res, {'status': 'changed', 'in_r1': [{'from': None, 'to': 2, 'key': 'b'}], 'in_r2': [{'from': None, 'to': 3, 'key': 'b'}], 'in_both': [{'from': 'Related to: name, value', 'to': '2 difference', 'key': 2}]} @@ -390,7 +387,6 @@ class CompareSubmissionTests(TestCase): ) res = compare_lists_of_objects(d1, d3, ["b"], lambda o: o["value"]) - print(f"res --> {res}") self.assertEqual( # res, {"status": "changed", "in_r1": [], "in_r2": ["4"], "in_both": ["2"]} diff --git a/backend/audit/viewlib/compare_two_submissions.py b/backend/audit/viewlib/compare_two_submissions.py index 6186b7d..6fb6d2b 100644 --- a/backend/audit/viewlib/compare_two_submissions.py +++ b/backend/audit/viewlib/compare_two_submissions.py @@ -2,7 +2,6 @@ from audit.models import SingleAuditChecklist, SingleAuditReportFile from copy import deepcopy import logging import boto3 -import itertools from io import BytesIO from botocore.exceptions import ClientError from django.conf import settings
|
When a resubmission has no actual changes, it just has the
Edit: Oh actually that blurb is commented out here. There is also a There are no changes between Single Audit Reports that doesn't seem to trigger. |
| </div> | ||
| <div> | ||
|
|
||
| <p class="text-bold margin-0">Check what changed in this resubmission</p> |
There was a problem hiding this comment.
What about linkifying this instead of in the sentence below? It would better match the format of the steps that follow it.
There was a problem hiding this comment.
Oh, and linkify the old report_id below this, too
| <div class="grid-row"> | ||
| <div class="tablet:grid-col"> | ||
| <h1>Resubmission comparison</h1> | ||
| <p>To assist auditees and auditors in completing the resubmission of audits, the Clearinghouse provides an automated comparison between {{ r1 }} and {{ r2 }}.</p> |
There was a problem hiding this comment.
I'm leaning towards making it more clear which one is the current one, and which one is the resub. Something like:
| <p>To assist auditees and auditors in completing the resubmission of audits, the Clearinghouse provides an automated comparison between {{ r1 }} and {{ r2 }}.</p> | |
| <p>To assist auditees and auditors in completing the resubmission of audits, the Clearinghouse provides an automated comparison between the previous submission ({{ r1 }}) and current submission ({{ r2 }}).</p> |
and linkify the old report_id.
| </div> | ||
| <div> | ||
|
|
||
| <p class="text-bold margin-0">Check what changed in this resubmission</p> |
There was a problem hiding this comment.
Oh, and linkify the old report_id below this, too
There was a problem hiding this comment.
Just had a thought. When initiating a resub you have to click the checkboxes that explain why a resub needs to be done. Should we display that on this page so they can better confirm the comparison results? Idt there's a means for them to even go back and see what they had selected. Heck, maybe even have the checkboxes here in case they want to change it? All this can be done in a later ticket, though.
| <caption>Changes only in {{ r1 }}</caption> | ||
| <thead> | ||
| <tr> | ||
| <th scope="col">Element</th> |
There was a problem hiding this comment.
I'd go with "Field"
| <th scope="col">{{ r1 | slice:"15:" }}</th> | ||
| <th scope="col">{{ r2 | slice:"15:" }}</th> |
There was a problem hiding this comment.
I might prefer "old value" and "new value" but I'm curious what others think
| {% if changed.in_r1|length > 0 %} | ||
| <div class="grid-row"> | ||
| <div class="tablet:grid-col"> | ||
| <table class="usa-table width-full"> |
There was a problem hiding this comment.
Is it possible to include the cell from the spreadsheet that these values are pulling from? Could be useful for them but I'm not sure how readily accessible it is.
There was a problem hiding this comment.
I feel like we're gonna need something more layman-friendly when it comes to the PDF diff. Chances are they won't know what a sha256 is. Maybe instead of a table we just write out "We've detected changes between the Single Audit Reports" etc and mention the different character lengths? We could include a link to the old PDF too.
Minimum allowed line rate is |

From ticket: #5199
problem
We want to provide an initial/v1 overview of "what changed?" between two audits in a resubmission. We want to do this in two places:
solution
This PR introduces:
screen grabs
New checklist item
When a resubmission is active, there is a new element to the resubmission checklist.
Comparison page
This is a representative comparison page.
testing
To test manually: