|
| 1 | +# Training Data Quality Analyzer for ServiceNow Predictive Intelligence (Change Requests) |
| 2 | + |
| 3 | +## Overview |
| 4 | +This script analyzes the quality of change request data in ServiceNow to determine readiness for Predictive Intelligence (PI) model training. It provides detailed statistics and quality metrics to help ServiceNow developers and admins identify and address data issues before starting ML training jobs. |
| 5 | + |
| 6 | +## Purpose |
| 7 | +- Assess completeness and quality of key fields in change request records |
| 8 | +- Identify common data issues that could impact PI model performance |
| 9 | +- Provide actionable insights for improving training data |
| 10 | + |
| 11 | +## Features |
| 12 | +- Checks completeness of important fields (e.g., short_description, description, category, risk, assignment_group, implementation_plan, test_plan, backout_plan, close_notes) |
| 13 | +- Analyzes text quality for description, implementation/test/backout plans, and close notes |
| 14 | +- Evaluates category diversity and closure times |
| 15 | +- Calculates an overall data quality score |
| 16 | +- Outputs results to the ServiceNow system logs |
| 17 | + |
| 18 | +## Setup Requirements |
| 19 | +1. **ServiceNow Instance** with Predictive Intelligence plugin enabled |
| 20 | +2. **Script Execution Permissions**: Run as a background script or Script Include with access to the `change_request` table |
| 21 | +3. **No external dependencies**: Uses only standard ServiceNow APIs (GlideRecord, GlideAggregate, GlideDateTime) |
| 22 | +4. **Sufficient Data Volume**: At least 50 closed change requests recommended for meaningful analysis |
| 23 | + |
| 24 | +## How It Works |
| 25 | +1. **Field Existence Check**: Dynamically verifies that each key field exists on the change_request table or its parent tables |
| 26 | +2. **Statistics Gathering**: Collects counts for total, closed, and recent change requests |
| 27 | +3. **Completeness Analysis**: Calculates the percentage of records with each key field filled |
| 28 | +4. **Text Quality Analysis**: Measures average length and quality of description, implementation/test/backout plans, and close notes |
| 29 | +5. **Category Distribution**: Reports on the spread and diversity of change request categories |
| 30 | +6. **Closure Time Analysis**: Evaluates how quickly change requests are closed |
| 31 | +7. **Quality Scoring**: Combines all metrics into a single overall score |
| 32 | +8. **Log Output**: Prints all results and warnings to the ServiceNow logs for review |
| 33 | + |
| 34 | +## Customization |
| 35 | +- Adjust the `keyFields` array in the config section to match your organization's data requirements |
| 36 | +- Modify thresholds for text length, closure time, and completeness as needed |
| 37 | +- Increase `sampleSize` for more detailed analysis if you have a large dataset |
0 commit comments