Automated document validation system that enforces the Mace Control Centre Writing Style Guide using Azure Functions, Claude AI, and SharePoint integration.
- β Automatic Validation - Documents validated on upload to SharePoint
- π€ AI-Powered - Claude 3 Haiku for intelligent language corrections
- π¬π§ British English - Comprehensive British spelling enforcement (25+ rules)
- π Grammar Rules - Contraction expansion, punctuation, symbol replacement
- π§ Auto-Fix - Most issues corrected automatically
- π Beautiful Reports - Professional HTML reports with color-coded results
- π Audit Trail - Complete validation history in SharePoint
- β‘ Fast - Typical validation in 5-15 seconds
- π Secure - Azure AD authentication, encrypted secrets
- π Scalable - Serverless architecture, auto-scaling
- finalized, color, center, analyze
+ finalised, colour, centre, analyseAnd 20+ more British spellings!
- can't, don't, won't, isn't
+ cannot, do not, will not, is not- M&S partnership - 50% growth
+ M and S partnership - 50 percent growth- Budget: 1000 for 5000 items
+ Budget: 1,000 for 5,000 items- Mixed fonts (Calibri, Times New Roman, etc.)
+ All text standardized to Arialgraph LR
A[SharePoint] -->|Trigger| B[Power Automate]
B -->|HTTP POST| C[Azure Function]
C -->|Authenticate| D[Azure AD]
C -->|Fetch Rules| A
C -->|Validate| E[Claude AI]
E -->|Corrections| C
C -->|Upload| A
C -->|Save Results| A
style A fill:#e3f2fd
style C fill:#fff3e0
style E fill:#f3e5f5
Components:
- SharePoint Online - Document storage & triggers
- Power Automate - Workflow orchestration
- Azure Functions - Serverless validation logic (Python 3.11)
- Claude AI - Advanced language processing
- Microsoft Graph API - SharePoint integration
- Azure AD - Secure authentication
π Detailed Architecture Documentation
- Azure subscription (Owner/Contributor access)
- Microsoft 365 with SharePoint Online
- Power Platform admin access
- Anthropic API key (Get one here)
- Python 3.11+
- Azure Functions Core Tools v4
-
Clone the repository
git clone https://github.com/stephencummins/MaceStyle.git cd MaceStyle -
Set up Azure resources
- Create Azure Function App
- Create App Registration in Azure AD
- Configure API permissions (
Sites.ReadWrite.All,Files.ReadWrite.All)
-
Configure SharePoint
- Create site:
/sites/StyleValidation - Create lists:
Style Rules,Validation Results - Add custom columns to Document Library
- Create site:
-
Deploy Azure Function
cd MaceStyleValidator # Install dependencies pip install -r requirements.txt # Deploy to Azure func azure functionapp publish <your-function-app-name>
-
Configure environment variables
SHAREPOINT_TENANT_ID="your-tenant-id" SHAREPOINT_CLIENT_ID="your-client-id" SHAREPOINT_CLIENT_SECRET="your-secret" SHAREPOINT_SITE_URL="https://tenant.sharepoint.com/sites/StyleValidation" ANTHROPIC_API_KEY="sk-ant-..."
-
Populate style rules
python3 populate_style_rules.py
-
Create Power Automate flow
- Trigger: When file created/modified in SharePoint
- Action: HTTP POST to Azure Function
- Action: Parse JSON response
- Upload document to SharePoint library
- Wait for validation (~10 seconds)
- Check results:
- Status badge: π’ Passed / π΄ Failed
- Click Validation Report link for details
- Download corrected file (if fixes applied)
Manage validation rules:
- Go to Style Rules list in SharePoint
- Add/edit rules:
- Set
UseAI: Yesfor Claude AI validation - Set
AutoFix: Yesfor automatic corrections - Adjust
Priorityfor execution order
- Set
Monitor validations:
- Azure Portal β Function App β Application Insights
- SharePoint β Validation Results list
- Review HTML reports for trends
π Style Validation Report
[PASSED Badge]
Document: Project_Report.docx
Validated: 08 November 2025 at 20:42:15 UTC
Summary
βββββββββββββββ¬ββββββββββββββ¬βββββββββββββββββ
βIssues Found β Auto-Fixed βRemaining Issuesβ
β 156 β 156 β 0 β
βββββββββββββββ΄ββββββββββββββ΄βββββββββββββββββ
β
Fixes Applied (156)
β Fixed 145 text runs to Arial
β Applied 8 style corrections (British English, contractions)
β Replaced 'finalized' with 'finalised' (3 instances)
β οΈ Issues Detected (156)
β Found 145 text runs with incorrect font
β Found 8 style violationsA comprehensive test document is included:
# Create test document with 40+ violations
python3 create_test_document.py
# Upload to SharePoint
# test_files/test_validation_comprehensive.docxTest document includes:
- β British English spelling errors
- β Contractions
- β Symbol violations (& and %)
- β Number formatting issues
- β Font inconsistencies
| Document | Description |
|---|---|
| Technical Architecture | System design, components, data flow |
| User Guide | How to use the validator |
| Configuration & Setup | Complete installation guide |
- Azure AD authentication - Secure service principal
- Encrypted secrets - Azure Key Vault / App Settings
- Minimal permissions - Principle of least privilege
- Audit trail - All validations logged
- No data persistence - Documents processed in-memory
Estimated monthly costs (for 1,000 documents):
| Service | Cost |
|---|---|
| Azure Functions (Consumption) | $5-10 |
| Application Insights | $2-5 |
| Claude AI (Haiku) | ~$10 |
| SharePoint | Included in M365 |
| Total | ~$17-25/month |
For 100 documents/month: ~$2-5/month
- Backend: Python 3.11, Azure Functions
- AI: Claude 3 Haiku (Anthropic)
- Integration: Microsoft Graph API, MSAL
- Document Processing: python-docx, vsdx
- Workflow: Power Automate
- Storage: SharePoint Online
- Auth: Azure AD (Entra ID)
- Average processing time: 5-15 seconds
- Concurrent validations: Auto-scaling (Azure Functions)
- Supported file size: Up to 100 pages recommended
- API rate limits: Graph API throttling handled
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- β Visio validation currently minimal (planned enhancement)
- β Very large files (>100 pages) may timeout
- β Complex table validation limited
See Issues for full list.
- Enhanced Visio diagram validation
- PDF document support
- Excel spreadsheet validation
- Multi-language support
- Custom rule templates
- Batch validation API
- Real-time validation in Word Online
This project is licensed under the MIT License - see the LICENSE file for details.
- Anthropic - Claude AI API
- Microsoft - Azure Functions, SharePoint, Graph API
- python-docx - Word document manipulation
- Mace Group - Writing Style Guide
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Give a βοΈ if this project helped you!
Built with β€οΈ using Azure Functions & Claude AI
Automated document validation has never been easier!