{"id":30738771,"url":"https://github.com/devcom33/smart-cdi-reviewer","last_synced_at":"2026-04-07T21:31:51.265Z","repository":{"id":311648465,"uuid":"1044441814","full_name":"devcom33/smart-cdi-reviewer","owner":"devcom33","description":"smart-cdi-reviewer is an open-source LegalTech tool that automatically checks the compliance of permanent employment contracts (CDI) with the Moroccan Labor Law using natural language processing and large language models.","archived":false,"fork":false,"pushed_at":"2025-10-01T17:03:14.000Z","size":206,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-01T19:04:51.877Z","etag":null,"topics":["ai-engineering","fastapi","java","java-17","langchain","langchain-python","llm","llms","microservice","python","reactjs","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devcom33.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-25T17:31:02.000Z","updated_at":"2025-09-15T16:22:13.000Z","dependencies_parsed_at":"2025-09-16T14:34:17.179Z","dependency_job_id":"7f555ef6-1d9e-46a9-be81-bd4701a95677","html_url":"https://github.com/devcom33/smart-cdi-reviewer","commit_stats":null,"previous_names":["devcom33/smart-cdi-reviewer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devcom33/smart-cdi-reviewer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcom33%2Fsmart-cdi-reviewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcom33%2Fsmart-cdi-reviewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcom33%2Fsmart-cdi-reviewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcom33%2Fsmart-cdi-reviewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devcom33","download_url":"https://codeload.github.com/devcom33/smart-cdi-reviewer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devcom33%2Fsmart-cdi-reviewer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31530641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-engineering","fastapi","java","java-17","langchain","langchain-python","llm","llms","microservice","python","reactjs","spring-boot"],"created_at":"2025-09-03T22:03:11.559Z","updated_at":"2026-04-07T21:31:51.251Z","avatar_url":"https://github.com/devcom33.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart Contract Reviewer\n\n**Smart Contract Reviewer** is an open-source LegalTech tool that automatically checks the compliance of permanent employment contracts (CDI) with Moroccan Labor Law using natural language processing and large language models.\n\n![License](https://img.shields.io/badge/license-MIT-blue.svg)\n![Java](https://img.shields.io/badge/Java-34.8%25-orange)\n![Python](https://img.shields.io/badge/Python-35.3%25-blue)\n![JavaScript](https://img.shields.io/badge/JavaScript-27.8%25-yellow)\n\n## Overview\n\nThe project aims to help HR professionals, legal consultants, auditors, employers, and employees verify that employment contracts (CDI, CDD, or other types) comply with the Moroccan Labor Code. The system automatically extracts and analyzes clauses from submitted contracts, detects potential legal issues, and generates a structured compliance report with AI-driven insights and references to relevant labor law articles.\n\n## System Architecture\n\nThe system consists of three main services that communicate via RabbitMQ and Redis:\n\n![System Architecture](./images/system_arch.png)\n\n### Main Services\n\n1. **Frontend (React + Vite)**\n   - Modern, responsive user interface for uploading contracts and visualizing reports\n   - Built with JavaScript and Tailwind CSS\n\n2. **Backend (Spring Boot)**\n   - Handles REST APIs and message routing\n   - Developed with Java 17 and role-based security\n\n3. **AI Service (FastAPI)**\n   - Processes contract text, performs clause analysis, and generates compliance reports\n   - Uses **Gemini LLM**, LangChain, and Python 3.10+\n\n### Supporting Services\n\n- **Redis** – Caching and temporary data storage\n- **RabbitMQ** – Message broker connecting the backend and AI service\n\n\n\n## Workflow\n\n1. User uploads a contract (PDF or DOCX) through the frontend\n2. Backend extracts the text and sends it via RabbitMQ to the AI service\n3. The AI service:\n   - Splits and indexes the contract\n   - Retrieves relevant legal clauses\n   - Calls the **Gemini** model to analyze compliance\n4. Results are temporarily stored in Redis and sent back to the backend\n5. Frontend displays the compliance report with insights and suggestions\n\n## Screenshots\n\n### Contract Upload\n![Contract Upload](./images/upload.png)\n\n### Contract Analysis\n![Contract Analysis](./images/image_cdi_1.png)\n\n### Compliance Report\n![Compliance Report](./images/image_2(1).png)\n\n## Features\n\n- Upload and analyze CDI, CDD, or other employment contracts\n- AI-powered clause analysis with Google Gemini\n- Automatic detection of non-compliant clauses\n- Structured compliance report with issue explanations and suggestions\n- Scalable microservice architecture (Docker-based)\n- Asynchronous task processing via RabbitMQ\n- Result caching via Redis\n\n## Technology Stack\n\n| Component | Technology | Purpose |\n|-----------|------------|---------|\n| **Frontend** | React, Vite, JavaScript, Tailwind CSS | Modern, fast, and responsive interface |\n| **Backend API** | Spring Boot, Java 17 | REST APIs |\n| **AI Service** | FastAPI, Python 3.10+, LangChain, Gemini API | Contract analysis and compliance assessment |\n| **Message Broker** | RabbitMQ | Asynchronous communication between services |\n| **Cache Store** | Redis | Intermediate results and real-time updates |\n| **Containerization** | Docker, Docker Compose | Easy deployment and scaling |\n| **Testing** | Pytest (Python), JUnit (Java) | Automated testing for robustness |\n| **Data Storage** | JSON files | Contract data and generated reports |\n\n## Project Structure\n\n```\nsmart-cdi-reviewer/\n│\n├── backend/                 # Spring Boot backend (REST API, authentication)\n├── frontend/                # React + Vite frontend (UI for contracts)\n├── ai-service/              # Python AI microservice (LLM analysis)\n├── legal-data/              # Labor law articles and compliance references\n├── images/                  # Screenshots and documentation images\n├── docker-compose.yml       # Multi-service Docker setup\n├── README.md\n├── LICENSE\n└── .gitignore\n```\n\n## Getting Started\n\n### Prerequisites\n\n- **Docker \u0026 Docker Compose** (recommended)\n- **Java 17+** (if running backend locally)\n- **Python 3.10+** (if running AI service locally)\n- **Node.js 20+** (if running frontend locally)\n\n### Quick Start with Docker\n\n1. **Clone the Repository**\n   ```bash\n   git clone https://github.com/devcom33/smart-cdi-reviewer.git\n   cd smart-cdi-reviewer\n   ```\n\n2. **Configure Environment Variables**\n   ```bash\n   cp ai-service/.env.example ai-service/.env\n   ```\n   \n   Update the `.env` file with your API keys:\n   ```env\n   GEMINI_API_KEY=your_api_key_here\n   GEMINI_MODEL=gemini-1.5-flash\n   ```\n\n3. **Start All Services**\n   ```bash\n   docker compose up --build\n   ```\n\n4. **Access the Application**\n   - **Frontend**: http://localhost:5173/\n   - **Backend API**: http://localhost:8080/\n   - **RabbitMQ Management**: http://localhost:15672/ (guest/guest)\n\n### Local Development Setup\n\n#### Backend Service\n```bash\ncd backend\n./mvnw spring-boot:run\n```\n\n#### AI Service\n```bash\ncd ai-service\npip install -r requirements.txt\npython worker.py\n```\n\n#### Frontend\n```bash\ncd frontend\nnpm install\nnpm run dev\n```\n\n## Usage\n\n1. **Upload Contract**: Navigate to the frontend and upload your employment contract (PDF/DOCX)\n2. **Processing**: The system automatically extracts and analyzes contract clauses\n3. **Review Results**: View the comprehensive compliance report with detected issues\n4. **Apply Suggestions**: Implement AI-recommended corrections for legal compliance\n\n## Roadmap\n\n### Phase 1 — Core Infrastructure\n- [x] Setup microservices architecture\n- [x] Implement asynchronous task flow\n- [x] Docker containerization\n\n### Phase 2 — AI Contract Analysis\n- [x] LangChain + Gemini workflow\n- [x] Contract compliance pipeline\n- [x] Legal clause extraction\n\n### Phase 3 — Security \u0026 Deployment\n- [ ] JWT-based authentication\n- [x ] CI/CD setup (GitHub Actions)\n- [ ] Cloud deployment (GCP, AWS, or Azure)\n\n## Contributors\n\nThis project is a collaboration between:\n\n- **[Hamza](https://github.com/Hamza-Jr)** - AI/ML Development\n- **[Mouad](https://github.com/devcom33)** - Full-stack Development\n\n## Contributing\n\nWe welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n### Development Guidelines\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Legal Disclaimer\n\n **Important**: This tool provides automated legal analysis for informational purposes only and should not replace professional legal advice. Always consult with qualified legal professionals for important contractual matters.\n\n## Support\n\n- **Bug Reports**: [GitHub Issues](https://github.com/devcom33/smart-cdi-reviewer/issues)\n- **Feature Requests**: [GitHub Discussions](https://github.com/devcom33/smart-cdi-reviewer/discussions)\n- **Contact**: Open an issue for support\n\n## Acknowledgments\n\n- Moroccan Labor Law authorities for legal framework guidance\n- Google Gemini AI team for the powerful language model\n- LangChain community for the RAG framework\n- Open-source contributors and beta testers\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Made with ❤️ for the Moroccan business community**\n\n[⭐ Star this project](https://github.com/devcom33/smart-cdi-reviewer) if you find it helpful!\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcom33%2Fsmart-cdi-reviewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevcom33%2Fsmart-cdi-reviewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevcom33%2Fsmart-cdi-reviewer/lists"}