chilean-worker-defense-rag
v1.4.1
Published
Chilean Worker Defense RAG System - AI-powered legal defense for Chilean workers. RAG-based system for legal precedent search, abuse detection, and document generation.
Maintainers
Readme
Chilean Worker Defense RAG System (CWDRS)
Version: 1.0.0 Status: Prototype Phase Sprint: 1.1 - Evidence Collection Module
Overview
The Chilean Worker Defense RAG System is an AI-powered legal defense platform designed to protect Chilean workers' rights through intelligent document analysis, legal precedent retrieval, and automated case strategy generation.
Mission
Provide comprehensive legal defense for Chilean workers by:
- Analyzing employment contracts, finiquitos, and communications
- Retrieving relevant legal precedents from successful worker cases
- Detecting patterns of employer abuse
- Generating legal documents in Spanish
- Automating workflow from case intake to court filing
Features
Evidence Collection Module (Current)
- RESTful API for case intake
- Document upload and validation
- Chain of custody tracking
- Evidence completeness assessment
Planned Features
- RAG-powered precedent search
- Six-personality collaborative analysis
- Abuse pattern detection
- Automated legal document generation
- Deadline tracking and alerts
- Integration with Chilean Law RAG System
Technology Stack
- Framework: NestJS (TypeScript)
- Database: MongoDB Atlas (6 personality databases)
- Vector DB: Pinecone (for RAG)
- AI: OpenAI GPT-4 + text-embedding-3-large
- Testing: Jest + MongoDB Memory Server
- API Docs: Swagger/OpenAPI
Installation
Prerequisites
- Node.js 18+
- npm or yarn
- MongoDB Atlas account
- OpenAI API key
Setup
# Clone repository
git clone <repository-url>
cd chilean-worker-defense-rag
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your credentials
# Run development server
npm run start:dev
# API will be available at http://localhost:3000
# Swagger docs at http://localhost:3000/apiProject Structure
chilean-worker-defense-rag/
├── src/
│ ├── evidence/ # Evidence collection module
│ │ ├── dto/ # Data transfer objects
│ │ ├── evidence.controller.ts
│ │ ├── evidence.service.ts
│ │ └── evidence.module.ts
│ ├── schemas/ # MongoDB schemas
│ │ ├── worker-case-precedent.schema.ts
│ │ ├── evidence-pattern.schema.ts
│ │ ├── abuse-detection-rule.schema.ts
│ │ ├── legal-document-template.schema.ts
│ │ └── case-timeline.schema.ts
│ ├── common/ # Shared utilities
│ │ ├── dto/ # Common DTOs
│ │ ├── guards/ # Auth guards
│ │ └── interceptors/ # Interceptors
│ ├── config/ # Configuration
│ ├── main.ts # Application entry point
│ └── app.module.ts # Root module
├── test/ # E2E tests
├── ARCHITECTURE.md # Technical architecture
├── package.json
├── tsconfig.json
└── README.mdAPI Endpoints
Evidence Collection
POST /evidence/intake
Initial case intake and evidence submission
Request:
{
"worker": {
"name": "Juan Pérez",
"email": "[email protected]",
"phone": "+56912345678"
},
"employment": {
"employer": "Empresa XYZ",
"position": "Desarrollador",
"startDate": "2020-01-01",
"contractType": "indefinido"
},
"incident": {
"type": "wrongful_termination",
"description": "Despedido sin causa justificada",
"date": "2025-11-01"
}
}Response:
{
"caseId": "CASE-2025-000001",
"status": "received",
"nextSteps": [
"Subir contrato de trabajo",
"Subir finiquito (si existe)",
"Subir comunicaciones con empleador"
],
"timeline": {
"analysisCompletion": "2025-11-12T10:00:00Z",
"expectedResponse": "2025-11-13T10:00:00Z"
}
}GET /evidence/:caseId
Retrieve all evidence for a case
POST /evidence/:caseId/validate
Validate evidence chain of custody
MongoDB Collections
Six Personality Databases
neko-defense-system (Neko-Arc)
- Technical execution and monitoring
marionnette-theater (Mario)
- Workflow orchestration
- case-timelines
noel-precision-archives (Noel)
- Testing and validation
glam-street-chronicles (Glam)
- worker-case-precedents ⭐
- legal-document-templates ⭐
hannibal-forensic-archives (Hannibal)
- evidence-patterns ⭐
- abuse-detection-rules ⭐
tetora-mpd-archives (Tetora)
- Multi-perspective analysis
Testing
# Run unit tests
npm test
# Run tests with coverage
npm run test:cov
# Run E2E tests
npm run test:e2e
# Run tests in watch mode
npm run test:watchCoverage Targets
- Line coverage: >80%
- Branch coverage: >75%
- Function coverage: >80%
Development
Running in Development Mode
npm run start:devBuilding for Production
npm run build
npm run start:prodLinting
npm run lintArchitecture
See ARCHITECTURE.md for detailed technical architecture including:
- System architecture diagrams
- MongoDB schema definitions
- REST API specifications
- RAG implementation details
- Security and validation layers
Six Personalities
This system is collaboratively designed and maintained by six AI personalities:
- 🐾 Neko-Arc: Technical architecture
- 🎭 Mario Gallo Bestino: Workflow orchestration
- 🗡️ Noel: Testing and validation
- 🎸 Glam Americano: Spanish content and worker advocacy
- 🧠 Dr. Hannibal Lecter: Forensic analysis
- 🧠 Tetora: Multi-perspective analysis
Legal Disclaimer
This system provides legal information and assistance tools. It does not constitute legal advice. Workers should consult with licensed lawyers for specific legal matters.
License
UNLICENSED - Private Repository
Contact
For issues or questions, please file an issue on GitHub.
🐾 Built with MAXIMUM KAWAII POWER for Chilean Workers! Nyaa~!
All workers deserve justice. All employers fear precision.
