Skip to content

Add --dates mode to extract operational date ranges#5

Open
xinwei89 wants to merge 1 commit into
mainfrom
parse-dates
Open

Add --dates mode to extract operational date ranges#5
xinwei89 wants to merge 1 commit into
mainfrom
parse-dates

Conversation

@xinwei89

Copy link
Copy Markdown

Summary

Adds a --dates mode to csv_tidy.py that parses the "Dates of use" column and emits a tidy CSV with Site ID, Start Date, End Date — one row per operational period.

Usage

python csv_tidy.py --dates --input data/carceral_tidy.csv --output data/carceral_dates.csv

Parsing rules

  • Multiple periods: comma-separated periods each become their own row (e.g. 1826-1984, 2001-2002 -> two rows).
  • Single year: start and end are the same (1847 -> 1847/1847).
  • present/today: end becomes the current year.
  • Decades: a decade is its first year at the start of a period but its last year at the end (1849-1870s -> 1849/1879; lone 1970s -> 1970/1979).
  • Month/day detail preserved: October 1838 - November 1838 is kept verbatim.
  • circa: leading c. / circa is ignored.
  • Dash variants: hyphen, en dash, em dash all supported.
  • Empty/junk cells -> ("", "").

Notes

  • New parse_dates() and _format_endpoint() helpers.
  • Mode dispatch priority: --shape > --dates > trim.

…csv path> --output <carceral_dates.csv path>`
@wiz-8f2719713e

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 1 Low
Software Management Finding Software Management Findings -
Total 1 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants