Table of Contents

Class CalculatedObservationsTest

Namespace
adas_core.Test.Customizations.HUVH.UCIN
Assembly
adas-core.Test.dll
[TestFixture]
public class CalculatedObservationsTest
Inheritance
CalculatedObservationsTest
Inherited Members
Extension Methods

Methods

CalculateSaturation_DiffObservation_WhenOnlyPostObservationExists_DoesNotInsertNewObservations()

[Test]
public Task CalculateSaturation_DiffObservation_WhenOnlyPostObservationExists_DoesNotInsertNewObservations()

Returns

Task

CalculateSaturation_DiffObservation_WhenOnlyPreObservationExists_DoesNotInsertNewObservations()

[Test]
public Task CalculateSaturation_DiffObservation_WhenOnlyPreObservationExists_DoesNotInsertNewObservations()

Returns

Task

CalculateSaturation_DiffObservation_WhenPostObservationExistsAndPreIsFound_InsertsDiffAndPrePost()

[Test]
public Task CalculateSaturation_DiffObservation_WhenPostObservationExistsAndPreIsFound_InsertsDiffAndPrePost()

Returns

Task

CalculateSaturation_DiffObservation_WhenPreObservationExistsAndPostIsFound_InsertsDiffAndPrePost()

[Test]
public Task CalculateSaturation_DiffObservation_WhenPreObservationExistsAndPostIsFound_InsertsDiffAndPrePost()

Returns

Task

CalculateSaturation_DiffObservation_WithDifferentPrePostValues_CalculatesCorrectDifference()

[Test]
public Task CalculateSaturation_DiffObservation_WithDifferentPrePostValues_CalculatesCorrectDifference()

Returns

Task

CalculateSaturation_DiffObservation_WithNonNumericPreValue_TreatsAsZero()

[Test]
public Task CalculateSaturation_DiffObservation_WithNonNumericPreValue_TreatsAsZero()

Returns

Task

Map_TreatmentWithActiveOlderTreatments_SetsOrderControlToXO()

Verifies that mapping a treatment which has active older treatments sets the order control to XO (cancel as a result of a new order being accepted) and does not insert a new observation.

[Test]
public Task Map_TreatmentWithActiveOlderTreatments_SetsOrderControlToXO()

Returns

Task

Map_TreatmentWithEndTimeSet_OverridesOrderControlFromOldTreatments()

[Test]
public Task Map_TreatmentWithEndTimeSet_OverridesOrderControlFromOldTreatments()

Returns

Task

Map_TreatmentWithEndTimeSet_SetsOrderControlToDC()

Verifies that when a patient treatment has an end time set, mapping it sets the order control to Dc and does not insert a new observation.

[Test]
public Task Map_TreatmentWithEndTimeSet_SetsOrderControlToDC()

Returns

Task

Map_TreatmentWithMedication_InsertObservation()

[Test]
public Task Map_TreatmentWithMedication_InsertObservation()

Returns

Task

Map_TreatmentWithNoActiveOlderTreatments_SetsOrderControlToNW()

Verifies that when mapping a patient treatment with no active older treatments, the resulting order control is set to Nw and no patient observation is inserted.

[Test]
public Task Map_TreatmentWithNoActiveOlderTreatments_SetsOrderControlToNW()

Returns

Task

Map_TreatmentWithNoPlacerOrder_ReturnsOriginalTreatment()

Verifies that mapping a patient treatment with no placer order returns the original treatment unchanged.

[Test]
public Task Map_TreatmentWithNoPlacerOrder_ReturnsOriginalTreatment()

Returns

Task

Map_WithInterventionCodeInObservationValue_CallsCalculateInterventionMultiValueObservation()

Verifies that when an observation contains an intervention code (e.g., "204") that exists in the data, the Map method creates and inserts a multivalue observation (Respiratory_Device_Multivalue) containing the intervention description extracted from the observation value.

[Test]
public Task Map_WithInterventionCodeInObservationValue_CallsCalculateInterventionMultiValueObservation()

Returns

Task

Map_WithInterventionOut_UpdatesExistingMultiValueObservation()

Verifies that mapping an Intervention_Out observation updates an existing active multi-value observation (e.g., Respiratory_Device_Multivalue) for the patient by setting its end time, rather than inserting a new observation.

[Test]
public Task Map_WithInterventionOut_UpdatesExistingMultiValueObservation()

Returns

Task

Map_WithIntravenousRoutesAndRespiratoryDeviceMultiValueObservation_CalculatesComplexity_Return5()

[Test]
public Task Map_WithIntravenousRoutesAndRespiratoryDeviceMultiValueObservation_CalculatesComplexity_Return5()

Returns

Task

Map_WithNewInterventionAddsToExistingMultiValueObservation()

[Test]
public Task Map_WithNewInterventionAddsToExistingMultiValueObservation()

Returns

Task

Map_WithNewInterventionNoExistingLastIntervention_NewMultiValueObservation()

[Test]
public Task Map_WithNewInterventionNoExistingLastIntervention_NewMultiValueObservation()

Returns

Task

Map_WithNewbornWeightObservation_CalculatesComplexity_Return4()

[Test]
public Task Map_WithNewbornWeightObservation_CalculatesComplexity_Return4()

Returns

Task

Map_WithRespiratoryDeviceMultiValueObservation_CallsCalculateComplexity_Return1()

Verifies that the Map(PatientTreatment) method, when invoked with a respiratory device multivalue observation and no prior observations, inserts a "Complexity" observation with a value of 1.

[Test]
public Task Map_WithRespiratoryDeviceMultiValueObservation_CallsCalculateComplexity_Return1()

Returns

Task

Map_WithSurgeryMedicationMewbornWeightMultiValueObservation_CalculatesComplexity_Returns13()

Verifies that the Map method correctly calculates a complexity value of 13 when the input observation represents surgery, medication, and newborn weight data, by aggregating the per-section contribution of each observation type.

[Test]
public Task Map_WithSurgeryMedicationMewbornWeightMultiValueObservation_CalculatesComplexity_Returns13()

Returns

Task

Map_WithSurgeryObservation_HandlesNonStringValue()

Verifies that does not insert or update any observation when a surgery observation is provided with a non-string Value.

[Test]
public Task Map_WithSurgeryObservation_HandlesNonStringValue()

Returns

Task

Map_WithSurgeryObservation_InsertsNewSurgeryMultiValueObservation()

Verifies that mapping a surgery observation inserts a new Surgery_Multivalue observation when no existing multi-value observation is found, and does not trigger an update.

[Test]
public Task Map_WithSurgeryObservation_InsertsNewSurgeryMultiValueObservation()

Returns

Task

Map_WithSurgeryObservation_UpdatesExistingSurgeryMultiValueObservation()

Verifies that mapping a new surgery observation causes an existing "Surgery_Multivalue" patient observation to be expired and replaced with a new multi-value observation that contains both the previously recorded surgery value and the newly mapped surgery value.

[Test]
public Task Map_WithSurgeryObservation_UpdatesExistingSurgeryMultiValueObservation()

Returns

Task

Map_WithSurgeryObservation_UpdatesExistingSurgeryMultiValueObservation_RemovesDuplicate()

Verifies that mapping a Surgery observation updates the existing Surgery_Multivalue observation by expiring the duplicate entry and inserting a new observation with the duplicate value removed.

[Test]
public Task Map_WithSurgeryObservation_UpdatesExistingSurgeryMultiValueObservation_RemovesDuplicate()

Returns

Task

Map_WithSystemMedicationAndNewbornWeightMultiValueObservation_CalculatesComplexity_Return9()

Verifies that when a patient has a system multivalue observation, medication multivalue observations, and a newborn weight observation, the mapping process calculates a complexity value of 9 and inserts it as a new "Complexity" observation.

[Test]
public Task Map_WithSystemMedicationAndNewbornWeightMultiValueObservation_CalculatesComplexity_Return9()

Returns

Task

Map_WithTwoMedicationMultiValueObservation_CalculatesComplexity_Return4()

Verifies that mapping a patient observation with the "Medication_Multivalue" name containing two medication values ("Adrenalina" and "Dopamina") results in a new "Complexity" observation being inserted with a calculated integer value of 4, while all related observation lookups (respiratory devices, intravenous routes, system, newborn weight, and surgery) return empty results.

[Test]
public Task Map_WithTwoMedicationMultiValueObservation_CalculatesComplexity_Return4()

Returns

Task

Setup()

[SetUp]
public void Setup()