Public Access
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:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"workflow": "insurance+patient",
|
||||
"insurance_file_type": "pdf",
|
||||
|
||||
"ftps": {
|
||||
"host": "ftp.example.com",
|
||||
|
||||
@@ -83,6 +83,7 @@ leave its login and every other path alone.
|
||||
| Setting | What to put |
|
||||
|---------|------------|
|
||||
| `workflow` | `insurance` if no patient files, `insurance+patient` if both |
|
||||
| `insurance_file_type` | Optional, defaults to `pdf`. Set to `tif` for an entity whose imaging system exports the daily insurance/PT STMT files as TIFs instead of PDFs (e.g. CAMBS, RMI, CONSENSIO, INLAND) |
|
||||
| `ftps.host` | FTP server address |
|
||||
| `ftps.username` | FTP username (shared across all practices) |
|
||||
| `ftps.password` | FTP password |
|
||||
|
||||
+7
-6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user