Skip to content

Commit 857219b

Browse files
authored
LEGLINK-354: Fix Patient Count and Patient Bundle Upload Display (#1646)
* checkin * NaN protection
1 parent d7b2a9c commit 857219b

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

DotNet/Automation.UI/Controllers/Api/AutomationRunsApiController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public sealed class AutomationRunsApiController(
2727
/// <see cref="GetStatus"/> until the run reaches a terminal state.
2828
/// </summary>
2929
[HttpPost("start")]
30-
[ValidateAntiForgeryToken]
3130
public async Task<IActionResult> Start([FromBody] StartScenarioApiRequest request, CancellationToken cancellationToken)
3231
{
3332
if (request == null || request.ScenarioId == Guid.Empty)

DotNet/Automation.UI/Views/Runs/Details.cshtml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,38 @@
584584
try { parsed = JSON.parse(rawJson); } catch { return; }
585585
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return;
586586
587+
const importedIdCount = Array.isArray(parsed.importedPatientIds) ? parsed.importedPatientIds.length : 0;
588+
const importedBundleCount = Array.isArray(parsed.importedPatientBundles) ? parsed.importedPatientBundles.length : 0;
589+
const rawPatientCount = parsed.patientCount;
590+
const parsedPatientCount = typeof rawPatientCount === 'number'
591+
? rawPatientCount
592+
: Number.parseFloat(String(rawPatientCount ?? '0'));
593+
const basePatientCount = Number.isFinite(parsedPatientCount) ? parsedPatientCount : 0;
594+
const effectivePatientCount = basePatientCount + importedIdCount + importedBundleCount;
595+
596+
function formatArrayItem(item, key, index) {
597+
if (item === null || item === undefined) return '';
598+
if (typeof item !== 'object') return escapeHtml(String(item));
599+
600+
if (key === 'importedPatientIds') {
601+
const patientId = item.patientId || item.PatientId;
602+
return escapeHtml(String(patientId || `Patient ${index + 1}`));
603+
}
604+
605+
if (key === 'importedPatientBundles') {
606+
const fileName = item.fileName || item.FileName;
607+
const patientId = item.patientId || item.PatientId;
608+
return escapeHtml(String(fileName || patientId || `Bundle ${index + 1}`));
609+
}
610+
611+
const fallback = item.name ?? item.id ?? item.patientId ?? item.fileName;
612+
if (fallback !== undefined && fallback !== null)
613+
return escapeHtml(String(fallback));
614+
615+
try { return escapeHtml(JSON.stringify(item)); }
616+
catch { return escapeHtml(String(item)); }
617+
}
618+
587619
// Keys rendered elsewhere or otherwise not surfaced as plain key/value pairs.
588620
const skip = new Set([
589621
'id', 'isSystemScenario',
@@ -599,6 +631,8 @@
599631
selectedMeasures: 'Measures',
600632
seed: 'Seed',
601633
patientCount: 'Patients',
634+
importedPatientIds: 'Imported Patient IDs',
635+
importedPatientBundles: 'Imported Patient Bundles',
602636
queryPlanTemplateName: 'Query Plan',
603637
cleanupServiceData: 'Cleanup Service Data',
604638
cleanupFhirData: 'Cleanup FHIR Data'
@@ -614,8 +648,10 @@
614648
if (k === 'selectedMeasures') {
615649
display = v.map(m => escapeHtml(measureShortNames[m] || toLabel(m))).join(', ');
616650
} else {
617-
display = v.map(item => escapeHtml(String(item))).join(', ');
651+
display = v.map((item, index) => formatArrayItem(item, k, index)).join(', ');
618652
}
653+
} else if (k === 'patientCount') {
654+
display = escapeHtml(String(effectivePatientCount));
619655
} else if (typeof v === 'boolean') {
620656
display = v ? '<i class="bi bi-check-circle-fill text-success"></i> Yes' : '<i class="bi bi-x-circle text-muted"></i> No';
621657
} else if (typeof v === 'object') {

0 commit comments

Comments
 (0)