Local DLL Integration

From Endeavour Knowledge Base
  1. Create a new console app, targeting .NET Core 6.0
  2. Add a reference to the EP_Qrisk3.ddl and the ep_models.dll supplied by Endeavour Predict
  3. Replace the contents of the program.cs file with the following
    using ep_models;
    using EP_QRisk3;
    using static Core.EPStandardDefinitions;
    using static ep_models.EngineResultModel;
    
    EP_QRisk3.Controller controller = new EP_QRisk3.Controller();
    
    var model = new EPInputModel();
    model.age = 33;
    model.CVD = false;
    model.sex = Core.EPStandardDefinitions.Gender.Male;
    model.requestedEngines = new List<Core.EPStandardDefinitions.Engines>();
    model.requestedEngines.Add(Engines.QRisk3);
    
    var result = controller.GetScore(EPInputModel: model);
    var firstResult = result.EngineResults.First();
    Console.WriteLine("Engine Name: " + firstResult.EngineName);
    Console.WriteLine("Engine Version: " + firstResult.EngineVersion);
    
    foreach (var predictionResult in firstResult.Results)
    {
        Console.WriteLine("------------------------");
        Console.WriteLine("Score Id: " + predictionResult.id);
        Console.WriteLine("Score value: " + predictionResult.score);
        Console.WriteLine("Score typical: " + predictionResult.typicalScore);
    }
    Console.WriteLine("------------------------");
    Console.WriteLine("Press any key to finish.");
    Console.ReadKey();
    
  4. Run the program, you should see the following output
    Engine Name: QRisk3
    Engine Version: QRISK3 algorithm v. 2018.0
    ------------------------
    Score Id: http://endhealth.info/im#QRisk3
    Score value: 0.587566
    Score typical: 0.49
    ------------------------
    Score Id: http://endhealth.info/im#QRisk3HeartAge
    Score value: 35
    Score typical:
    ------------------------
    Press any key to finish