=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===

This commit is contained in:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -26,6 +26,7 @@ public class CalculatedObservationsTest
/// <summary>
/// Initializes mocked dependencies and configures the dependency injection container required to instantiate the <see cref="CalculatedObservations"/> service under test.
/// </summary>
/// <!-- aidoc:v1 sig=dee8bf2 body=d74ae8f -->
[SetUp]
public void Setup()
{
@@ -114,6 +115,7 @@ public class CalculatedObservationsTest
/// <summary>
/// Verifies that a PatientObservation with the ventilation mode "PRVC" is mapped to a calculated observation with the value "VCRP".
/// </summary>
/// <!-- aidoc:v1 sig=eb9f8ec body=e44fb52 -->
[Test]
public async Task Calculate_Ventilation_Mode_PRVC_Returns_VCRP()
{
@@ -137,6 +139,7 @@ public class CalculatedObservationsTest
/// Verifies that the calculated observations mapping translates the ventilation mode value "FLUJ.ALTO" (High Flow) into the respiratory support code "OAF".
/// Ensures that a patient observation with the name "Resp_Mode" and value "FLUJ.ALTO" produces a non-null mapped result with the expected output value.
/// </summary>
/// <!-- aidoc:v1 sig=76d5e48 body=d17dc11 -->
[Test]
public async Task Calculate_Ventilation_Mode_FLUJ_ALTO_Returns_OAF()
{
@@ -159,6 +162,7 @@ public class CalculatedObservationsTest
/// <summary>
/// Verifies that when a patient observation's respiratory mode is neither "PRVC" nor "FLUJ_ALTO" (for example, "VNI PC"), the calculated observation is not mapped to "VCRP" or "OAF".
/// </summary>
/// <!-- aidoc:v1 sig=44eb476 body=279d733 -->
[Test]
public async Task Calculate_Ventilation_Mode_Not_PRVC_Not_FLUJ_ALTO_Returns_Other()
{
@@ -188,6 +192,7 @@ public class CalculatedObservationsTest
/// Verifies that the calculated observations mapping does not produce a Sattc_FiO2 observation
/// when the Sattc value is 98, ensuring the calculation is suppressed for this specific input case.
/// </summary>
/// <!-- aidoc:v1 sig=c417ee7 body=b77cd07 -->
[Test]
public async Task CalculateSF_Sattc_98_Returns_Not_Sattc_FiO2()
{
@@ -239,6 +244,7 @@ public class CalculatedObservationsTest
/// Verifies that when an FiO2 observation is processed, the Oxygenation Index is calculated and inserted
/// using the related P_VAM and PaO2_Tidal observations retrieved for the same patient.
/// </summary>
/// <!-- aidoc:v1 sig=3315812 body=f686108 -->
[Test]
public async Task CalculateOxygenationIndex_FiO2_Returns_Oxygenation_Index()
{
@@ -297,6 +303,7 @@ public class CalculatedObservationsTest
/// (computed as <c>P_VAM × FiO2 × 100 / PaO2</c>) that is inserted through the observation service for the same patient.
/// </summary>
/// <returns>A task that completes when the expected <c>Oxygenation_Index</c> observation has been inserted via the mocked observation service.</returns>
/// <!-- aidoc:v1 sig=da07bc9 body=502f5d7 -->
[Test]
public async Task CalculateOxygenationIndex_P_VAM_Returns_Oxygenation_Index()
{
@@ -353,6 +360,7 @@ public class CalculatedObservationsTest
/// <summary>
/// Verifies that when a PaO2_Tidal observation is mapped, the calculated Oxygenation_Index is derived using the formula P_VAM * FiO2 * 100 / PaO2_Tidal and persisted as an ADAS-coded observation for the same patient.
/// </summary>
/// <!-- aidoc:v1 sig=d5e69ac body=9ff274d -->
[Test]
public async Task CalculateOxygenationIndex_PaO2_Tidal_Returns_Oxygenation_Index()
{
@@ -411,6 +419,8 @@ public class CalculatedObservationsTest
/// is missing from the patient's most recent observations, even when a PaO2_Tidal observation is provided.
/// Ensures that the mapping logic does not insert a new Oxygenation_Index observation in this scenario.
/// </summary>
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
/// "The doc states FiO2 is missing from recent observations, but the code mocks FindLastObservations to return FiO2 (it is present); PaO2_Tidal is the observation missing from the recent observations." -->
[Test]
public async Task CalculateOxygenationIndex_PaO2_Tidal_Not_Returns_Oxygenation_Index()
{
@@ -456,6 +466,7 @@ public class CalculatedObservationsTest
/// Verifies that the Oxygenation_Index is not calculated or persisted when the PaO2_Tidal observation value is zero.
/// Ensures that the mapping logic skips downstream calculation and InsertObservation is never invoked in this edge case.
/// </summary>
/// <!-- aidoc:v1 sig=b4705b3 body=72f7967 -->
[Test]
public async Task CalculateOxygenationIndex_PaO2_Tidal_0_Not_Returns_Oxygenation_Index()
{
@@ -513,6 +524,7 @@ public class CalculatedObservationsTest
/// by dividing the PaO2 value by the most recent FiO2 observation for the patient and inserting the result as a new
/// PatientObservation with the ADAS coding system.
/// </summary>
/// <!-- aidoc:v1 sig=087da9c body=91ce4a0 -->
[Test]
public async Task CalculatePF_PaO2_Returns_PaO2_FiO2()
{
@@ -566,6 +578,7 @@ public class CalculatedObservationsTest
/// when an FiO2 observation is processed, by inserting a new patient observation with the
/// expected ratio value and coding system.
/// </summary>
/// <!-- aidoc:v1 sig=83f8636 body=46adcbd -->
[Test]
public async Task CalculatePF_FiO2_Returns_PaO2_FiO2()
{
@@ -616,6 +629,7 @@ public class CalculatedObservationsTest
/// Verifies that the PF ratio calculation does not produce a PaO2/FiO2 observation when the FiO2 value is zero.
/// Ensures that no calculated observation is inserted for the patient under this condition.
/// </summary>
/// <!-- aidoc:v1 sig=74e2fba body=e97f55c -->
[Test]
public async Task CalculatePF_FiO2_0_Not_Returns_PaO2_FiO2()
{
@@ -661,6 +675,7 @@ public class CalculatedObservationsTest
/// <summary>
/// Verifies that when patient observations include a low SpO2 (Sattc) value of 50 and a low FC value of 50, the calculated observations processing triggers a BlueCode alarm by inserting the observation and sending the alarm.
/// </summary>
/// <!-- aidoc:v1 sig=cb9af03 body=d68c56c -->
[Test]
public async Task
SendAlarm_BlueCode_FC_SpO2_Alarm_True_Returns_SendAlarm_BlueCode()
@@ -707,6 +722,7 @@ public class CalculatedObservationsTest
/// Verifies that when a BlueCode alarm condition is triggered by FC and TAm observations, the calculated blue code list is generated, the observation is inserted, and the blue code alarm is sent with the expected severity and type.
/// </summary>
/// <returns>A task that completes when the blue code alarm verification has been executed.</returns>
/// <!-- aidoc:v1 sig=8d996ea body=861269c -->
[Test]
public async Task
SendAlarm_BlueCode_FC_TAm_Alarm_True_Returns_SendAlarm_BlueCode()
@@ -769,6 +785,7 @@ public class CalculatedObservationsTest
/// <summary>
/// Verifies that a BlueCode alarm is not triggered when the heart rate (FC) is at 50 and the mean arterial pressure (TAm) values do not meet the BlueCode criteria.
/// </summary>
/// <!-- aidoc:v1 sig=593d4af body=9dce27f -->
[Test]
public async Task SendAlarm_BlueCode_FC_TAm_Alarm_False()
{
@@ -833,6 +850,7 @@ public class CalculatedObservationsTest
/// </summary>
/// <param name="value">The object whose string representation will be converted to a double.</param>
/// <returns>The parsed <see cref="double"/> value if the conversion succeeds; otherwise, <see langword="null"/>.</returns>
/// <!-- aidoc:v1 sig=a1cea6b body=2180954 -->
private static double? TryparseDouble(object value)
{
return double.TryParse(value.ToString(), out var valueParsed) ? valueParsed : null;
@@ -951,6 +969,7 @@ public class CalculatedObservationsTest
/// <summary>
/// Verifies that a <see cref="PatientObservation"/> representing a pump volumetric air occlusion alarm is correctly mapped by the calculated observations mapper, returning a non-null result with a matching name.
/// </summary>
/// <!-- aidoc:v1 sig=6fdcb6b body=3319cdd -->
[Test]
public async Task Map_PatientObservation_Alarm_Pump_Retur_obs()
{