Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
2.3 KiB
PowerShell
72 lines
2.3 KiB
PowerShell
#Requires -Version 5.1
|
|
<#
|
|
.SYNOPSIS
|
|
Pre-flight validation for UiPath MISF Planner Download pilot (mirrors Python validate_config + output checks).
|
|
#>
|
|
param(
|
|
[string]$ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path,
|
|
[int]$ExpectedFacilities = 54,
|
|
[switch]$CheckOutput
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$configPath = Join-Path $ProjectRoot "Input\input.xlsx"
|
|
$uipathProject = Join-Path $ProjectRoot "uipath\MISF_Planner_Download\project.json"
|
|
$today = Get-Date -Format "yyyy-MM-dd"
|
|
|
|
Write-Host "MISF UiPath pilot validation"
|
|
Write-Host "Project root: $ProjectRoot"
|
|
|
|
if (-not (Test-Path $configPath)) {
|
|
Write-Error "Missing config: $configPath (copy Input\input.xlsx.example)"
|
|
}
|
|
if (-not (Test-Path $uipathProject)) {
|
|
Write-Error "Missing UiPath project: $uipathProject"
|
|
}
|
|
|
|
# Run Python config validator if available
|
|
$pyValidate = Join-Path $ProjectRoot "scripts\validate_config.py"
|
|
if (Test-Path $pyValidate) {
|
|
Write-Host "Running Python validate_config.py..."
|
|
python $pyValidate
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
}
|
|
|
|
# Verify UiPath workflow files exist
|
|
$requiredWorkflows = @(
|
|
"Main.xaml",
|
|
"01_ReadConfig.xaml",
|
|
"02_LoginPlanner.xaml",
|
|
"03_ProcessFacility.xaml",
|
|
"04_DownloadTaskAttachments.xaml",
|
|
"05_SetTaskInProgress.xaml",
|
|
"06_WriteSummary.xaml",
|
|
"Helpers\GenerateTotp.xaml",
|
|
"Helpers\SanitizeFolderName.xaml",
|
|
"Selectors\PlannerSelectors.json"
|
|
)
|
|
$uipathDir = Join-Path $ProjectRoot "uipath\MISF_Planner_Download"
|
|
foreach ($wf in $requiredWorkflows) {
|
|
$p = Join-Path $uipathDir $wf
|
|
if (-not (Test-Path $p)) {
|
|
Write-Error "Missing workflow file: $p"
|
|
}
|
|
}
|
|
Write-Host "All UiPath workflow files present."
|
|
|
|
if ($CheckOutput) {
|
|
$summary = Join-Path $ProjectRoot "Output\$today\Summary\Download_Summary_$today.xlsx"
|
|
$original = Join-Path $ProjectRoot "Output\$today\Original"
|
|
if (-not (Test-Path $summary)) {
|
|
Write-Warning "No summary yet: $summary (run UiPath Main with in_FacilityLimit=2)"
|
|
} else {
|
|
Write-Host "Summary found: $summary"
|
|
}
|
|
if (Test-Path $original) {
|
|
$pdfCount = (Get-ChildItem -Path $original -Recurse -Filter "*.pdf" -ErrorAction SilentlyContinue).Count
|
|
Write-Host "PDFs under Original: $pdfCount"
|
|
}
|
|
}
|
|
|
|
Write-Host "Pilot pre-flight OK."
|