generated from nhcarrigan/template
docs: add data file documentation and fix data path resolution
All Python cohort scripts now use DATA_DIR = Path(__file__).parent.parent.parent / "data" to correctly resolve the repo-root data/ directory regardless of the working directory set by run.sh. All TypeScript scripts have expanded JSDoc headers documenting data file requirements and environment variables.
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
"""Generate hourly timeslot JSON for use with Crabfit scheduling tool.
|
||||
|
||||
Produces a list of ISO-format datetime strings covering every hour across the
|
||||
scheduling window. Update the start_date and end_date constants before running.
|
||||
|
||||
Outputs (written to data/):
|
||||
- crabfit_timeslots.json List of hourly timeslot strings
|
||||
|
||||
Env vars:
|
||||
- None
|
||||
"""
|
||||
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
|
||||
DATA_DIR = Path(__file__).parent.parent.parent / "data"
|
||||
|
||||
# Generate hourly time slots from Feb 1 to March 3, 2026
|
||||
# 24 hours a day, America/Los_Angeles timezone
|
||||
@@ -18,7 +33,7 @@ print(f"First: {times[0]}")
|
||||
print(f"Last: {times[-1]}")
|
||||
|
||||
# Save to file for use
|
||||
with open("/home/naomi/docs/cohort/crabfit_timeslots.json", "w") as f:
|
||||
with open(DATA_DIR / "crabfit_timeslots.json", "w") as f:
|
||||
json.dump(times, f)
|
||||
|
||||
print("Saved to crabfit_timeslots.json")
|
||||
|
||||
Reference in New Issue
Block a user