diff --git a/Entities/EXAMPLE/entity.json b/Entities/EXAMPLE/entity.json index 0561842..7c90396 100644 --- a/Entities/EXAMPLE/entity.json +++ b/Entities/EXAMPLE/entity.json @@ -1,5 +1,6 @@ { "workflow": "insurance+patient", + "insurance_file_type": "pdf", "ftps": { "host": "ftp.example.com", diff --git a/README.md b/README.md index a7571ae..d93e7cc 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/engine.ps1 b/engine.ps1 index 9259475..68defc4 100644 --- a/engine.ps1 +++ b/engine.ps1 @@ -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