harvard-lil / capstone

CAP database scripts.
MIT License
188 stars 44 forks source link

Add unique case paths to static export #2185

Closed jcushman closed 10 months ago

jcushman commented 11 months ago

This PR tries to handle the tricky issue of how to find one case in the static file export from another.

Problem: If you have a case like /us/123/cases/0012-01.json that cites to case id 4567, or a list of case IDs in /us/123/CaseMetadatas.json, it's hard to find the files that contain the data for those cases.

Solution: Everywhere that we have cases referred to by ID, also refer to them by path. A path for a case is like "/us/123/0012-01", or just "0012-01" if the reporter and volume are already implicit.

So:

Deployment notes:

Case paths are hard to calculate, because you have to add an increment for two cases starting on the same page of the same book, like 0123-01 and 0123-02. So this PR adds a column in a migration to store that calculated string on CaseMetadata, and after deployment we should run fab set_case_static_file_names (which runs in a tqdm loop rather than in celery) before redoing fab export_cap_static_volumes for the non-redacted jurisdictions.

codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (aaa250b) 63.54% compared to head (0da1916) 63.60%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #2185 +/- ## =========================================== + Coverage 63.54% 63.60% +0.06% =========================================== Files 107 107 Lines 11756 11791 +35 =========================================== + Hits 7470 7500 +30 - Misses 4286 4291 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.