Make insurance file type configurable per entity (pdf vs tif)

CAMBS, RMI, CONSENSIO, and INLAND always export TIFs into the daily date
folder instead of PDFs, so engine.ps1's hardcoded "*.pdf" filter silently
found nothing to upload (no error, just "No PDFs" for every practice).
Added optional entity.json field "insurance_file_type" (defaults to "pdf"
when omitted, so existing entities are unaffected); the PT STMT split logic
already worked on filename regardless of extension, so no other changes
needed.
This commit is contained in:
2026-07-05 19:45:53 -05:00
parent 86bbe685c7
commit 1c26d85751
3 changed files with 9 additions and 6 deletions
+7 -6
View File
@@ -63,6 +63,7 @@ if (-not (Test-Path $entityConfigFile)) {
$entityConfig = Get-Content $entityConfigFile -Raw | ConvertFrom-Json
$workflow = $entityConfig.workflow
$insuranceExt = if ($entityConfig.insurance_file_type) { $entityConfig.insurance_file_type.TrimStart(".") } else { "pdf" }
$export1 = Join-Path $EntityDir "Export1"
$entityName = Split-Path -Leaf $EntityDir
@@ -222,9 +223,9 @@ foreach ($practice in $practices) {
Write-Host " No $today\ folder - skipping insurance." -ForegroundColor Gray
Write-Info "SKIP entity=$entityName practice=$pracName reason=no date folder"
} else {
$allPdfs = Get-ChildItem -Path $dateDir -Filter "*.pdf" -File
$ptStmts = $allPdfs | Where-Object { $_.Name -imatch 'pt[\s_]*stmt' }
$insFiles = $allPdfs | Where-Object { $_.Name -notmatch 'pt[\s_]*stmt' }
$allInsuranceFiles = Get-ChildItem -Path $dateDir -Filter "*.$insuranceExt" -File
$ptStmts = $allInsuranceFiles | Where-Object { $_.Name -imatch 'pt[\s_]*stmt' }
$insFiles = $allInsuranceFiles | Where-Object { $_.Name -notmatch 'pt[\s_]*stmt' }
$insPath = Expand-Path $config.ftps.insurance_path $pracName
$pdfPath = Expand-Path $config.ftps.pdf_path $pracName
@@ -236,7 +237,7 @@ foreach ($practice in $practices) {
$insResult.Ok += $r.Ok; $insResult.Fail += $r.Fail
}
if ($ptStmts.Count -gt 0) {
Write-Host " PT STMT PDF ($($ptStmts.Count)) -> $pdfPath" -ForegroundColor White
Write-Host " PT STMT ($($ptStmts.Count)) -> $pdfPath" -ForegroundColor White
$r = Invoke-FTPSUpload $config.ftps $ptStmts $pdfPath $entityName $pracName
$insResult.Ok += $r.Ok; $insResult.Fail += $r.Fail
}
@@ -250,8 +251,8 @@ foreach ($practice in $practices) {
} elseif ($insResult.Fail -gt 0) {
Write-Host " $($insResult.Fail) failed - $today\ left for retry." -ForegroundColor Yellow
} elseif ($totalUploaded -eq 0) {
Write-Host " No PDFs in $today\." -ForegroundColor Gray
Write-Info "SKIP entity=$entityName practice=$pracName reason=no PDFs in date folder"
Write-Host " No .$insuranceExt files in $today\." -ForegroundColor Gray
Write-Info "SKIP entity=$entityName practice=$pracName reason=no .$insuranceExt files in date folder"
}
$totalOk += $insResult.Ok; $totalFail += $insResult.Fail