ποΈ Civil Engineering Specialized System - Automated Compliance Analysis with Brazilian Standards using AI and RAG
Norman was specifically developed to solve the MAJOR BOTTLENECK for civil engineers: the excessive time spent manually verifying compliance with Brazilian technical standards.
Civil engineers spend up to 30% of their time reviewing documents searching for specific standard sections (NBRs). Human errors in this phase can cause structural failures, heavy fines from regulatory bodies, or construction project delays.
Civil engineering focused compliance analysis engine that uses RAG (Retrieval-Augmented Generation) to instantly validate structural projects (memorials, calculations, specifications) against Brazilian Regulatory Standards (NBRs), providing exact references to standard items.
Engineers spend up to 30% of their time reviewing documents to ensure safety and technical standards are followed. Human errors in this phase can cause structural failures, heavy fines, or construction schedule delays.
Robust backend in Spring Boot 3 that processes Brazilian technical standards, stores them in Vector Database (Vector DB) and uses Google Gemini Pro to automatically audit civil engineering projects, providing exact norm references and saving valuable professional time.
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Document β β Vector Store β β AI Services β
β Processing βββββΆβ (PGVector) βββββΆβ (Gemini/OpenAI)β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β PDF Chunking β β Semantic Search β β Audit Engine β
β & Embeddings β β & Similarity β β Analysis β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Java 21+ (LTS)
- Docker & Docker Compose
- Maven 3.9+
- API Keys:
- Google Gemini API (required)
- OpenAI API (optional, fallback)
git clone https://github.com/kfrural/norman-compliance-engine.git
cd norman-compliance-engine
# Configure environment variables
cp .env.example .env
# Edit .env with your API keys# Start all services (PostgreSQL, Redis, Prometheus, Grafana)
docker-compose up -d
# Wait for services to be ready
docker-compose ps# Compile and run
./mvnw spring-boot:run
# Or build Docker
docker build -t norman-engine .
docker run -p 8080:8080 norman-engine- API: http://localhost:8080
- Swagger UI: http://localhost:8080/swagger-ui.html
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000 (admin/norman_admin)
- MinIO: http://localhost:9001
src/main/java/com/norman/engine/
βββ config/ # Configurations (AI, Database, Monitoring)
βββ controller/ # REST Endpoints
βββ service/ # Business Logic
β βββ ai/ # AI Strategies (Strategy Pattern)
β βββ audit/ # Audit Engine
β βββ vector/ # Vector Search
βββ domain/ # JPA Entities
βββ dto/ # Data Transfer Objects
βββ repository/ # Spring Data Repositories
βββ exception/ # Error Handling
βββ util/ # Utilities
src/main/resources/
βββ application.yml # Main Configurations
βββ static/ # Static Resources
docker/ # Docker Configurations
βββ postgres/ # SQL Scripts
βββ prometheus/ # Metrics Configuration
βββ grafana/ # Dashboards
βββ nginx/ # Reverse Proxy
docs/ # Documentation
βββ api/ # API Documentation
βββ architecture/ # Architecture and Design
scripts/ # Automation Scripts
βββ dev/ # Development Scripts
βββ prod/ # Production Scripts
| Component | Technology | Version |
|---|---|---|
| Framework | Spring Boot | 3.3.2 |
| Language | Java | 21 (LTS) |
| Database | PostgreSQL + PGVector | 16+ |
| AI/LLM | Google Gemini Pro | v1 |
| Vector Store | Spring AI + PGVector | 1.0.0-M1 |
| Cache | Redis | 7.2 |
| Monitoring | Prometheus + Grafana | 2.48+ |
| Tracing | Jaeger | 1.51 |
| File Storage | MinIO | Latest |
| Reverse Proxy | Nginx | 1.25 |
| Tests | Testcontainers | 1.20+ |
sequenceDiagram
participant U as User
participant API as API
participant DP as DocumentProcessor
participant VS as VectorStore
participant AI as EmbeddingAI
U->>API: Upload Standard PDF
API->>DP: Process Document
DP->>DP: Extract Text (PDFBox)
DP->>DP: Split into Chunks
DP->>AI: Generate Embeddings
AI-->>DP: 768-dimension vectors
DP->>VS: Store with Metadata
VS-->>API: Confirmation
API-->>U: Standard Processed
sequenceDiagram
participant U as User
participant API as API
participant AE as AuditEngine
participant VS as VectorStore
participant AI as AuditAI
participant DB as Database
U->>API: POST /api/v1/audit
API->>AE: Start Audit
AE->>VS: Search Relevant Context
VS-->>AE: Top-5 Similar Segments
AE->>AI: Analyze with Context
AI-->>AE: Structured Findings
AE->>DB: Save Results
DB-->>AE: Confirmation
AE-->>API: Audit Complete
API-->>U: Compliance + Metrics
- Switch between Gemini, OpenAI without code changes
- Automatic fallback when service fails
- Real-time health checking
- Automatic invalid JSON detection
- Re-processing without manual intervention
- Success rate metrics
- IVFFlat indexing for performance
- Configurable similarity threshold
- Metadata filtering (category, version)
- Distributed tracing with Jaeger
- Custom metrics in Prometheus
- Automated Grafana dashboards
# Unit Tests
./mvnw test
# Integration Tests
./mvnw test -P integration-test
# Coverage Report
./mvnw jacoco:report
# Check Coverage
open target/site/jacoco/index.htmlAll integration tests use Testcontainers to create isolated environments:
- PostgreSQL with PGVector
- Redis for cache
- Mock servers for external APIs
- Vector Search Latency: < 100ms (P95)
- AI Success Rate: > 95%
- Cost per Audit: Tracked in tokens
- Throughput: Audits/hour
- Cache Hit Ratio: > 80%
-
Performance Overview
- Endpoint latency
- Service error rate
- Resource consumption
-
AI Operations
- Tokens consumed per model
- Self-correction rate
- Response time by provider
-
Compliance Metrics
- Compliance rate by category
- Severity distribution
- Main non-compliances
- JWT Tokens (next version)
- Role-based access control
- Rate limiting per IP/user
- Sensitive data encryption
- Logs without private information
- Automated backup
# Build and deploy
docker-compose -f docker-compose.prod.yml up -d
# Health checks
curl http://localhost:8080/actuator/health# Deployment example
apiVersion: apps/v1
kind: Deployment
metadata:
name: norman-engine
spec:
replicas: 3
selector:
matchLabels:
app: norman-engine
template:
spec:
containers:
- name: norman
image: norman-engine:1.0.0
ports:
- containerPort: 8080# Install pre-commit hooks
./scripts/setup-dev.sh
# Format code
./mvnw spotless:apply
# Check style
./mvnw checkstyle:check- Fork and create feature branch
- Tests passing (>90% coverage)
- Semantic commits
- Filled PR template
This project is licensed under MIT License - see LICENSE file for details.
Have questions, suggestions, or want to contribute? I'd be happy to chat!
- π§ Email: kferreira7581@gmail.com
- π GitHub: https://github.com/kfrural
- πΌ LinkedIn: linkedin.com/in/karla-ferreira
- π Portfolio: https://karlaferreira.dev
- Spring Team for excellent Spring AI framework
- Google for Gemini API
- PostgreSQL for PGVector extension
- Docker Community for containerization tools
β‘ Start right now: docker-compose up -d && ./mvnw spring-boot:run
π Complete documentation: Project Wiki
π Report issues: Issues