# petroskyluke/servicenow-health-check architecture

> Architecture diagram of the GitHub repository petroskyluke/servicenow-health-check, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/petroskyluke/servicenow-health-check
- Repository: https://github.com/petroskyluke/servicenow-health-check

## Overview

This repository provides two ServiceNow health-check workflows: a configurable scan of customized application code, and a separate ATF test for VIT risk-score and rating data. The scan selects application records, filters them using customer-update evidence, checks for configured code patterns and scheduled-job risks, and prints prioritized findings. The ATF steps validate configuration and then check population, values, consistency, and distribution through a shared read-only helper. The scan’s implementation is sampled only in excerpts; its documented capabilities are retained, but uncertain internal wiring is omitted.

Main entry points: [`Scripts/USEM_HC_ApplicationHealthScan.js`](https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/USEM_HC_ApplicationHealthScan.js) (Scope scan), [`Scripts/ATF/VRRiskDataHealth.js`](https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/ATF/VRRiskDataHealth.js) (Risk health helper), [`Scripts/ATF/steps`](https://github.com/petroskyluke/servicenow-health-check/tree/main/Scripts/ATF/steps) (Five check steps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scan["Application scan"]
  node_scan_entry["Scope scan"]
  node_findings["Prioritized findings"]
end

subgraph group_risk["VIT risk checks"]
  node_atf_steps["Five check steps"]
  node_risk_helper["Risk health helper"]
  node_atf_result["Check results"]
end

subgraph group_platform["ServiceNow platform"]
  node_app_records[("Application records")]
  node_update_metadata[("Customer updates")]
  node_version_metadata[("Version metadata")]
  node_user_records[("User records")]
  node_vit_data[("VIT records")]
end

node_admin(("Administrator"))
node_atf_runner(("ATF runner"))

node_admin -->|"runs"| node_scan_entry
node_scan_entry -->|"queries scopes and code"| node_app_records
node_scan_entry -->|"checks customer changes"| node_update_metadata
node_scan_entry -->|"classifies origin"| node_version_metadata
node_scan_entry -->|"checks run-as users"| node_user_records
node_scan_entry -->|"prints report"| node_findings
node_atf_runner -->|"executes"| node_atf_steps
node_atf_steps -->|"runs check"| node_risk_helper
node_risk_helper -->|"aggregates read-only"| node_vit_data
node_risk_helper -->|"returns pass or fail"| node_atf_result
node_atf_result -->|"supplies result"| node_atf_steps

click node_scan_entry "https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/USEM_HC_ApplicationHealthScan.js"
click node_findings "https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/USEM_HC_ApplicationHealthScan.js"
click node_atf_steps "https://github.com/petroskyluke/servicenow-health-check/tree/main/Scripts/ATF/steps"
click node_risk_helper "https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/ATF/VRRiskDataHealth.js"
click node_atf_result "https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/ATF/VRRiskDataHealth.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scan_entry,node_findings toneBlue
class node_atf_steps,node_risk_helper,node_atf_result toneAmber
class node_app_records,node_update_metadata,node_version_metadata,node_user_records,node_vit_data toneMint
class node_admin,node_atf_runner toneIndigo
```

## Components

### Application scan

- [Scope scan](https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/USEM_HC_ApplicationHealthScan.js): `Scripts/USEM_HC_ApplicationHealthScan.js`
- [Prioritized findings](https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/USEM_HC_ApplicationHealthScan.js): `Scripts/USEM_HC_ApplicationHealthScan.js`

### VIT risk checks

- [Five check steps](https://github.com/petroskyluke/servicenow-health-check/tree/main/Scripts/ATF/steps): `Scripts/ATF/steps`
- [Risk health helper](https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/ATF/VRRiskDataHealth.js): `Scripts/ATF/VRRiskDataHealth.js`
- [Check results](https://github.com/petroskyluke/servicenow-health-check/blob/main/Scripts/ATF/VRRiskDataHealth.js): `Scripts/ATF/VRRiskDataHealth.js`

### ServiceNow platform

- **Application records**
- **Customer updates**
- **Version metadata**
- **User records**
- **VIT records**

### Other components

- **Administrator**
- **ATF runner**

## Connections

- Administrator → Scope scan: runs
- Scope scan → Application records: queries scopes and code
- Scope scan → Customer updates: checks customer changes
- Scope scan → Version metadata: classifies origin
- Scope scan → User records: checks run-as users
- Scope scan → Prioritized findings: prints report
- ATF runner → Five check steps: executes
- Five check steps → Risk health helper: runs check
- Risk health helper → VIT records: aggregates read-only
- Risk health helper → Check results: returns pass or fail
- Check results → Five check steps: supplies result
