How rushika707/policy-as-code-for-ai-governance works
This is a policy-as-code application for extracting privacy rules from uploaded policies, evaluating dataset records against those rules, and presenting run results. The principal workflow is API-orchestrated: extract PDF text, use an LLM to produce and validate rules, generate Rego, evaluate records, then persist results and artifacts for the frontend. It also supports synthetic dataset generation and downloadable run artifacts. Connections reflect the excerpts and SOURCE INDEX; details of unsampled evaluation and persistence calls are limited to those references.
Main entry points: api.py FastAPI service · extractor.py Rule extraction · App.jsx Run dashboard · validator.py Rule validation
Components 17
User Interface
- Run dashboard
frontend/src/App.jsx
API Orchestration
- FastAPI service
backend/api.py
Policy Processing
- PDF text extraction
backend/ingestion/pdf_extractor.py - Rule extraction
backend/extraction/extractor.py - Extraction prompts
backend/extraction/prompt.py - Rule validation
backend/extraction/validator.py - Rule schema
config/rule_schema.py - Dataset schema
config/dataset_schema.py - Rego generation
backend/policy_engine/rego_generator.py
Evaluation and Data
- Policy evaluation
backend/policy_engine/eval.py - Synthetic data generation
synthetic_data/synthetic_data_generator.py - Run and record storage
database/database.py - Run artifact storage
backend/storage.py - Supabase client
backend/supabase_client.py
Other components
- Policy analyst
- PostgreSQL
- Supabase Storage
Connections 17
- Policy analyst → Run dashboard: uses
- Run dashboard → FastAPI service: requests runs
frontend/src/App.jsx - FastAPI service → PDF text extraction: extracts text
backend/api.py - FastAPI service → Rule extraction: extracts rules
backend/api.py - Rule extraction → Extraction prompts: builds prompts
backend/extraction/extractor.py - Rule extraction → Rule validation: validates rules
backend/extraction/extractor.py - Rule extraction → Rule schema: uses schema
backend/extraction/extractor.py - Rule extraction → Dataset schema: uses columns
backend/extraction/extractor.py - Rule validation → Dataset schema: checks columns
backend/extraction/validator.py - FastAPI service → Rego generation: generates policy
backend/api.py - FastAPI service → Policy evaluation: evaluates records
backend/api.py - FastAPI service → Synthetic data generation: generates dataset
backend/api.py - FastAPI service → Run and record storage: stores run data
backend/api.py - FastAPI service → Run artifact storage: uploads artifacts
backend/api.py - Run artifact storage → Supabase client: uses client
backend/storage.py - Supabase client → Supabase Storage: connects to
backend/supabase_client.py - Run and record storage → PostgreSQL: reads and writes
database/database.py