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

2023-11-29 | MAIN --> PROD | DEV (6bb2530) --> STAGING #2892

Merged
merged 5 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 16 additions & 15 deletions backend/audit/test_workbooks_should_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ def map_file_to_extractor_validator(filename):
return (None, None)


def process_workbook_set(workbook_set_path):
"""Process each workbook set in the given path."""
for wb_path, _, wb_files in os.walk(workbook_set_path):
for file in wb_files:
if re.search("xlsx$", str(file)):
full_path = os.path.join(wb_path, file)
(extractor, validator) = map_file_to_extractor_validator(full_path)
if extractor:
print(f"Extracting and validating {file}")
ir = extractor(full_path)
validator(ir)
else:
print(f"No extractor found for [{file}]")


class PassingWorkbooks(SimpleTestCase):
def test_passing_workbooks(self):
workbook_sets = reduce(
Expand All @@ -64,21 +79,7 @@ def test_passing_workbooks(self):
for dirpath, dirnames, _ in os.walk(workbook_sets):
for workbook_set in dirnames:
print("Walking ", workbook_set)
for wb_path, _, wb_files in os.walk(
os.path.join(dirpath, workbook_set)
):
for file in wb_files:
if re.search("xlsx$", str(file)):
full_path = os.path.join(wb_path, file)
(extractor, validator) = map_file_to_extractor_validator(
full_path
)
if extractor:
print(f"Extracting and validating {file}")
ir = extractor(full_path)
validator(ir)
else:
print(f"No extractor found for [{file}]")
process_workbook_set(os.path.join(dirpath, workbook_set))

# Can't run this when subclased from SimpleTestCase.
# Can't write to the database `default`.
Expand Down
7 changes: 3 additions & 4 deletions backend/census_historical_migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,18 @@ docker compose run --rm web python manage.py csv_to_postgres --folder data --chu

### How to run the historic data migrator:
```
docker compose run --rm web python manage.py historic_data_migrator --email [email protected] \
docker compose run --rm web python manage.py historic_data_migrator
--years 22 \
--dbkeys 100010
--dbkeys 177310
```
- The email address currently must be a User in the system. As this has only been run locally so far, it would often be a test account in my local sandbox env.
- `year` and `dbkey` are optional. The script will use default values for these if they aren't provided.

### How to run the historic workbook generator:
```
docker compose run --rm web python manage.py historic_workbook_generator \
--year 22 \
--output <your_output_directory> \
--dbkey 100010
--dbkey 177310
```
- `year` is optional and defaults to `22`.
- The `output` directory will be created if it doesn't already exist.
Expand Down
28 changes: 27 additions & 1 deletion backend/census_historical_migration/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
from django.contrib import admin # noqa: F401

# Register your models here.
from census_historical_migration.models import (
ELECAUDITHEADER,
ELECEINS,
ELECAUDITFINDINGS,
ELECNOTES,
ELECFINDINGSTEXT,
ELECCPAS,
ELECAUDITS,
ELECPASSTHROUGH,
ELECUEIS,
ELECCAPTEXT,
ReportMigrationStatus,
MigrationErrorDetail,
)

admin.site.register(ELECAUDITHEADER)
admin.site.register(ELECEINS)
admin.site.register(ELECAUDITFINDINGS)
admin.site.register(ELECNOTES)
admin.site.register(ELECFINDINGSTEXT)
admin.site.register(ELECCPAS)
admin.site.register(ELECAUDITS)
admin.site.register(ELECPASSTHROUGH)
admin.site.register(ELECUEIS)
admin.site.register(ELECCAPTEXT)
admin.site.register(ReportMigrationStatus)
admin.site.register(MigrationErrorDetail)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading