raywong2121/Multi-Agent
If you are the rightful owner of Multi-Agent and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project implements a multi-agent deliberative intelligence approach for Chinese medical imaging report text standardization using the Model Context Protocol (MCP).
Multi-Agent Deliberative Intelligence Chinese Medical Imaging Report Text Standardization MCP Server
Project Overview
This project implements a multi-agent deliberative intelligence approach for Chinese medical imaging report text standardization, delivered through the Model Context Protocol (MCP). The system employs a complete processing pipeline of "LLM Tokenization & POS Tagging ā Medical Entity Recognition ā Six-Agent Collaboration ā Quality Gates" to efficiently and accurately convert Chinese imaging reports to OMOP CDM 5.4 standard format.
Core Features
š¤ Six-Agent Collaborative Architecture
- Linguist Agent: Performs text normalization, syntactic analysis, and ambiguity resolution
- Structurer Agent: Strictly follows OHDSI separation of concerns principles, decomposing concepts into independent standard components
- Mapper Agent: Uses ReAct (Reasoning-Acting) mode to rapidly generate concept mapping proposals
- Skeptic Agent: Specializes in challenging and validating mapper proposals to ensure quality control
- Auditor Agent: Performs final validation based on complete deliberation history
- OMOP Builder: Converts validated concept mappings to OMOP CDM 5.4 standard format according to OHDSI community best practices
š§ Deliberative Intelligence Algorithm
- Proposer-Skeptic Adversarial Mechanism: Ensures high-quality and reliable concept mapping through multi-round deliberation
- Dynamic Threshold Adjustment: Adaptive threshold adjustment based on terminology complexity and context
- Multi-Strategy Concept Search: Four-tier matching strategies (exact match, synonym match, fuzzy match, semantic match)
š”ļø Quality Control System
- Four-Dimensional Quality Assessment: Logical consistency, deliberation quality, evidence strength, OHDSI compliance
- Multi-Level Quality Gate Mechanism: High/medium/low confidence level processing
- Real-Time Quality Monitoring: Provides detailed quality assessment reports and improvement recommendations
š„ OMOP CDM 5.4 Integration
- SNOMED CT Terminology Mapping: Precise concept alignment and standardization
- Multi-Table Record Generation: Reasonable allocation to OBSERVATION, MEASUREMENT, FACT_RELATIONSHIP tables
- OHDSI Best Practices: Follows Observational Health Data Sciences and Informatics collaborative organization standards
Technical Architecture
Chinese Imaging Report ā [LLM Sentence-by-Sentence Tokenization + POS Tagging] ā POS-Tagged Entities ā [Medical Entity Validation] ā Enhanced Entity Annotation
ā (ANATOMY/FINDING/ATTRIBUTE/MODIFIER/NEGATION/MEASUREMENT/PROCEDURE)
[Linguist Agent] ā Normalized Text + Semantic Segments ā [Structurer Agent] ā Structured Entity List
ā
[Mapper ā Skeptic Deliberation] ā POS Tag Validated Mapping ā [Auditor Agent] ā Quality Validation
ā
[OMOP Builder] ā OBSERVATION/MEASUREMENT/FACT_RELATIONSHIP Table Records ā Local Database Storage
Installation and Deployment
Environment Requirements
- Node.js >= 18.0.0
- TypeScript >= 5.3.0
- OpenAI-compatible LLM Service
- PostgreSQL Database
Installation Steps
- Clone Repository
git clone <repository-url>
cd medical-text-standardization-mcp
- Configure Environment Variables
# Copy environment configuration file
cp .env.example .env
# Edit configuration file (pre-configured with real services)
# LLM Service:
# Database:
- Install Dependencies
npm install
- Build Project
npm run build
- Health Check
# Check LLM service
# Check database connection
- Start Server
npm start
Development Mode
npm run dev
MCP Tools Usage
1. Process Medical Report
{
"name": "process_medical_report",
"arguments": {
"reportText": "Patient chest CT examination shows a nodule in the left upper lobe with a diameter of approximately 12mm, clear boundaries, and uniform density.",
"reportId": "R001",
"patientId": "P12345",
"reportType": "CT"
}
}
2. Analyze Medical Concept
{
"name": "analyze_medical_concept",
"arguments": {
"concept": "pulmonary nodule",
"context": "chest CT examination finding"
}
}
3. Validate Concept Mapping
{
"name": "validate_concept_mapping",
"arguments": {
"sourceText": "pulmonary nodule",
"targetConceptId": 4230254
}
}
4. Search OMOP Concepts
{
"name": "search_omop_concepts",
"arguments": {
"query": "pulmonary nodule",
"domain": "Condition",
"limit": 10
}
}
5. Get Processing Statistics
{
"name": "get_processing_statistics",
"arguments": {}
}
Configuration Guide
Agent Configuration
agents: {
linguist: {
name: 'Linguist',
model: '',
temperature: 0.3,
maxTokens: 2048
},
// ... other agent configurations
}
Quality Threshold Configuration
qualityThresholds: {
logicalConsistency: 0.8,
deliberationQuality: 0.75,
evidenceStrength: 0.7,
ohdsiCompliance: 0.85,
overallScore: 0.8
}
Performance Metrics
Based on research paper experimental results:
- Concept Mapping Accuracy: 95.2%
- Processing Speed: 1,200 reports/hour
- F1 Score: 0.943
- Quality Gate Pass Rate: 93.7%
- Deliberation Rounds: Average 2.3 rounds
- Consensus Achievement Rate: 94.7%
Project Structure
src/
āāā agents/ # Six-agent implementation
ā āāā system.ts # Multi-agent system
ā āāā linguist.ts # Linguist agent
ā āāā structurer.ts # Structurer agent
ā āāā mapper.ts # Mapper agent
ā āāā skeptic.ts # Skeptic agent
ā āāā auditor.ts # Auditor agent
ā āāā omop-builder.ts # OMOP Builder agent
āāā core/ # Core processing logic
ā āāā processor.ts # Medical text processor
ā āāā quality-gate.ts # Quality gate mechanism
āāā services/ # Service layer
ā āāā omop-builder.ts # OMOP builder service
āāā types/ # Type definitions
ā āāā index.ts
āāā utils/ # Utility classes
ā āāā logger.ts
āāā config/ # Configuration management
ā āāā index.ts
āāā index.ts # MCP server entry point
Data Privacy and Security
Real Service Integration
- Production-Grade LLM Service: Integrated OpenAI-compatible LLM2.5 model providing high-quality medical text understanding
- Enterprise Database: Connected to PostgreSQL OHDSI database supporting real OMOP concept queries
- Health Check Mechanism: Automatic service availability detection ensuring stable system operation
- Configuration Management: Flexible service connection parameter configuration through environment variables
Security Features
- Data Encryption: Support for data transmission and storage encryption
- Access Control: Role-based access control mechanism
- Audit Logging: Complete operational audit tracking
Quality Assurance
Test Coverage
- Unit Testing: Coverage of all core components
- Integration Testing: End-to-end process validation
- Performance Testing: Large-scale data processing validation
Quality Monitoring
- Real-time Monitoring: Real-time processing quality monitoring
- Anomaly Detection: Automatic identification of abnormal mappings
- Quality Reports: Regular generation of quality analysis reports
Extension and Customization
Agent Extension
// Custom agent example
class CustomAgent extends BaseAgent {
async process(input: any): Promise<any> {
// Custom processing logic
}
}
Mapping Strategy Extension
// Custom mapping strategy
const customStrategy: MappingStrategyConfig = {
strategy: 'custom_match',
weight: 0.9,
threshold: 0.85,
enabled: true
};
Troubleshooting
Common Issues
-
Server Startup Failure
- Check if Node.js version >= 18.0.0
- Confirm all dependencies are correctly installed
- Check if port is occupied
-
Low Mapping Quality
- Adjust quality threshold configuration
- Check medical dictionary completeness
- Optimize agent prompts
-
Slow Processing Speed
- Check local LLM performance
- Adjust concurrent processing count
- Optimize database queries
Log Analysis
# View server logs
tail -f logs/mcp-server.log
# View quality gate logs
tail -f logs/quality-gate.log
# View agent logs
tail -f logs/linguist.log
Contributing Guide
Development Environment Setup
- Fork the project repository
- Create feature branch
- Commit code changes
- Create Pull Request
Code Standards
- Use TypeScript strict mode
- Follow ESLint configuration
- Add appropriate unit tests
- Update relevant documentation
License
This project is licensed under the MIT License.
Contact
- Email: raywong2121@gmail.com
Acknowledgments
Thanks to the following organizations and projects for their support:
- OHDSI (Observational Health Data Sciences and Informatics)
- SNOMED International
- Model Context Protocol (MCP) Community
Note: This project is for research and educational purposes only. Before using in production environments, please ensure compliance with relevant medical regulations and data protection requirements.