Monitoring
AI Operations Monitoring
Live metrics and status for AI-powered features.
AI API Errors
3
Investigate
AI Queue Length
15
Normal
Cost per Day (Est.)
₹1,250
Normal
Acceptance Test Suite
The following are conceptual test stubs for the core AI flows. To run them, a test runner like Jest needs to be configured.
__tests__/photo-tagging.test.ts
describe('Photo Tagging & Defect Detection Flow', () => {
it('should identify defects and tags in a photo of a safety hazard', () => {
// Sample input: Base64 encoded image of a worker without a helmet
const input = { photoDataUri: 'data:image/jpeg;base64,...' };
// Expected output
const expectedOutput = {
tags: expect.arrayContaining([{ label: 'worker', confidence: expect.any(Number) }]),
defects: expect.arrayContaining([
{ defect_type: 'Improper PPE Usage', severity: 'high', confidence: expect.any(Number) }
]),
};
// Mock the AI flow call
// const result = await photoTaggingAndDefectDetection(input);
// expect(result).toMatchObject(expectedOutput);
expect(true).toBe(true); // Placeholder assertion
});
});
__tests__/dpr-summarizer.test.ts
describe('DPR Summarizer Flow', () => {
it('should generate a comprehensive summary from photo analysis', () => {
// Sample input
const input = {
reportDate: '2024-08-01',
projectName: 'Skyline Tower',
photoAnalyses: [
{ tags: [{label: 'rebar', confidence: 0.9}], defects: [], timestamp: '...'},
{ tags: [], defects: [{description: 'Cracked concrete', confidence: 0.85}], timestamp: '...'},
]
};
// Mock the AI flow call
// const result = await summarizeReport(input);
// expect(result.key_metrics.potential_issues_found).toBe(1);
// expect(result.issues_detected).toContain('Cracked concrete');
// expect(result.executive_summary).toBeTruthy();
expect(true).toBe(true); // Placeholder assertion
});
});
Alerting Configuration
Specifications for automated alerts based on monitoring metrics.
| Metric | Threshold | Severity | Alert Message |
|---|---|---|---|
| AI API Errors | > 5 in 1 hour | High | High rate of AI API errors detected. 🚨 Check AI provider status and function logs. |
| AI Queue Length | > 100 for 30 mins | Medium | AI processing queue is growing. 📈 Consider scaling up processing instances. |
| Cost per Day | > ₹5,000 | High | Daily AI costs have exceeded the defined budget threshold of ₹5,000. 💸 |