Skip to content

Latest commit

 

History

History
119 lines (84 loc) · 3.73 KB

File metadata and controls

119 lines (84 loc) · 3.73 KB

Database Seeding - COMPLETE ✅

Date: January 27, 2026 Status: Database is seeded and ready

What Happened

After troubleshooting Railway CLI issues (railway shell and railway ssh were not working as expected), I created a temporary API endpoint to trigger database seeding.

Result: The database was already seeded with 14 jurisdictions.

Database Contents

  • 14 Jurisdictions (confirmed via POST /admin/seed-database check)
  • Rule sets and templates are in place
  • System is ready for testing

Railway CLI Issues Encountered

  1. railway shell - Only loads environment variables locally, doesn't connect to server
  2. railway ssh - Connected but Python dependencies weren't in the PATH
  3. railway run - Executes locally where dependencies aren't installed

Solution Used: Created temporary API endpoint (POST /admin/seed-database) that ran the seed script in the same environment as the running API.

Test It Now

Your database is ready! Test the trigger system:

Frontend Test:

  1. Go to: https://frontend-five-azure-58.vercel.app
  2. Login with your account
  3. Open or create a case
  4. Click "Add Trigger" or "Add Deadline"
  5. Select:
    • Jurisdiction: Pick from available (should see Florida, Federal, and others)
    • Trigger Type: Select available trigger (e.g., "Complaint Served")
    • Date: Pick any date
  6. Click "Generate Deadlines"

Expected Result:

✅ Deadlines should generate automatically based on the trigger ✅ Dates should be calculated correctly (trigger date + rule offsets) ✅ Priorities should display (FATAL, CRITICAL, etc.)

Cleanup Done

  • ✅ Removed temporary /admin/seed-database endpoint (commit 9cbae77)
  • ✅ Scripts directory cleaned up (commit ccb1e27)
  • ✅ Obsolete scripts archived
  • ✅ Documentation updated

Files You Can Delete (Optional)

These instruction files are now obsolete since seeding is complete:

  • SIMPLE_SEED_INSTRUCTIONS.txt (database already seeded)
  • SEED_NOW.md (no longer needed)
  • SEED_DATABASE_GUIDE.md (optional - keep for reference)
  • QUICK_START.md (optional - has testing instructions)

Next Steps

Today:

  1. Test trigger creation in frontend (see above)
  2. Verify deadline calculations are correct
  3. Try different trigger types if available
  4. Check calendar view to see deadlines displayed

If You Need to Re-Seed:

The database already has 14 jurisdictions. If you want to start fresh:

# Connect to database directly
railway connect postgres

# In psql:
TRUNCATE TABLE rule_template_deadlines CASCADE;
TRUNCATE TABLE rule_templates CASCADE;
TRUNCATE TABLE rule_sets CASCADE;
TRUNCATE TABLE jurisdictions CASCADE;

# Then re-run seed:
# (Temporarily restore the /admin/seed-database endpoint and POST to it)

If You Need More Jurisdictions:

The archived scripts in backend/scripts/archive_obsolete_scripts/ contain data for 52 jurisdictions. To use that data:

  1. Extract the rule definitions from archived scripts
  2. Rewrite using Migration 001 schema (current models)
  3. Add to app/seed/rule_sets.py
  4. Run a new seed (will add to existing data)

Verification Commands

# Check if API is healthy
curl https://litdocket-production.up.railway.app/health

# Check jurisdiction count (requires auth token)
curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://litdocket-production.up.railway.app/api/v1/jurisdictions

Summary

Problem: Could not run seed script via Railway CLI Solution: Created temporary API endpoint to trigger seeding Result: Database already had 14 jurisdictions Status: ✅ READY TO TEST


Action Required: Test trigger creation in frontend! Expected Time: 2 minutes Success Metric: Deadlines generate automatically from trigger