Biostatistics.Contracts 0.136.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Biostatistics.Contracts --version 0.136.0                
NuGet\Install-Package Biostatistics.Contracts -Version 0.136.0                
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="Biostatistics.Contracts" Version="0.136.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Biostatistics.Contracts --version 0.136.0                
#r "nuget: Biostatistics.Contracts, 0.136.0"                
#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 Biostatistics.Contracts as a Cake Addin
#addin nuget:?package=Biostatistics.Contracts&version=0.136.0

// Install Biostatistics.Contracts as a Cake Tool
#tool nuget:?package=Biostatistics.Contracts&version=0.136.0                

Biostatistics

EF Core Commands

Drop Database

dotnet ef database drop --project src/Biostatistics.Infrastructure

Compile Models

dotnet ef dbcontext optimize -c BiostatisticsContext -o ../Biostatistics.Infrastructure/Database/CompiledModels -n Biostatistics.Infrastructure.Database.CompileModels --project src/Biostatistics.Infrastructure --nativeaot

Add Migrations

dotnet ef migrations add <migrationName> --project src/Biostatistics.Infrastructure

Remove Migrations

dotnet ef migrations remove --project src/Biostatistics.Infrastructure

How to Add a Data Source

1. Add Data Source

To add a new data source, follow these steps:

  1. Open the "DataSource.json" file located in the "SeedData/Data" directory within the "Biostatistics.Seeder" project.
  2. Replace <guid>, <nameDataSource>, and <DateTimeInUtcFormat> with appropriate values in the JSON structure:
{
  "DataSourceId": "<guid>",
  "Name": "<nameDataSource>",
  "DataToggle": false,
  "RecordCount": 0,
  "LastUpdated": null,
  "OriginTimeZone": "America/Puerto_Rico",
  "CreatedAt": "<DateTimeInUtcFormat>"
}

2. Add Model

In the "Biostatistics.Domain" project, create a new model with its respective properties using the following steps:

  1. Create a new directory to contain the model.
  2. Design the model class with necessary properties. Ensure mandatory properties such as "Id" and "DataToggle" are included:
public sealed class ModelName
{
    public long Id { get; set; } // Mandatory property
    // Insert other properties
    public bool DataToggle { get; set; } // Mandatory property
}

3. Add ConfigurationModel

In the "Biostatistics.Infrastructure" project, within the "Database/Configurations" directory, add a configuration class for the previously created model using these steps:

  1. Create a class named ModelNameConfiguration implementing IEntityTypeConfiguration<ModelName>.
  2. Configure the model properties and indexes in the Configure method:
public class ModelNameConfiguration : IEntityTypeConfiguration<ModelName>
{
    public void Configure(EntityTypeBuilder<ModelName> entity)
    {
        entity.ToTable("ModelName", "SchemaName");

        entity.HasKey(e => e.Id);

        entity.HasIndex(e => e.DataToggle)
            .HasDatabaseName("ModelName_data_toggle_idx");

        // Add other indexes for other properties
    }
}

4. Add Configuration to the Database Context

Navigate to "BiostatisticsContext.cs" within the "Biostatistics.Infrastructure" project and include the following code snippet inside the class:

public sealed class BiostatisticsContext : DbContext
{
    public BiostatisticsContext(DbContextOptions<BiostatisticsContext> options)
        : base(options) {}

    public DbSet<ModelName> ModelName => Set<ModelName>(); // Add this command
    //... other code
}

In the OnModelCreating method within "BiostatisticsContext.cs", incorporate the configuration for the new model:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    // other configurations
    modelBuilder.ApplyConfiguration(new ModelNameConfiguration()); // Add this command
}

5. Add Migration

To generate a migration for the newly created model, execute the following command in the terminal:

dotnet ef migrations add <migrationName> --project src/Biostatistics.Infrastructure

Replace <migrationName> with an appropriate name for your migration.

6. Run Compiled Models

Run the compiled models

These steps will assimilate the new model configuration into the database context, create a migration, and execute the compiled models. Replace <ModelName> with your model's actual name.

7. Add ImportClient Dto

Within the "Biostatistics.ImportClient" project, generate a new record representing the previously added model, for instance:

public readonly record struct ModelNameImportDto
( 
  // Model properties
);

8. Add Function to Upload Data Source

In the "BiostatisticsImportClient.cs" file, implement the subsequent method:

public async Task<ImportResultDto> UploadDataSource(IAsyncEnumerable<ModelNameImportDto> dataList)
{
    return await UploadDataToSource(nameof(ModelNameImportDto), dataList);
}

Similarly, add the function declaration in the "BiostatisticsImportClient.cs":

Task<ImportResultDto> UploadDataSource(IAsyncEnumerable<ModelNameImportDto> dataList);

9. Update NuGet Package

Bump new project version and create a Release. This will kick off the CI/CD to publish new versions of the project Nuget package.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Biostatistics.Contracts:

Package Downloads
Biostatistics.ImportClient

Utilities to import data to Biostatistics Server

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.144.0 263 10/31/2024
0.143.0 78 10/30/2024
0.142.0 75 10/30/2024
0.141.0 81 10/30/2024
0.140.0 77 10/29/2024
0.139.0 74 10/29/2024
0.138.1 100 10/28/2024
0.138.0 82 10/28/2024
0.137.1 141 10/24/2024
0.137.0 79 10/24/2024
0.136.0 117 10/23/2024
0.135.1 84 10/23/2024
0.135.0 90 10/23/2024
0.134.3 670 9/21/2024
0.134.2 157 9/18/2024
0.134.1 102 9/17/2024
0.134.0 202 9/16/2024
0.133.0 137 9/15/2024
0.132.0 111 9/14/2024
0.131.0 118 9/14/2024
0.130.0 107 9/14/2024
0.129.1 114 9/14/2024
0.128.0 175 9/8/2024
0.127.1 182 9/7/2024
0.127.0 133 9/7/2024
0.126.0 169 9/5/2024