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 here.

Pre-requisites:

Guide:

  1. Create a new project in Visual Studio.
    Figure 1
  2. For project type, select Class Library.
    Figure 2
  3. On the Solution Explorer panel, right click on References and select Add Reference…
    Figure 3
  4. Under Assemblies, look for the library Microsoft.VisualStudio.QualityTools.UnitTestFramework and add it to the project.
    Figure 4
  5. Right click on References again but this time select Manage NuGet Packages…
    Figure 5
  6. Under nugget.org, search for RHI ISNCSCI Algorithm. Click the Install button to add it to your project.
    Figure 6
  7. Make sure to read the license and click on I Accept to add the component to your project.
    Figure 7
  8. So far we have created a library project and we have imported the Microsoft Unit Test Framework and the RHI 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.
    Figure 8
  9. Reference both the unit testing library and the RHI ISNCSCI Algorithm library. Then add the test method GetTotalsForNeurologyForm. Your class should look like the one in the image below:
    Figure 9
  10. 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.
    Figure 10
    
        // 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);
                    
  11. Right click on the TestMethod decorator on top of the GetTotalsFormNeurologyForm method and select Run Tests to try our code.
    Figure 11