Spaces:
Running on CPU Upgrade
GitHub Copilot Instructions for Open Navigator
π¨ CRITICAL: Documentation Standards
β οΈ ALWAYS Use Docusaurus Format - NO EXCEPTIONS
MANDATORY RULE: When creating ANY documentation, guides, or markdown files:
β DO THIS:
- Create ALL documentation in
website/docs/subdirectories - Add YAML frontmatter to every documentation file
- Use kebab-case filenames
- Place in appropriate subdirectory
β NEVER DO THIS:
- β Create
.mdfiles in project root (except README.md, LICENSE, CONTRIBUTING.md) - β Create files like
VARIABLE_MIGRATION.md,DOCKER_BUILD_TROUBLESHOOTING.mdin root - β Create
UPPERCASE_FILE.mdfiles anywhere - β Skip frontmatter in documentation files
Documentation File Location Rules
When creating or editing documentation:
Location: ALWAYS place documentation in
website/docs/with appropriate subdirectories- Deployment guides β
website/docs/deployment/ - How-to guides β
website/docs/guides/ - Data sources β
website/docs/data-sources/ - Case studies β
website/docs/case-studies/ - Integration docs β
website/docs/integrations/ - Development guides β
website/docs/development/
- Deployment guides β
Frontmatter: ALWAYS include YAML frontmatter at the top: ```markdown
sidebar_position: 1
Document Title
File naming: ALWAYS use kebab-case (lowercase with hyphens)
- β
huggingface-spaces.md - β
variable-migration.md - β
docker-troubleshooting.md - β
HUGGINGFACE_DEPLOYMENT.md - β
HuggingFaceSpaces.md - β
VARIABLE_MIGRATION.md
- β
Root directory: Keep root directory clean
- β Only keep these in root: README.md, LICENSE, CONTRIBUTING.md
- β
Move ALL other docs to
website/docs/ - β Don't create new
.mdfiles in project root
Examples
When asked to create troubleshooting documentation:
# β WRONG
/home/developer/projects/open-navigator/DOCKER_BUILD_TROUBLESHOOTING.md
# β
CORRECT
/home/developer/projects/open-navigator/website/docs/deployment/docker-troubleshooting.md
When asked to create a migration guide:
# β WRONG
/home/developer/projects/open-navigator/VARIABLE_MIGRATION.md
# β
CORRECT
/home/developer/projects/open-navigator/website/docs/deployment/variable-migration.md
When asked to document a new feature:
# β WRONG
/home/developer/projects/open-navigator/NEW_FEATURE.md
# β
CORRECT
/home/developer/projects/open-navigator/website/docs/guides/new-feature.md
Sidebar Organization
The documentation uses audience-based navigation in website/sidebars.ts:
- π Getting Started: Landing pages (intro, dashboard)
- π For Policy Makers & Advocates: Non-technical content
- π οΈ For Developers & Technical Users: Technical content including:
- Setup & Installation
- Data Sources (Technical)
- How-To Guides
- Integrations
- Deployment (uses
autogeneratedfordeployment/directory) - Development
When creating docs in a directory with autogenerated, they'll automatically appear in sidebar.
Scripts Organization
β οΈ ALWAYS Organize Scripts into Logical Folders
MANDATORY RULE: When creating ANY scripts in the scripts/ directory:
β DO THIS:
- Organize scripts into logical subdirectories by function
- Use clear, descriptive folder names
- Keep the root
scripts/directory clean - Add README.md to each subdirectory explaining its purpose
β NEVER DO THIS:
- β Create scripts directly in
scripts/root (except core workflow scripts) - β Mix unrelated scripts together
- β Recreate scripts that already exist - search first!
Scripts Directory Structure
scripts/
βββ data/ # Data processing and migration
β βββ aggregate_bills_from_postgres.py
β βββ create_all_gold_tables.py
β βββ migrate_to_events_naming.py
β βββ README.md
βββ deployment/ # Deployment and setup
β βββ deploy-databricks-app.sh
β βββ setup-local.sh
β βββ setup_openstates_db.sh
β βββ README.md
βββ enrichment/ # Data enrichment (990s, nonprofits)
β βββ enrich_nonprofits_async.py
β βββ batch_download_990s.py
β βββ extract_990_zips.sh
β βββ README.md
βββ huggingface/ # HuggingFace dataset management
β βββ upload_to_huggingface.py
β βββ reorganize_for_huggingface.py
β βββ finalize_huggingface_structure.py
β βββ README.md
βββ maintenance/ # Cleanup and maintenance
β βββ cleanup_disk_space.sh
β βββ cleanup_frontend_junk.sh
β βββ README.md
βββ README.md # Overview of all script categories
Before Creating a New Script
- Search first: Use
greporfile_searchto find existing scripts - Check for duplicates: Scripts like
aggregate_bills_from_postgres.pyalready exist - Use existing: Prefer modifying existing scripts over creating new ones
- Organize: If creating new, place in appropriate subdirectory
Code Style Preferences
Python
- Use type hints for function parameters and return values
- Follow PEP 8 naming conventions
- Add docstrings to all public functions and classes
- Prefer pathlib over os.path for file operations
TypeScript/React
- Use functional components with hooks
- Prefer named exports over default exports
- Use TypeScript interfaces for props
- Follow the existing Tailwind CSS patterns
Documentation
- Use emoji headers sparingly and consistently (π, π, π οΈ, etc.)
- Include code examples with syntax highlighting
- Add "Prerequisites" section for setup guides
- Include "Next Steps" at the end of tutorials
Project Context
This is Open Navigator - a civic engagement platform that:
- Tracks 90,000+ jurisdictions (cities, counties, states)
- Monitors 1.8M nonprofit organizations
- Analyzes meeting minutes and public records
- Provides oral health policy tracking
Three Services Architecture
Always mention all three services when documenting deployment:
- Documentation (Docusaurus) - Port 3000
- Main Application (React + Vite) - Port 5173 (MAIN APP)
- API Backend (FastAPI) - Port 8000
Common Patterns
When suggesting deployment or setup:
- Use
start-all.shto launch all services - Reference environment variables from
.env.example - Mention that secrets go in
.env(gitignored) - Include verification steps to test deployment
Data Management Rules
CRITICAL - DO NOT DELETE APPLICATION CACHE:
- β NEVER recommend deleting
/home/developer/projects/open-navigator/data/cache/ - β NEVER suggest
rm -rf data/cacheor similar commands - This directory contains critical application data from data processing pipelines
- Deleting it will cause data loss and require expensive reprocessing
- If disk space cleanup is needed, suggest cleaning:
- Docker images/volumes:
docker system prune - System caches:
~/.cache/pip,~/.cache/npm,~/.cache/huggingface - Build artifacts:
frontend/dist,website/build - NOT the application data cache
- Docker images/volumes:
File Organization Rules
What Goes Where
Root directory (minimal):
- README.md (developer quick start)
- LICENSE, CONTRIBUTING.md
- Configuration files (Dockerfile, docker-compose.yml, requirements.txt, etc.)
- Shell scripts (start-all.sh, deploy-huggingface.sh, etc.)
Documentation (website/docs/):
- All markdown documentation
- Organized by topic and audience
- Automatically included in Docusaurus sidebar
Code (src/, api/, agents/, etc.):
- Python modules and packages
- Organized by functionality
When Creating New Features
- Code first: Implement the feature
- Tests: Add tests if applicable
- Documentation: Create docs in
website/docs/with proper frontmatter - README: Update root README.md only if it affects quick start
- Examples: Add usage examples to documentation
Deployment Targets
When suggesting deployment options, consider:
- Hugging Face Spaces: Full Docker deployment (all 3 apps)
- Databricks Apps: React + FastAPI for enterprise
- Local Development: Using start-all.sh with tmux
Always provide complete deployment instructions in website/docs/deployment/.