This page is regarding the legacy algorithm
Getting started with the ISNCSCI classification algorithm NuGet library for C# .Net
This guide explains how to call the ISNCSCI Algorithm inside a C# .NET application developed in Visual Studio. You can download the source code used in this guide.
Pre-requisites:
- Have Visual Studio installed. You can use any of the free Visual Studio Express versions.
Guide:
-
Create a new project in Visual Studio.
-
For project type, select Class Library.
-
On the Solution Explorer panel, right click on References and select Add Reference…
-
Under Assemblies, look for the library Microsoft.VisualStudio.QualityTools.UnitTestFramework and add it to the project.
-
Right click on References again but this time select Manage NuGet Packages…
-
Under nugget.org, search for Praxis ISNCSCI Algorithm. Click the Install button to add it to your project.
-
Make sure to read the license and click on I Accept to add the component to your project.
-
So far we have created a library project and we have imported the Microsoft Unit Test Framework and the Praxis ISNCSCI Algorithm library. This will allow us to generate a test class we can use to call the algorithm methods. Add the class AlgorithmTests to the project.
-
Reference both the unit testing library and the Praxis ISNCSCI Algorithm library. Then add the test method GetTotalsForNeurologyForm. Your class should look like the one in the image below:
-
Add the code below to the test method. The raw values used in the test correspond to the case ISNCSCI NT Case 2 included in the open source package.
// Arrange var neurologyForm = new NeurologyForm() { AnalContraction = BinaryObservation.No, AnalSensation = BinaryObservation.Yes }; neurologyForm.UpdateLevelAt("C2", "2", "2", "2", "2", "0", "0"); neurologyForm.UpdateLevelAt("C3", "2", "2", "2", "2", "0", "0"); neurologyForm.UpdateLevelAt("C4", "2", "2", "2", "2", "0", "0"); neurologyForm.UpdateLevelAt("C5", "2", "2", "2", "2", "5", "5"); neurologyForm.UpdateLevelAt("C6", "1", "1", "1", "0", "1", "1"); neurologyForm.UpdateLevelAt("C7", "1", "0", "1", "0", "0", "0"); neurologyForm.UpdateLevelAt("C8", "1", "0", "1", "0", "0", "0"); neurologyForm.UpdateLevelAt("T1", "1", "0", "1", "0", "0", "0"); neurologyForm.UpdateLevelAt("T2", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T3", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T4", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T5", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T6", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T7", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T8", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T9", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T10", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T11", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("T12", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("L1", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("L2", "NT", "NT", "NT", "NT", "NT", "NT"); neurologyForm.UpdateLevelAt("L3", "NT", "NT", "NT", "NT", "NT", "NT"); neurologyForm.UpdateLevelAt("L4", "NT", "NT", "NT", "NT", "NT", "NT"); neurologyForm.UpdateLevelAt("L5", "NT", "NT", "NT", "NT", "NT", "NT"); neurologyForm.UpdateLevelAt("S1", "NT", "NT", "NT", "NT", "NT", "NT"); neurologyForm.UpdateLevelAt("S2", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("S3", "NT", "NT", "NT", "NT", "0", "0"); neurologyForm.UpdateLevelAt("S4_5", "NT", "NT", "NT", "NT", "0", "0"); // Act var summary = Algorithm.GetTotalsSummaryFor(neurologyForm); // Assert Assert.AreEqual("B,C,D", summary.AsiaImpairmentScale); Assert.AreEqual("I", summary.Completeness); Assert.AreEqual("UTD", summary.LeftLowerMotorTotal); Assert.AreEqual("C5", summary.LeftMotor); Assert.AreEqual("UTD", summary.LeftMotorTotal); Assert.AreEqual("NA", summary.LeftMotorZpp); Assert.AreEqual("UTD", summary.LeftPrickTotal); Assert.AreEqual("C5", summary.LeftSensory); Assert.AreEqual("NA", summary.LeftSensoryZpp); Assert.AreEqual("UTD", summary.LeftTouchTotal); Assert.AreEqual("6", summary.LeftUpperMotorTotal); Assert.AreEqual("UTD", summary.LowerMotorTotal); Assert.AreEqual("C5", summary.NeurologicalLevelOfInjury); Assert.AreEqual("UTD", summary.PrickTotal); Assert.AreEqual("UTD", summary.RightLowerMotorTotal); Assert.AreEqual("C5", summary.RightMotor); Assert.AreEqual("UTD", summary.RightMotorTotal); Assert.AreEqual("NA", summary.RightMotorZpp); Assert.AreEqual("UTD", summary.RightPrickTotal); Assert.AreEqual("C5", summary.RightSensory); Assert.AreEqual("NA", summary.RightSensoryZpp); Assert.AreEqual("UTD", summary.RightTouchTotal); Assert.AreEqual("6", summary.RightUpperMotorTotal); Assert.AreEqual("UTD", summary.TouchTotal); Assert.AreEqual("12", summary.UpperMotorTotal);
-
Right click on the TestMethod decorator on top of the GetTotalsFormNeurologyForm method and select Run Tests to try our code.