feat: aminecontent calibration reforge

This commit is contained in:
2026-06-17 10:31:40 +03:00
parent 0849a0ae67
commit 0676c0be75
23 changed files with 588 additions and 916 deletions
@@ -0,0 +1,43 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database;
public class BrandRecord
{
[Comment("Идентификатор")]
public int Id { get; set; }
[Comment("Уникальный идентификатор")]
[MaxLength(36)]
public string Uuid { get; set; }
[Comment("Марка пробы")]
[MaxLength(256)]
public string BrandName { get; set; }
[Comment("Название кондиционирующей смеси")]
[MaxLength(256)]
public string MixtureName { get; set; }
[Comment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)")]
public double MixtureNormalRate { get; set; }
public BrandRecord()
: this(0, null, "", "", 0)
{ }
public BrandRecord(
int id = 0,
string? uuid = null,
string brandName = "",
string mixtureName = "",
double mixtureNormalRate = 0)
{
Id = id;
if (uuid is null)
Uuid = Guid.NewGuid().ToString();
else
Uuid = uuid;
BrandName = brandName;
MixtureName = mixtureName;
MixtureNormalRate = mixtureNormalRate;
}
}
@@ -1,29 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Calibration;
public class CalibrationContext : DbContext
{
public DbSet<SeparatorRecord> SeparatorRecords => Set<SeparatorRecord>();
public DbSet<SampleRecord> SampleRecords => Set<SampleRecord>();
public DbSet<VectorRecord> VectorRecords => Set<VectorRecord>();
public CalibrationContext(DbContextOptions<CalibrationContext> options)
: base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<SeparatorRecord>()
.HasMany(x => x.VectorRecords)
.WithOne(x => x.SeparatorRecord)
.HasForeignKey(x => x.SeparatorRecordId)
.OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<SampleRecord>()
.HasMany(x => x.VectorRecords)
.WithOne(x => x.SampleRecord)
.HasForeignKey(x => x.SampleRecordId)
.OnDelete(DeleteBehavior.Cascade);
}
}
@@ -1,43 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Calibration;
public record SampleRecord
{
[Comment("Уникальный идентификатор")]
public int Id { get; set; }
[Comment("Название пробы")]
[MaxLength(256)]
public required string SampleName { get; set; }
[Comment("Дополнительная информация о пробе")]
[MaxLength(512)]
public required string SampleComment { get; set; }
[Comment("Марка пробы")]
[MaxLength(256)]
public required string SampleBrand { get; set; }
[Comment("Масса пробы (кг)")]
public required double SampleMass { get; set; }
[Comment("Дата и время отбора пробы")]
public required DateTime SamplingDateTime { get; set; }
[Comment("Место отбора пробы")]
[MaxLength(256)]
public required string SamplingPlace { get; set; }
[Comment("Название используемой кондиционирующей смеси")]
[MaxLength(256)]
public required string MixtureName { get; set; }
[Comment("Содержание аминов в кондиционирующей смеси (%)")]
public required double MixtureAmineContent { get; set; }
[Comment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)")]
public required double MixtureNormalRate { get; set; }
[Comment("Фактический расход кондиционирующей смеси (кг/т | гр/кг)")]
public required double MixtureActualRate { get; set; }
[Comment("Измеренное количество масла (кг/т | гр/кг)")]
public required double MeasuredContent { get; set; }
[Comment("Изображение")]
[MaxLength(256)]
public required string Image { get; set; }
[Comment("Векторы")]
public required List<VectorRecord> VectorRecords { get; set; } = new();
}
@@ -1,22 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Calibration;
public record SeparatorRecord
{
[Comment("Уникальный идентификатор")]
public int Id { get; set; }
[Comment("Тип сепаратора")]
[MaxLength(256)]
public required string Type { get; set; }
[Comment("Партия сепаратора")]
[MaxLength(256)]
public required string Batch { get; set; }
[Comment("Изображение")]
[MaxLength(256)]
public required string Image { get; set; }
[Comment("Векторы")]
public required List<VectorRecord> VectorRecords { get; set; } = new();
}
@@ -1,17 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Calibration;
public record VectorRecord
{
[Comment("Уникальный идентификатор")]
public int Id { get; set; }
[Comment("Значения вектора")]
public required float[] Values { get; set; }
public int? SeparatorRecordId { get; set; }
public SeparatorRecord? SeparatorRecord { get; set; }
public int? SampleRecordId { get; set; }
public SampleRecord? SampleRecord { get; set; }
}
@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database;
public class Context : DbContext
{
public DbSet<BrandRecord> BrandRecords => Set<BrandRecord>();
public DbSet<FeatureRecord> FeatureRecords => Set<FeatureRecord>();
public DbSet<ImageRecord> ImageRecords => Set<ImageRecord>();
// public DbSet<ResultRecord> ResultRecords => Set<ResultRecord>();
public DbSet<SeparatorRecord> SeparatorRecords => Set<SeparatorRecord>();
public DbSet<SampleRecord> SampleRecords => Set<SampleRecord>();
public Context(DbContextOptions<Context> options)
: base(options)
{ }
}
@@ -1,18 +1,18 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrameworkCore.Design;
namespace GSS2.Core.Analysis.AmineContent.Database.Calibration; namespace GSS2.Core.Analysis.AmineContent.Database;
public class CalibrationContextFactory : IDesignTimeDbContextFactory<CalibrationContext> public class ContextFactory : IDesignTimeDbContextFactory<Context>
{ {
public CalibrationContext CreateDbContext(string[] args) public Context CreateDbContext(string[] args)
{ {
var optionsBuilder = new DbContextOptionsBuilder<CalibrationContext>(); var optionsBuilder = new DbContextOptionsBuilder<Context>();
// Строка подключения для миграций в design-time // Строка подключения для миграций в design-time
// в runtime должна использоваться настоящая ConnectionString // в runtime должна использоваться настоящая ConnectionString
optionsBuilder.UseSqlite("Data Source=AmineContentCalibration.db"); optionsBuilder.UseSqlite("Data Source=AmineContentCalibration.db");
return new CalibrationContext(optionsBuilder.Options); return new Context(optionsBuilder.Options);
} }
} }
@@ -0,0 +1,37 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database;
public class FeatureRecord
{
[Comment("Идентификатор")]
public int Id { get; set; }
[Comment("Значения вектора")]
public List<float> Values { get; set; }
[Comment("Сепаратор")]
public int SeparatorRecordId { get; set; }
[Comment("Проба")]
public int SampleRecordId { get; set; }
public FeatureRecord()
: this(0, null, 0, 0)
{ }
public FeatureRecord(
int id = 0,
List<float>? values = null,
int separatorRecordId = 0,
int sampleRecordId = 0
)
{
Id = id;
if (values is null)
Values = new List<float>();
else
Values = values;
SeparatorRecordId = separatorRecordId;
SampleRecordId = sampleRecordId;
}
}
@@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database;
public class ImageRecord
{
[Comment("Идентификатор")]
public int Id { get; set; }
[Comment("Значения вектора")]
public string Base64 { get; set; }
public ImageRecord()
: this(0, "")
{ }
public ImageRecord(
int id = 0,
string base64 = ""
)
{
Id = id;
Base64 = base64;
}
}
@@ -1,6 +1,6 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using GSS2.Core.Analysis.AmineContent.Database.Calibration; using GSS2.Core.Analysis.AmineContent.Database;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
@@ -8,11 +8,11 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable #nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
{ {
[DbContext(typeof(CalibrationContext))] [DbContext(typeof(Context))]
[Migration("20260428223237_Calibration0")] [Migration("20260615113305_Migration0")]
partial class Calibration0 partial class Migration0
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -20,46 +20,109 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0"); modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SampleRecord", b => modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.BrandRecord", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER") .HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор"); .HasComment("Идентификатор");
b.Property<string>("Image") b.Property<string>("BrandName")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Изображение"); .HasComment("Марка пробы");
b.Property<double>("MeasuredContent")
.HasColumnType("REAL")
.HasComment("Измеренное количество масла (кг/т | гр/кг)");
b.Property<double>("MixtureActualRate")
.HasColumnType("REAL")
.HasComment("Фактический расход кондиционирующей смеси (кг/т | гр/кг)");
b.Property<double>("MixtureAmineContent")
.HasColumnType("REAL")
.HasComment("Содержание аминов в кондиционирующей смеси (%)");
b.Property<string>("MixtureName") b.Property<string>("MixtureName")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Название используемой кондиционирующей смеси"); .HasComment("Название кондиционирующей смеси");
b.Property<double>("MixtureNormalRate") b.Property<double>("MixtureNormalRate")
.HasColumnType("REAL") .HasColumnType("REAL")
.HasComment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)"); .HasComment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)");
b.Property<string>("SampleBrand") b.Property<string>("Uuid")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(36)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Марка пробы"); .HasComment("Уникальный идентификатор");
b.HasKey("Id");
b.ToTable("BrandRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.FeatureRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<int>("SampleRecordId")
.HasColumnType("INTEGER")
.HasComment("Проба");
b.Property<int>("SeparatorRecordId")
.HasColumnType("INTEGER")
.HasComment("Сепаратор");
b.PrimitiveCollection<string>("Values")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения вектора");
b.HasKey("Id");
b.ToTable("FeatureRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.ImageRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<string>("Base64")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения вектора");
b.HasKey("Id");
b.ToTable("ImageRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.SampleRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<int>("BrandId")
.HasColumnType("INTEGER")
.HasComment("Марка");
b.PrimitiveCollection<string>("FeatureIds")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Признаки");
b.Property<int>("ImageId")
.HasColumnType("INTEGER")
.HasComment("Изображение");
b.Property<double>("MeasuredContent")
.HasColumnType("REAL")
.HasComment("Измеренное количество кондиционирующей смеси (кг/т | гр/кг)");
b.Property<double>("MixtureActualRate")
.HasColumnType("REAL")
.HasComment("Фактический расход кондиционирующей смеси (кг/т | гр/кг)");
b.Property<string>("SampleComment") b.Property<string>("SampleComment")
.IsRequired() .IsRequired()
@@ -67,10 +130,6 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе"); .HasComment("Дополнительная информация о пробе");
b.Property<double>("SampleMass")
.HasColumnType("REAL")
.HasComment("Масса пробы (кг)");
b.Property<string>("SampleName") b.Property<string>("SampleName")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
@@ -79,7 +138,7 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations
b.Property<DateTime>("SamplingDateTime") b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы"); .HasComment("Дата и время отбора пробы (utc)");
b.Property<string>("SamplingPlace") b.Property<string>("SamplingPlace")
.IsRequired() .IsRequired()
@@ -87,94 +146,49 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Место отбора пробы"); .HasComment("Место отбора пробы");
b.Property<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("SampleRecords"); b.ToTable("SampleRecords");
}); });
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", b => modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.SeparatorRecord", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER") .HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор"); .HasComment("Идентификатор");
b.Property<string>("Batch") b.PrimitiveCollection<string>("FeatureIds")
.IsRequired() .IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment(артия сепаратора"); .HasComment(ризнаки");
b.Property<string>("Image") b.Property<int>("ImageId")
.IsRequired() .HasColumnType("INTEGER")
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение"); .HasComment("Изображение");
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Тип сепаратора"); .HasComment("Тип");
b.Property<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("SeparatorRecords"); b.ToTable("SeparatorRecords");
}); });
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.VectorRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<int?>("SampleRecordId")
.HasColumnType("INTEGER");
b.Property<int?>("SeparatorRecordId")
.HasColumnType("INTEGER");
b.PrimitiveCollection<string>("Values")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения вектора");
b.HasKey("Id");
b.HasIndex("SampleRecordId");
b.HasIndex("SeparatorRecordId");
b.ToTable("VectorRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.VectorRecord", b =>
{
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.SampleRecord", "SampleRecord")
.WithMany("VectorRecords")
.HasForeignKey("SampleRecordId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", "SeparatorRecord")
.WithMany("VectorRecords")
.HasForeignKey("SeparatorRecordId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("SampleRecord");
b.Navigation("SeparatorRecord");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SampleRecord", b =>
{
b.Navigation("VectorRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", b =>
{
b.Navigation("VectorRecords");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }
@@ -3,32 +3,74 @@ using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable #nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class Calibration0 : Migration public partial class Migration0 : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable(
name: "BrandRecords",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Идентификатор")
.Annotation("Sqlite:Autoincrement", true),
Uuid = table.Column<string>(type: "TEXT", maxLength: 36, nullable: false, comment: "Уникальный идентификатор"),
BrandName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Марка пробы"),
MixtureName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Название кондиционирующей смеси"),
MixtureNormalRate = table.Column<double>(type: "REAL", nullable: false, comment: "Норма расхода кондиционирующей смеси (кг/т | гр/кг)")
},
constraints: table =>
{
table.PrimaryKey("PK_BrandRecords", x => x.Id);
});
migrationBuilder.CreateTable(
name: "FeatureRecords",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Идентификатор")
.Annotation("Sqlite:Autoincrement", true),
Values = table.Column<string>(type: "TEXT", nullable: false, comment: "Значения вектора"),
SeparatorRecordId = table.Column<int>(type: "INTEGER", nullable: false, comment: "Сепаратор"),
SampleRecordId = table.Column<int>(type: "INTEGER", nullable: false, comment: "Проба")
},
constraints: table =>
{
table.PrimaryKey("PK_FeatureRecords", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ImageRecords",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Идентификатор")
.Annotation("Sqlite:Autoincrement", true),
Base64 = table.Column<string>(type: "TEXT", nullable: false, comment: "Значения вектора")
},
constraints: table =>
{
table.PrimaryKey("PK_ImageRecords", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "SampleRecords", name: "SampleRecords",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор") Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Идентификатор")
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Uuid = table.Column<string>(type: "TEXT", maxLength: 36, nullable: false, comment: "Уникальный идентификатор"),
SampleName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Название пробы"), SampleName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Название пробы"),
SampleComment = table.Column<string>(type: "TEXT", maxLength: 512, nullable: false, comment: "Дополнительная информация о пробе"), SampleComment = table.Column<string>(type: "TEXT", maxLength: 512, nullable: false, comment: "Дополнительная информация о пробе"),
SampleBrand = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Марка пробы"), SamplingDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время отбора пробы (utc)"),
SampleMass = table.Column<double>(type: "REAL", nullable: false, comment: "Масса пробы (кг)"), BrandId = table.Column<int>(type: "INTEGER", nullable: false, comment: "Марка"),
SamplingDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время отбора пробы"),
SamplingPlace = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Место отбора пробы"), SamplingPlace = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Место отбора пробы"),
MixtureName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Название используемой кондиционирующей смеси"),
MixtureAmineContent = table.Column<double>(type: "REAL", nullable: false, comment: "Содержание аминов в кондиционирующей смеси (%)"),
MixtureNormalRate = table.Column<double>(type: "REAL", nullable: false, comment: "Норма расхода кондиционирующей смеси (кг/т | гр/кг)"),
MixtureActualRate = table.Column<double>(type: "REAL", nullable: false, comment: "Фактический расход кондиционирующей смеси (кг/т | гр/кг)"), MixtureActualRate = table.Column<double>(type: "REAL", nullable: false, comment: "Фактический расход кондиционирующей смеси (кг/т | гр/кг)"),
MeasuredContent = table.Column<double>(type: "REAL", nullable: false, comment: "Измеренное количество масла (кг/т | гр/кг)"), MeasuredContent = table.Column<double>(type: "REAL", nullable: false, comment: "Измеренное количество кондиционирующей смеси (кг/т | гр/кг)"),
Image = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Изображение") ImageId = table.Column<int>(type: "INTEGER", nullable: false, comment: "Изображение"),
FeatureIds = table.Column<string>(type: "TEXT", nullable: false, comment: "Признаки")
}, },
constraints: table => constraints: table =>
{ {
@@ -39,60 +81,30 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations
name: "SeparatorRecords", name: "SeparatorRecords",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор") Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Идентификатор")
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
Type = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Тип сепаратора"), Uuid = table.Column<string>(type: "TEXT", maxLength: 36, nullable: false, comment: "Уникальный идентификатор"),
Batch = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Партия сепаратора"), Type = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Тип"),
Image = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Изображение") ImageId = table.Column<int>(type: "INTEGER", nullable: false, comment: "Изображение"),
FeatureIds = table.Column<string>(type: "TEXT", nullable: false, comment: "Признаки")
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_SeparatorRecords", x => x.Id); table.PrimaryKey("PK_SeparatorRecords", x => x.Id);
}); });
migrationBuilder.CreateTable(
name: "VectorRecords",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор")
.Annotation("Sqlite:Autoincrement", true),
SeparatorRecordId = table.Column<int>(type: "INTEGER", nullable: true),
SampleRecordId = table.Column<int>(type: "INTEGER", nullable: true),
Values = table.Column<string>(type: "TEXT", nullable: false, comment: "Значения вектора")
},
constraints: table =>
{
table.PrimaryKey("PK_VectorRecords", x => x.Id);
table.ForeignKey(
name: "FK_VectorRecords_SampleRecords_SampleRecordId",
column: x => x.SampleRecordId,
principalTable: "SampleRecords",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_VectorRecords_SeparatorRecords_SeparatorRecordId",
column: x => x.SeparatorRecordId,
principalTable: "SeparatorRecords",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_VectorRecords_SampleRecordId",
table: "VectorRecords",
column: "SampleRecordId");
migrationBuilder.CreateIndex(
name: "IX_VectorRecords_SeparatorRecordId",
table: "VectorRecords",
column: "SeparatorRecordId");
} }
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "VectorRecords"); name: "BrandRecords");
migrationBuilder.DropTable(
name: "FeatureRecords");
migrationBuilder.DropTable(
name: "ImageRecords");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "SampleRecords"); name: "SampleRecords");
@@ -1,62 +1,125 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using GSS2.Core.Analysis.AmineContent.Database.Calibration; using GSS2.Core.Analysis.AmineContent.Database;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable #nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
{ {
[DbContext(typeof(CalibrationContext))] [DbContext(typeof(Context))]
partial class CalibrationContextModelSnapshot : ModelSnapshot partial class ContextModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0"); modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SampleRecord", b => modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.BrandRecord", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER") .HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор"); .HasComment("Идентификатор");
b.Property<string>("Image") b.Property<string>("BrandName")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Изображение"); .HasComment("Марка пробы");
b.Property<double>("MeasuredContent")
.HasColumnType("REAL")
.HasComment("Измеренное количество масла (кг/т | гр/кг)");
b.Property<double>("MixtureActualRate")
.HasColumnType("REAL")
.HasComment("Фактический расход кондиционирующей смеси (кг/т | гр/кг)");
b.Property<double>("MixtureAmineContent")
.HasColumnType("REAL")
.HasComment("Содержание аминов в кондиционирующей смеси (%)");
b.Property<string>("MixtureName") b.Property<string>("MixtureName")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Название используемой кондиционирующей смеси"); .HasComment("Название кондиционирующей смеси");
b.Property<double>("MixtureNormalRate") b.Property<double>("MixtureNormalRate")
.HasColumnType("REAL") .HasColumnType("REAL")
.HasComment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)"); .HasComment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)");
b.Property<string>("SampleBrand") b.Property<string>("Uuid")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(36)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Марка пробы"); .HasComment("Уникальный идентификатор");
b.HasKey("Id");
b.ToTable("BrandRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.FeatureRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<int>("SampleRecordId")
.HasColumnType("INTEGER")
.HasComment("Проба");
b.Property<int>("SeparatorRecordId")
.HasColumnType("INTEGER")
.HasComment("Сепаратор");
b.PrimitiveCollection<string>("Values")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения вектора");
b.HasKey("Id");
b.ToTable("FeatureRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.ImageRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<string>("Base64")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения вектора");
b.HasKey("Id");
b.ToTable("ImageRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.SampleRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<int>("BrandId")
.HasColumnType("INTEGER")
.HasComment("Марка");
b.PrimitiveCollection<string>("FeatureIds")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Признаки");
b.Property<int>("ImageId")
.HasColumnType("INTEGER")
.HasComment("Изображение");
b.Property<double>("MeasuredContent")
.HasColumnType("REAL")
.HasComment("Измеренное количество кондиционирующей смеси (кг/т | гр/кг)");
b.Property<double>("MixtureActualRate")
.HasColumnType("REAL")
.HasComment("Фактический расход кондиционирующей смеси (кг/т | гр/кг)");
b.Property<string>("SampleComment") b.Property<string>("SampleComment")
.IsRequired() .IsRequired()
@@ -64,10 +127,6 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе"); .HasComment("Дополнительная информация о пробе");
b.Property<double>("SampleMass")
.HasColumnType("REAL")
.HasComment("Масса пробы (кг)");
b.Property<string>("SampleName") b.Property<string>("SampleName")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
@@ -76,7 +135,7 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations
b.Property<DateTime>("SamplingDateTime") b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы"); .HasComment("Дата и время отбора пробы (utc)");
b.Property<string>("SamplingPlace") b.Property<string>("SamplingPlace")
.IsRequired() .IsRequired()
@@ -84,94 +143,49 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Calibration.Migrations
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Место отбора пробы"); .HasComment("Место отбора пробы");
b.Property<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("SampleRecords"); b.ToTable("SampleRecords");
}); });
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", b => modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.SeparatorRecord", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER") .HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор"); .HasComment("Идентификатор");
b.Property<string>("Batch") b.PrimitiveCollection<string>("FeatureIds")
.IsRequired() .IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment(артия сепаратора"); .HasComment(ризнаки");
b.Property<string>("Image") b.Property<int>("ImageId")
.IsRequired() .HasColumnType("INTEGER")
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение"); .HasComment("Изображение");
b.Property<string>("Type") b.Property<string>("Type")
.IsRequired() .IsRequired()
.HasMaxLength(256) .HasMaxLength(256)
.HasColumnType("TEXT") .HasColumnType("TEXT")
.HasComment("Тип сепаратора"); .HasComment("Тип");
b.Property<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("SeparatorRecords"); b.ToTable("SeparatorRecords");
}); });
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.VectorRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<int?>("SampleRecordId")
.HasColumnType("INTEGER");
b.Property<int?>("SeparatorRecordId")
.HasColumnType("INTEGER");
b.PrimitiveCollection<string>("Values")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения вектора");
b.HasKey("Id");
b.HasIndex("SampleRecordId");
b.HasIndex("SeparatorRecordId");
b.ToTable("VectorRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.VectorRecord", b =>
{
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.SampleRecord", "SampleRecord")
.WithMany("VectorRecords")
.HasForeignKey("SampleRecordId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", "SeparatorRecord")
.WithMany("VectorRecords")
.HasForeignKey("SeparatorRecordId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("SampleRecord");
b.Navigation("SeparatorRecord");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SampleRecord", b =>
{
b.Navigation("VectorRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Calibration.SeparatorRecord", b =>
{
b.Navigation("VectorRecords");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }
@@ -0,0 +1,60 @@
// using System.ComponentModel.DataAnnotations;
// using Microsoft.EntityFrameworkCore;
// namespace GSS2.Core.Analysis.AmineContent.Database;
// public class ResultRecord
// {
// [Comment("Идентификатор")]
// public int Id { get; set; }
// [Comment("Уникальный идентификатор")]
// [MaxLength(36)]
// public required string Uuid { get; set; }
// [Comment("Название пробы")]
// [MaxLength(256)]
// public required string SampleName { get; set; }
// [Comment("Дополнительная информация о пробе")]
// [MaxLength(512)]
// public required string SampleComment { get; set; }
// [Comment("Дата и время отбора пробы")]
// public required DateTime SamplingDateTime { get; set; }
// [Comment("Место отбора пробы")]
// [MaxLength(256)]
// public required string SamplingPlace { get; set; }
// [Comment("Изображение")]
// [MaxLength(256)]
// public required string Image { get; set; }
// [Comment("Тип сепаратора")]
// [MaxLength(256)]
// public required string SeparatorType { get; set; }
// [Comment("Марка пробы")]
// [MaxLength(256)]
// public required string SampleBrand { get; set; }
// [Comment("Маска")]
// [MaxLength(256)]
// public required string MaskImage { get; set; }
// [Comment("Изображение результата")]
// [MaxLength(256)]
// public required string ResultImage { get; set; }
// [Comment("Минимальное значение")]
// public required double MinValue { get; set; }
// [Comment("Максимальное значение")]
// public required double MaxValue { get; set; }
// [Comment("Количество частиц")]
// public required int ParticlesCount { get; set; }
// [Comment("Среднее значение")]
// public required double MeanValue { get; set; }
// [Comment("Средняя дисперсия")]
// public required double MeanVariance { get; set; }
// [Comment("Дисперсия среднего")]
// public required double VarianceOfMean { get; set; }
// [Comment("Среднее качество обработки")]
// public required double? MeanQuality { get; set; }
// [Comment("Средние значения")]
// public required double[] MeanValues { get; set; }
// [Comment("Дисперсии")]
// public required double[] Variances { get; set; }
// [Comment("Качества обработки")]
// public required double[]? Qualities { get; set; }
// }
@@ -1,123 +0,0 @@
// <auto-generated />
using System;
using GSS2.Core.Analysis.AmineContent.Database.Results;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
[DbContext(typeof(ResultsContext))]
[Migration("20260429070705_Results0")]
partial class Results0
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.ResultRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<string>("Image")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение");
b.Property<string>("MaskImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Маска");
b.Property<double>("MaxValue")
.HasColumnType("REAL")
.HasComment("Максимальное значение");
b.Property<double>("MeanValue")
.HasColumnType("REAL")
.HasComment("Среднее значение");
b.PrimitiveCollection<string>("MeanValues")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Средние значения");
b.Property<double>("MeanVariance")
.HasColumnType("REAL")
.HasComment("Средняя дисперсия");
b.Property<double>("MinValue")
.HasColumnType("REAL")
.HasComment("Минимальное значение");
b.Property<int>("ParticlesCount")
.HasColumnType("INTEGER")
.HasComment("Количество частиц");
b.Property<string>("ResultImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение результата");
b.Property<string>("SampleBrand")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("SampleComment")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
b.Property<string>("SampleName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название пробы");
b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы");
b.Property<string>("SamplingPlace")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Место отбора пробы");
b.Property<string>("SeparatorType")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Тип сепаратора");
b.Property<double>("VarianceOfMean")
.HasColumnType("REAL")
.HasComment("Дисперсия среднего");
b.PrimitiveCollection<string>("Variances")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Дисперсии");
b.HasKey("Id");
b.ToTable("ResultRecords");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,51 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
/// <inheritdoc />
public partial class Results0 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ResultRecords",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Уникальный идентификатор")
.Annotation("Sqlite:Autoincrement", true),
SampleName = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Название пробы"),
SampleComment = table.Column<string>(type: "TEXT", maxLength: 512, nullable: false, comment: "Дополнительная информация о пробе"),
SamplingDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время отбора пробы"),
SamplingPlace = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Место отбора пробы"),
Image = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Изображение"),
SeparatorType = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Тип сепаратора"),
SampleBrand = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Марка пробы"),
MaskImage = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Маска"),
ResultImage = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Изображение результата"),
MinValue = table.Column<double>(type: "REAL", nullable: false, comment: "Минимальное значение"),
MaxValue = table.Column<double>(type: "REAL", nullable: false, comment: "Максимальное значение"),
ParticlesCount = table.Column<int>(type: "INTEGER", nullable: false, comment: "Количество частиц"),
MeanValue = table.Column<double>(type: "REAL", nullable: false, comment: "Среднее значение"),
MeanVariance = table.Column<double>(type: "REAL", nullable: false, comment: "Средняя дисперсия"),
VarianceOfMean = table.Column<double>(type: "REAL", nullable: false, comment: "Дисперсия среднего"),
MeanValues = table.Column<string>(type: "TEXT", nullable: false, comment: "Средние значения"),
Variances = table.Column<string>(type: "TEXT", nullable: false, comment: "Дисперсии")
},
constraints: table =>
{
table.PrimaryKey("PK_ResultRecords", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ResultRecords");
}
}
}
@@ -1,131 +0,0 @@
// <auto-generated />
using System;
using GSS2.Core.Analysis.AmineContent.Database.Results;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
[DbContext(typeof(ResultsContext))]
[Migration("20260608053836_Results1")]
partial class Results1
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.ResultRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<string>("Image")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение");
b.Property<string>("MaskImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Маска");
b.Property<double>("MaxValue")
.HasColumnType("REAL")
.HasComment("Максимальное значение");
b.Property<double?>("MeanQuality")
.HasColumnType("REAL")
.HasComment("Среднее качество обработки");
b.Property<double>("MeanValue")
.HasColumnType("REAL")
.HasComment("Среднее значение");
b.PrimitiveCollection<string>("MeanValues")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Средние значения");
b.Property<double>("MeanVariance")
.HasColumnType("REAL")
.HasComment("Средняя дисперсия");
b.Property<double>("MinValue")
.HasColumnType("REAL")
.HasComment("Минимальное значение");
b.Property<int>("ParticlesCount")
.HasColumnType("INTEGER")
.HasComment("Количество частиц");
b.PrimitiveCollection<string>("Qualities")
.HasColumnType("TEXT")
.HasComment("Качества обработки");
b.Property<string>("ResultImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение результата");
b.Property<string>("SampleBrand")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("SampleComment")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
b.Property<string>("SampleName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название пробы");
b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы");
b.Property<string>("SamplingPlace")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Место отбора пробы");
b.Property<string>("SeparatorType")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Тип сепаратора");
b.Property<double>("VarianceOfMean")
.HasColumnType("REAL")
.HasComment("Дисперсия среднего");
b.PrimitiveCollection<string>("Variances")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Дисперсии");
b.HasKey("Id");
b.ToTable("ResultRecords");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,40 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
/// <inheritdoc />
public partial class Results1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "MeanQuality",
table: "ResultRecords",
type: "REAL",
nullable: true,
comment: "Среднее качество обработки");
migrationBuilder.AddColumn<string>(
name: "Qualities",
table: "ResultRecords",
type: "TEXT",
nullable: true,
comment: "Качества обработки");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MeanQuality",
table: "ResultRecords");
migrationBuilder.DropColumn(
name: "Qualities",
table: "ResultRecords");
}
}
}
@@ -1,128 +0,0 @@
// <auto-generated />
using System;
using GSS2.Core.Analysis.AmineContent.Database.Results;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Results.Migrations
{
[DbContext(typeof(ResultsContext))]
partial class ResultsContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.Results.ResultRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Уникальный идентификатор");
b.Property<string>("Image")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение");
b.Property<string>("MaskImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Маска");
b.Property<double>("MaxValue")
.HasColumnType("REAL")
.HasComment("Максимальное значение");
b.Property<double?>("MeanQuality")
.HasColumnType("REAL")
.HasComment("Среднее качество обработки");
b.Property<double>("MeanValue")
.HasColumnType("REAL")
.HasComment("Среднее значение");
b.PrimitiveCollection<string>("MeanValues")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Средние значения");
b.Property<double>("MeanVariance")
.HasColumnType("REAL")
.HasComment("Средняя дисперсия");
b.Property<double>("MinValue")
.HasColumnType("REAL")
.HasComment("Минимальное значение");
b.Property<int>("ParticlesCount")
.HasColumnType("INTEGER")
.HasComment("Количество частиц");
b.PrimitiveCollection<string>("Qualities")
.HasColumnType("TEXT")
.HasComment("Качества обработки");
b.Property<string>("ResultImage")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Изображение результата");
b.Property<string>("SampleBrand")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("SampleComment")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
b.Property<string>("SampleName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название пробы");
b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы");
b.Property<string>("SamplingPlace")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Место отбора пробы");
b.Property<string>("SeparatorType")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Тип сепаратора");
b.Property<double>("VarianceOfMean")
.HasColumnType("REAL")
.HasComment("Дисперсия среднего");
b.PrimitiveCollection<string>("Variances")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Дисперсии");
b.HasKey("Id");
b.ToTable("ResultRecords");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,57 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Results;
public class ResultRecord
{
[Comment("Уникальный идентификатор")]
public int Id { get; set; }
[Comment("Название пробы")]
[MaxLength(256)]
public required string SampleName { get; set; }
[Comment("Дополнительная информация о пробе")]
[MaxLength(512)]
public required string SampleComment { get; set; }
[Comment("Дата и время отбора пробы")]
public required DateTime SamplingDateTime { get; set; }
[Comment("Место отбора пробы")]
[MaxLength(256)]
public required string SamplingPlace { get; set; }
[Comment("Изображение")]
[MaxLength(256)]
public required string Image { get; set; }
[Comment("Тип сепаратора")]
[MaxLength(256)]
public required string SeparatorType { get; set; }
[Comment("Марка пробы")]
[MaxLength(256)]
public required string SampleBrand { get; set; }
[Comment("Маска")]
[MaxLength(256)]
public required string MaskImage { get; set; }
[Comment("Изображение результата")]
[MaxLength(256)]
public required string ResultImage { get; set; }
[Comment("Минимальное значение")]
public required double MinValue { get; set; }
[Comment("Максимальное значение")]
public required double MaxValue { get; set; }
[Comment("Количество частиц")]
public required int ParticlesCount { get; set; }
[Comment("Среднее значение")]
public required double MeanValue { get; set; }
[Comment("Средняя дисперсия")]
public required double MeanVariance { get; set; }
[Comment("Дисперсия среднего")]
public required double VarianceOfMean { get; set; }
[Comment("Среднее качество обработки")]
public required double? MeanQuality { get; set; }
[Comment("Средние значения")]
public required double[] MeanValues { get; set; }
[Comment("Дисперсии")]
public required double[] Variances { get; set; }
[Comment("Качества обработки")]
public required double[]? Qualities { get; set; }
}
@@ -1,12 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database.Results;
public class ResultsContext : DbContext
{
public DbSet<ResultRecord> ResultRecords => Set<ResultRecord>();
public ResultsContext(DbContextOptions<ResultsContext> options)
: base(options)
{ }
}
@@ -1,18 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace GSS2.Core.Analysis.AmineContent.Database.Results;
public class ResultsContextFactory : IDesignTimeDbContextFactory<ResultsContext>
{
public ResultsContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<ResultsContext>();
// Строка подключения для миграций в design-time
// в runtime должна использоваться настоящая ConnectionString
optionsBuilder.UseSqlite("Data Source=AmineContentResults.db");
return new ResultsContext(optionsBuilder.Options);
}
}
@@ -0,0 +1,74 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database;
public class SampleRecord
{
[Comment("Идентификатор")]
public int Id { get; set; }
[Comment("Уникальный идентификатор")]
[MaxLength(36)]
public string Uuid { get; set; }
[Comment("Название пробы")]
[MaxLength(256)]
public string SampleName { get; set; }
[Comment("Дополнительная информация о пробе")]
[MaxLength(512)]
public string SampleComment { get; set; }
[Comment("Дата и время отбора пробы (utc)")]
public DateTime SamplingDateTime { get; set; }
[Comment("Марка")]
public int BrandId { get; set; }
[Comment("Место отбора пробы")]
[MaxLength(256)]
public string SamplingPlace { get; set; }
[Comment("Фактический расход кондиционирующей смеси (кг/т | гр/кг)")]
public double MixtureActualRate { get; set; }
[Comment("Измеренное количество кондиционирующей смеси (кг/т | гр/кг)")]
public double MeasuredContent { get; set; }
[Comment("Изображение")]
public int ImageId { get; set; }
[Comment("Признаки")]
public List<int> FeatureIds { get; set; }
public SampleRecord()
: this(0, null, "", "", null, 0, "", -1, -1, 0, null)
{ }
public SampleRecord(
int id = 0,
string? uuid = null,
string sampleName = "",
string sampleComment = "",
DateTime? samplingDateTime = null,
int brandId = 0,
string samplingPlace = "",
double mixtureActualRate = -1,
double measuredContent = -1,
int imageId = 0,
List<int>? featureIds = null
)
{
Id = id;
if (uuid is null)
Uuid = Guid.NewGuid().ToString();
else
Uuid = uuid;
SampleName = sampleName;
SampleComment = sampleComment;
if (samplingDateTime is null)
SamplingDateTime = DateTime.UtcNow;
else
SamplingDateTime = samplingDateTime.Value;
BrandId = brandId;
SamplingPlace = samplingPlace;
MixtureActualRate = mixtureActualRate;
MeasuredContent = measuredContent;
ImageId = imageId;
if (featureIds is null)
FeatureIds = new List<int>();
else
FeatureIds = featureIds;
}
}
@@ -0,0 +1,46 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database;
public class SeparatorRecord
{
[Comment("Идентификатор")]
public int Id { get; set; }
[Comment("Уникальный идентификатор")]
[MaxLength(36)]
public string Uuid { get; set; }
[Comment("Тип")]
[MaxLength(256)]
public string Type { get; set; }
[Comment("Изображение")]
public int ImageId { get; set; }
[Comment("Признаки")]
public List<int> FeatureIds { get; set; }
public SeparatorRecord()
: this(0, "", "", 0, null)
{ }
public SeparatorRecord(
int id = 0,
string? uuid = null,
string type = "",
int imageId = 0,
List<int>? featureIds = null
)
{
Id = id;
if (uuid is null)
Uuid = Guid.NewGuid().ToString();
else
Uuid = uuid;
Type = type;
ImageId = imageId;
if (featureIds is null)
FeatureIds = new List<int>();
else
FeatureIds = featureIds;
}
}