Parser and semantic search system for EASA (European Union Aviation Safety Agency) regulations. Optimized for integration with RAG (Retrieval Augmented Generation) systems.
- β Official EASA structure-based parser : Uses the EASA eRules XML Export XSD schema
- β 3,357+ topics extracted : Complete access to all regulations (IR, AMC, GM, CS)
- β Batch processing : Parse all XML files in a directory automatically
- β Universal parser : Automatically detects EASA document location (item2.xml, item9.xml, etc.)
- β Semantic search : Embeddings with sentence-transformers for similarity search
- β Complete metadata : Dates, regulatory sources, content types
- β Optimized performance : SDT indexing in O(n) for fast parsing (~5 seconds)
- β MCP Server : Integration with Model Context Protocol for LLMs
- β Chat Client : CLI interface to chat with LLMs connected to EASA regulations
- β CrewAI Compliance : Automated audit with AI agent team (Auditor + QA)
# Clone the repository
git clone https://github.com/dmoraine/easacompliance.git
cd easacompliance
# Install with pip
pip install -e .
# Or with uv (modern and faster)
./install.shThe install.sh script uses uv for fast dependency resolution and installation.
Interactive CLI interface to chat with LLMs (OpenAI, Ollama, Hyperbolic) connected to EASA regulations via MCP:
# Configuration
cp env.example .env
# Edit .env with your API keys
# Launch chat
python chat_mcp.py --provider ollama # Local, no API key needed
python chat_mcp.py --provider openai # With OpenAI
python chat_mcp.py --provider hyperbolic # With HyperbolicFeatures:
- π¬ Interactive chat with streaming responses
- π§ Automatic function calling to EASA MCP server
- π Search, retrieval and regulatory compliance validation
- π Multi-provider support (OpenAI, local Ollama, Hyperbolic)
Automated compliance audit with a team of 2 AI agents (Auditor + QA Challenger) that collaborate and challenge each other:
# Configuration (same .env as for chat)
cp env.example .env
# Audit a text
python compliance_crew.py \
--text "Flight crew members must not exceed 900 hours" \
--output report.md \
--provider openai
# Audit a file
python compliance_crew.py \
--file operations_manual.txt \
--output compliance_report.md \
--provider openai
# Interactive mode
python compliance_crew.py --interactive --output report.mdFeatures:
- π€ 2 specialized agents: Expert Auditor + QA Challenger
- β Cross-validation: QA challenges and verifies findings
- π Detailed Markdown report with exact EASA references
- π Non-compliance identification with severity levels
- π§ Full access to EASA MCP tools for agents
- π Multi-provider support (recommended: OpenAI GPT-4)
π Complete CrewAI Compliance Guide
The script supports two modes: single file or directory batch processing.
# Parse a single XML file (3,357 topics)
python build_embeddings.py \
--xml "Easy Access Rules for Air Operations - February 2025 - xml.xml" \
--db easa_complete.db \
--clear
# Parse only a specific category (e.g., ORO.FTL)
python build_embeddings.py \
--xml "Easy Access Rules for Air Operations - February 2025 - xml.xml" \
--category "ORO.FTL" \
--db oro_ftl.db \
--clear
# Parse only IR (Implementing Rules)
python build_embeddings.py \
--xml "Easy Access Rules for Air Operations - February 2025 - xml.xml" \
--types IR \
--db easa_ir.db \
--clearParse all XML files in a directory automatically:
# Parse all XML files in easy_access/ (default directory)
python build_embeddings.py \
--db easa_complete.db \
--clear
# Parse all XML files in a specific directory
python build_embeddings.py \
--dir easy_access \
--db easa_complete.db \
--clear
# Parse all XML files with filters
python build_embeddings.py \
--dir easy_access \
--db easa_ir_only.db \
--types IR \
--clearFeatures:
- β
Automatically detects all
.xmlfiles in the directory - β Processes files sequentially with progress tracking
- β Duplicate prevention (UNIQUE constraint on references)
- β Error handling per file (continues if one fails)
- β Detailed summary with statistics per file and final totals
Note: The build_embeddings.py script at the root is a convenient wrapper to the full implementation in easacompliance/scripts/build_embeddings.py. You can also use the module directly: python -m easacompliance.scripts.build_embeddings or python easacompliance/scripts/build_embeddings.py
# Interactive mode
python -m easacompliance.scripts.search_regulations \
--db "easa_complete.db" \
--interactive
# Single search
python -m easacompliance.scripts.search_regulations \
--db "easa_complete.db" \
--query "flight time limitations" \
--top-k 5
# Manual compliance validation
python -m easacompliance.scripts.search_regulations \
--db "easa_complete.db" \
--manual "operations_manual.txt" \
--top-k 10 \
--min-score 0.3Note: You can also use the direct path: python easacompliance/scripts/search_regulations.py
from easacompliance import EASAParser, EmbeddingsManager, TopicType
# Parser
parser = EASAParser("regulations.xml")
# Extract a specific topic
topic = parser.get_topic_by_reference("ORO.FTL.110")
print(f"{topic.reference} - {topic.title}")
print(f"Type: {topic.topic_type.value}")
print(f"Content: {topic.content}")
# Extract all topics from a category
oro_ftl_topics = parser.get_all_topics(pattern=r'^ORO\.FTL\.')
print(f"Found {len(oro_ftl_topics)} ORO.FTL topics")
# Semantic search
manager = EmbeddingsManager("easa_complete.db")
results = manager.search("flight time limitations", top_k=5)
for result in results:
print(f"{result.reference}: {result.title} (score: {result.score:.3f})")EASACompliance/ # Project root
βββ build_embeddings.py # Build embeddings database (root script wrapper)
βββ chat_mcp.py # Chat MCP client (root script)
βββ compliance_crew.py # CrewAI compliance validator (root script)
βββ run_mcp_server.py # MCP server launcher (root script)
βββ install.sh # Installation script (uses uv)
βββ env.example # Environment variables template
βββ requirements.txt # Consolidated dependencies
β
βββ easacompliance/ # Main package
β βββ __init__.py # Public exports
β βββ parser.py # EASA parser (EASAParser, Topic, TopicType)
β βββ embeddings.py # Embeddings manager (EmbeddingsManager)
β βββ scripts/ # CLI scripts
β βββ build_embeddings.py
β βββ search_regulations.py
β
βββ mcp_server_easa/ # MCP server package
β βββ server.py # MCP server implementation
β βββ config.py # Configuration
β βββ schemas.py # Data schemas
β βββ tools/ # MCP tools
β βββ search.py
β βββ retrieve.py
β βββ browse.py
β βββ validate.py
β
βββ tests/ # Tests
β βββ test_embeddings.py
β βββ test_chat_setup.py
β βββ test_crew_setup.py
β
βββ docs/ # Documentation
β βββ chat/ # Chat MCP documentation
β β βββ README.md
β β βββ QUICKSTART.md
β β βββ IMPLEMENTATION.md
β βββ crew/ # CrewAI documentation
β β βββ README.md
β β βββ IMPLEMENTATION.md
β βββ EMBEDDINGS_GUIDE.md
β βββ ...
β
βββ data/ # Reference data
β βββ EASA-eRules-XML-Export-Schema-1.0.0.xsd
β
βββ README.md
βββ pyproject.toml
βββ requirements.txt
The parser extracts 3,357+ structured topics from Air Operations documents:
| Type | Count | Description |
|---|---|---|
| IR | 1,025 | Implementing Rules |
| AMC | 1,263 | Acceptable Means of Compliance |
| GM to IR | 1,026 | Guidance Material to Implementing Rules |
| CS | 7 | Certification Specifications |
| GM to CS | 18 | Guidance Material to Certification Specifications |
| Others | 18 | Easy Access Rules, disclaimers, etc. |
Note: Additional topics are extracted from other EASA documents (Aircrew, etc.) when using batch processing mode.
All filtering options work in both single file and batch directory modes:
--category "ORO.FTL" # All ORO.FTL.*
--category "CS FTL" # All CS FTL.*--types IR # Only Implementing Rules
--types IR AMC # IR + AMC
--types ALL # All (default)--subject "Part-ORO" # All Part-ORO
--subject "Part-CAT" # All Part-CAT--pattern "ORO\\.FTL\\." # Custom patternNote: Filters are applied to all files when using batch mode (--dir).
- Parser Complete Guide
- Embeddings Guide
- Quick Start Guide
- Chat MCP Guide
- CrewAI Compliance Guide
- MCP Server Guide
# Run tests
python -m pytest tests/
# Or directly
python tests/test_embeddings.py
python tests/test_chat_setup.py
python tests/test_crew_setup.pySee CHANGELOG.md for version history.
Contributions are welcome! Feel free to open an issue or pull request.
MIT License - See the LICENSE file for details.
- EASA for the official XML schema
- sentence-transformers for embeddings
- The Python community for development tools
For questions or suggestions, open an issue on GitHub.
Version: 2.0.0
Last updated: 2025