Spivey.Health 1.0.3

dotnet add package Spivey.Health --version 1.0.3
NuGet\Install-Package Spivey.Health -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Spivey.Health" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Spivey.Health --version 1.0.3
#r "nuget: Spivey.Health, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Spivey.Health as a Cake Addin
#addin nuget:?package=Spivey.Health&version=1.0.3

// Install Spivey.Health as a Cake Tool
#tool nuget:?package=Spivey.Health&version=1.0.3

Spivey.Health

A c# package to efficiently store health data imported from different sources, so that you can analyze it. For example, heart, nutrition and other measurements from Apple Health export files.

  • AppleHealthFileReader can be used to read an Apple Health export zip file that contains all of your health data in XML format. That data can then be transformed into normalized Spivey.Health DataLists.

Usage

Produce Scatter Plot and Aggregate Minimum by Day

DateTime startDate = new DateTime(2023, 3, 20);
DateTime endDate = new DateTime(2023, 3, 22);
string labelX = "Label X";
string labelY = "Label Y";
string typeX = "Type X";
string typeY = "Type Y";
var dataListX = new DataList<double?>
{
    Values = new DataValue<double?>[]
    {
        new DataValue<double?> { Date = startDate, Value = 1 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 2 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 3 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 4 },
    }
};
var dataListY = new DataList<double?>
{
    Values = new DataValue<double?>[]
    {
        new DataValue<double?> { Date = startDate, Value = 10 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 20 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 30 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 40 },
        new DataValue<double?> { Date = endDate, Value = 50 },
    }
};

var result = ScatterPlotDataGenerator.AggregateByDay(startDate, endDate, labelX, typeX, dataListX, labelY, typeY, dataListY, AggregateOperator.Min);

Result

Date X Y
3/20/2023 1 10
3/21/2023 2 20
3/22/2023 null 50

Produce Scatter Plot and Aggregate Sum by Day and Average by Month

DateTime startDate = new DateTime(2023, 3, 30);
DateTime endDate = new DateTime(2023, 4, 1);
string labelX = "Label X";
string labelY = "Label Y";
string typeX = "Type X";
string typeY = "Type Y";
var dataListX = new DataList<double?>
{
    Values = new DataValue<double?>[]
    {
        new DataValue<double?> { Date = startDate, Value = 1 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 2 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 3 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 4 },
        new DataValue<double?> { Date = endDate, Value = 6 },
    }
};
var dataListY = new DataList<double?>
{
    Values = new DataValue<double?>[]
    {
        new DataValue<double?> { Date = startDate, Value = 10 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 20 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 30 },
        new DataValue<double?> { Date = startDate.AddDays(1), Value = 40 },
        new DataValue<double?> { Date = endDate, Value = 51 },
    }
};

var result = ScatterPlotDataGenerator.AggregateByMonth(startDate, endDate, labelX, typeX, dataListX, labelY, typeY, dataListY, dayAggregateOperator: AggregateOperator.Sum, monthAggregateOperator: AggregateOperator.Average);

Result

Date X Y
3/1/2023 5 50
4/1/2023 6 51

Calculate Pearson Correlation

var x = new double[] { 3, 4, 5, 8, 1, 0 };
var y = new double[] { 1, 1.1, 1.2, 1.4, 0.9, 0.8 };
var result = PearsonCorrelation.Calculate(x, y); //0.99620622877904863
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 202 4/2/2023
1.0.2 166 4/2/2023
1.0.1 172 3/31/2023
1.0.0 185 3/19/2023