How farahe-elmontaser/etics works
ETICS turns bank-contract PDFs/TXT into clause-level toxicity judgments, contract scores, and a SQLite dataset, using locally hosted Ollama models and legal-reference RAG. The main workflow is orchestrated by src/pipeline.py; separate capabilities create annotation samples, evaluate judgments against human annotations, and display results in Streamlit. Relationships below are grounded in the pipeline and sampled modules or explicitly documented in the README; unsampled details are represented only at their supported directory level.
Main entry points: pipeline.py Pipeline orchestration · indexation.py Legal RAG index · base.py SQLite data access · classification.py Clause classification
Components 20
Contract ingestion
- Contract files
contrats - Text extraction
src/extraction.py - Clause splitting
src/decoupage.py - Pipeline orchestration
src/pipeline.py
Legal analysis
- Settings and rubric
src/config.py - Legal reference files
references - Legal RAG index
src/indexation.py - ChromaDB
- Clause classification
src/classification.py - Ollama client
src/ollama_client.py - Local Ollama models
- Few-shot examples
annotations/exemples.csv
Data and scoring
- Contract scoring
src/score.py - SQLite data access
src/base.py - Contracts and clauses DB
Review and display
- Human annotations
annotations - Evaluation metrics
src/evaluation.py - Results dashboard
dashboard.py
Other components
- Operator
- Analyst
Connections 25
- Operator → Pipeline orchestration: runs stages
README.md - Pipeline orchestration → Text extraction: reads contracts
src/pipeline.py - Contract files → Text extraction: supplies files
README.md - Pipeline orchestration → Clause splitting: splits text
src/pipeline.py - Text extraction → Clause splitting: provides text
README.md - Pipeline orchestration → SQLite data access: stores clauses
src/pipeline.py - Pipeline orchestration → Legal RAG index: indexes references
src/pipeline.py - Legal reference files → Legal RAG index: supplies legal text
README.md - Legal RAG index → Ollama client: requests embeddings
src/indexation.py - Ollama client → Local Ollama models: calls model API
src/ollama_client.py - Legal RAG index → ChromaDB: stores and searches
src/indexation.py - Pipeline orchestration → Clause classification: classifies clauses
src/pipeline.py - Clause classification → Legal RAG index: retrieves references
src/classification.py - Clause classification → Ollama client: requests judgment
src/classification.py - Few-shot examples → Clause classification: provides examples
src/classification.py - Pipeline orchestration → Contract scoring: calculates scores
src/pipeline.py - Pipeline orchestration → SQLite data access: reads and updates records
src/pipeline.py - SQLite data access → Contracts and clauses DB: reads and writes
src/base.py - Operator → Pipeline orchestration: creates sample
README.md - Pipeline orchestration → Human annotations: writes sample
src/pipeline.py - Operator → Evaluation metrics: runs evaluation
README.md - Human annotations → Evaluation metrics: provides labels
src/evaluation.py - Evaluation metrics → SQLite data access: loads predictions
src/evaluation.py - Analyst → Results dashboard: views results
README.md - Results dashboard → SQLite data access: reads tables
dashboard.py