comprehensive update

1) remove unused components: camera view (due it causes segmentation faults), compute resources and all related, illuminator controller (due in useless without camera view), image storage service, temperature and humidity service
2) database schema - reduce tables references, features storing in records themselves in compressed form, add records creation and editing date and time, add separator comment column
3) analysis - rework of pipeline and ui, now database storing only raw data and all display values calculated from it
4) lights service - add reconnection if disconnected
5) add width and height command line arguments
6) fix some typos and other issues
This commit is contained in:
2026-06-29 15:13:29 +03:00
parent caee9fafd5
commit 72ae26eee7
74 changed files with 5219 additions and 4248 deletions
@@ -11,6 +11,10 @@ public class BrandRecord
[Comment("Уникальный идентификатор")]
[MaxLength(36)]
public string Uuid { get; set; }
[Comment("Дата и время создания")]
public DateTime CreateDateTime { get; set; }
[Comment("Дата и время редактирования")]
public DateTime EditDateTime { get; set; }
[Comment("Марка пробы")]
[MaxLength(256)]
public string BrandName { get; set; }
@@ -19,25 +23,41 @@ public class BrandRecord
public string MixtureName { get; set; }
[Comment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)")]
public double MixtureNormalRate { get; set; }
[Comment("Дополнительная информация")]
[MaxLength(1024)]
public string Comment { get; set; }
public BrandRecord()
: this(0, null, "", "", 0)
: this(0, null, null, null, "", "", 0, "")
{ }
public BrandRecord(
int id = 0,
string? uuid = null,
DateTime? createDateTime = null,
DateTime? editDateTime = null,
string brandName = "",
string mixtureName = "",
double mixtureNormalRate = 0)
double mixtureNormalRate = 0,
string comment = ""
)
{
Id = id;
if (uuid is null)
Uuid = Guid.NewGuid().ToString();
else
Uuid = uuid;
if (createDateTime is null)
CreateDateTime = DateTime.UtcNow;
else
CreateDateTime = createDateTime.Value;
if (editDateTime is null)
EditDateTime = DateTime.UtcNow;
else
EditDateTime = editDateTime.Value;
BrandName = brandName;
MixtureName = mixtureName;
MixtureNormalRate = mixtureNormalRate;
Comment = comment;
}
}
@@ -2,16 +2,26 @@ using Microsoft.EntityFrameworkCore;
namespace GSS2.Core.Analysis.AmineContent.Database;
// TODO: Добавить внешние ключи в таблицы и правило что при удалении ключа ключ должен сбрасываться на 0
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<ResultRecord> ResultRecords => Set<ResultRecord>();
public DbSet<SeparatorRecord> SeparatorRecords => Set<SeparatorRecord>();
public DbSet<SampleRecord> SampleRecords => Set<SampleRecord>();
public Context(DbContextOptions<Context> options)
: base(options)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<SeparatorRecord>()
.Property(e => e.Features)
.HasConversion(new CompressedFloatListConverter());
modelBuilder.Entity<SampleRecord>()
.Property(e => e.Features)
.HasConversion(new CompressedFloatListConverter());
}
}
@@ -1,37 +0,0 @@
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;
}
}
@@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
{
[DbContext(typeof(Context))]
[Migration("20260615113305_Migration0")]
[Migration("20260624080642_Migration0")]
partial class Migration0
{
/// <inheritdoc />
@@ -33,6 +33,20 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<string>("MixtureName")
.IsRequired()
.HasMaxLength(256)
@@ -54,31 +68,6 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
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")
@@ -96,6 +85,125 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
b.ToTable("ImageRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.ResultRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<string>("BrandName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<int>("ImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.HasComment("Изображение");
b.Property<int>("MaskImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.HasComment("Маска");
b.Property<string>("MixtureName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название кондиционирующей смеси");
b.Property<double>("MixtureNormalRate")
.HasColumnType("REAL")
.HasComment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)");
b.Property<int>("ParticlesCount")
.HasColumnType("INTEGER")
.HasComment("Количество частиц");
b.Property<int>("ResultImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.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<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.PrimitiveCollection<string>("ValueCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения частиц (количество)");
b.PrimitiveCollection<string>("ValueData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения частиц (данные)");
b.PrimitiveCollection<string>("XCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, X координаты (количество)");
b.PrimitiveCollection<string>("XData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, X координаты (данные)");
b.PrimitiveCollection<string>("YCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, Y координаты (количество)");
b.PrimitiveCollection<string>("YData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, Y координаты (данные)");
b.HasKey("Id");
b.ToTable("ResultRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.SampleRecord", b =>
{
b.Property<int>("Id")
@@ -107,7 +215,15 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
.HasColumnType("INTEGER")
.HasComment("Марка");
b.PrimitiveCollection<string>("FeatureIds")
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.PrimitiveCollection<string>("Features")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Признаки");
@@ -126,7 +242,7 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
b.Property<string>("SampleComment")
.IsRequired()
.HasMaxLength(512)
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
@@ -164,7 +280,21 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.PrimitiveCollection<string>("FeatureIds")
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.PrimitiveCollection<string>("Features")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Признаки");
@@ -18,30 +18,18 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Идентификатор")
.Annotation("Sqlite:Autoincrement", true),
Uuid = table.Column<string>(type: "TEXT", maxLength: 36, nullable: false, comment: "Уникальный идентификатор"),
CreateDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время создания"),
EditDateTime = table.Column<DateTime>(type: "TEXT", 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: "Норма расхода кондиционирующей смеси (кг/т | гр/кг)")
MixtureNormalRate = table.Column<double>(type: "REAL", nullable: false, comment: "Норма расхода кондиционирующей смеси (кг/т | гр/кг)"),
Comment = table.Column<string>(type: "TEXT", maxLength: 1024, 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
@@ -55,6 +43,39 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
table.PrimaryKey("PK_ImageRecords", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ResultRecords",
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: "Уникальный идентификатор"),
CreateDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время создания"),
EditDateTime = table.Column<DateTime>(type: "TEXT", 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: "Дополнительная информация о пробе"),
SamplingDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время отбора пробы"),
SamplingPlace = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Место отбора пробы"),
SeparatorType = table.Column<string>(type: "TEXT", maxLength: 256, 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: "Норма расхода кондиционирующей смеси (кг/т | гр/кг)"),
ImageId = table.Column<int>(type: "INTEGER", maxLength: 256, nullable: false, comment: "Изображение"),
MaskImageId = table.Column<int>(type: "INTEGER", maxLength: 256, nullable: false, comment: "Маска"),
ResultImageId = table.Column<int>(type: "INTEGER", maxLength: 256, nullable: false, comment: "Изображение результата"),
ParticlesCount = table.Column<int>(type: "INTEGER", nullable: false, comment: "Количество частиц"),
ValueCount = table.Column<string>(type: "TEXT", nullable: false, comment: "Значения частиц (количество)"),
ValueData = table.Column<string>(type: "TEXT", nullable: false, comment: "Значения частиц (данные)"),
XCount = table.Column<string>(type: "TEXT", nullable: false, comment: "Контура частиц, X координаты (количество)"),
XData = table.Column<string>(type: "TEXT", nullable: false, comment: "Контура частиц, X координаты (данные)"),
YCount = table.Column<string>(type: "TEXT", nullable: false, comment: "Контура частиц, Y координаты (количество)"),
YData = table.Column<string>(type: "TEXT", nullable: false, comment: "Контура частиц, Y координаты (данные)")
},
constraints: table =>
{
table.PrimaryKey("PK_ResultRecords", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SampleRecords",
columns: table => new
@@ -62,15 +83,17 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Идентификатор")
.Annotation("Sqlite:Autoincrement", true),
Uuid = table.Column<string>(type: "TEXT", maxLength: 36, nullable: false, comment: "Уникальный идентификатор"),
CreateDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время создания"),
EditDateTime = table.Column<DateTime>(type: "TEXT", 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: 1024, nullable: false, comment: "Дополнительная информация о пробе"),
SamplingDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время отбора пробы (utc)"),
BrandId = table.Column<int>(type: "INTEGER", nullable: false, comment: "Марка"),
SamplingPlace = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Место отбора пробы"),
MixtureActualRate = table.Column<double>(type: "REAL", nullable: false, comment: "Фактический расход кондиционирующей смеси (кг/т | гр/кг)"),
MeasuredContent = table.Column<double>(type: "REAL", nullable: false, comment: "Измеренное количество кондиционирующей смеси (кг/т | гр/кг)"),
ImageId = table.Column<int>(type: "INTEGER", nullable: false, comment: "Изображение"),
FeatureIds = table.Column<string>(type: "TEXT", nullable: false, comment: "Признаки")
Features = table.Column<string>(type: "TEXT", nullable: false, comment: "Признаки")
},
constraints: table =>
{
@@ -84,9 +107,12 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
Id = table.Column<int>(type: "INTEGER", nullable: false, comment: "Идентификатор")
.Annotation("Sqlite:Autoincrement", true),
Uuid = table.Column<string>(type: "TEXT", maxLength: 36, nullable: false, comment: "Уникальный идентификатор"),
CreateDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время создания"),
EditDateTime = table.Column<DateTime>(type: "TEXT", nullable: false, comment: "Дата и время редактирования"),
Type = table.Column<string>(type: "TEXT", maxLength: 256, nullable: false, comment: "Тип"),
Comment = table.Column<string>(type: "TEXT", maxLength: 1024, nullable: false, comment: "Дополнительная информация"),
ImageId = table.Column<int>(type: "INTEGER", nullable: false, comment: "Изображение"),
FeatureIds = table.Column<string>(type: "TEXT", nullable: false, comment: "Признаки")
Features = table.Column<string>(type: "TEXT", nullable: false, comment: "Признаки")
},
constraints: table =>
{
@@ -101,10 +127,10 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
name: "BrandRecords");
migrationBuilder.DropTable(
name: "FeatureRecords");
name: "ImageRecords");
migrationBuilder.DropTable(
name: "ImageRecords");
name: "ResultRecords");
migrationBuilder.DropTable(
name: "SampleRecords");
@@ -0,0 +1,325 @@
// <auto-generated />
using System;
using GSS2.Core.Analysis.AmineContent.Database;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
{
[DbContext(typeof(Context))]
[Migration("20260624154152_Migration1")]
partial class Migration1
{
/// <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.BrandRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<string>("BrandName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<string>("MixtureName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название кондиционирующей смеси");
b.Property<double>("MixtureNormalRate")
.HasColumnType("REAL")
.HasComment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)");
b.Property<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.HasKey("Id");
b.ToTable("BrandRecords");
});
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.ResultRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<string>("BrandName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<int>("ImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.HasComment("Изображение");
b.Property<int>("MaskImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.HasComment("Маска");
b.Property<string>("MixtureName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название кондиционирующей смеси");
b.Property<double>("MixtureNormalRate")
.HasColumnType("REAL")
.HasComment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)");
b.Property<int>("ParticlesCount")
.HasColumnType("INTEGER")
.HasComment("Количество частиц");
b.Property<int>("ResultImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.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<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.PrimitiveCollection<string>("ValueCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения частиц (количество)");
b.PrimitiveCollection<string>("ValueData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения частиц (данные)");
b.PrimitiveCollection<string>("XCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, X координаты (количество)");
b.PrimitiveCollection<string>("XData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, X координаты (данные)");
b.PrimitiveCollection<string>("YCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, Y координаты (количество)");
b.PrimitiveCollection<string>("YData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, Y координаты (данные)");
b.HasKey("Id");
b.ToTable("ResultRecords");
});
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.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<string>("Features")
.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")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
b.Property<string>("SampleName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название пробы");
b.Property<DateTime>("SamplingDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время отбора пробы (utc)");
b.Property<string>("SamplingPlace")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Место отбора пробы");
b.Property<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.HasKey("Id");
b.ToTable("SampleRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.SeparatorRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<string>("Features")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Признаки");
b.Property<int>("ImageId")
.HasColumnType("INTEGER")
.HasComment("Изображение");
b.Property<string>("Type")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Тип");
b.Property<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.HasKey("Id");
b.ToTable("SeparatorRecords");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
{
/// <inheritdoc />
public partial class Migration1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
@@ -30,6 +30,20 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<string>("MixtureName")
.IsRequired()
.HasMaxLength(256)
@@ -51,31 +65,6 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
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")
@@ -93,6 +82,125 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
b.ToTable("ImageRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.ResultRecord", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.Property<string>("BrandName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Марка пробы");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<int>("ImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.HasComment("Изображение");
b.Property<int>("MaskImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.HasComment("Маска");
b.Property<string>("MixtureName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT")
.HasComment("Название кондиционирующей смеси");
b.Property<double>("MixtureNormalRate")
.HasColumnType("REAL")
.HasComment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)");
b.Property<int>("ParticlesCount")
.HasColumnType("INTEGER")
.HasComment("Количество частиц");
b.Property<int>("ResultImageId")
.HasMaxLength(256)
.HasColumnType("INTEGER")
.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<string>("Uuid")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("TEXT")
.HasComment("Уникальный идентификатор");
b.PrimitiveCollection<string>("ValueCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения частиц (количество)");
b.PrimitiveCollection<string>("ValueData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Значения частиц (данные)");
b.PrimitiveCollection<string>("XCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, X координаты (количество)");
b.PrimitiveCollection<string>("XData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, X координаты (данные)");
b.PrimitiveCollection<string>("YCount")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, Y координаты (количество)");
b.PrimitiveCollection<string>("YData")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Контура частиц, Y координаты (данные)");
b.HasKey("Id");
b.ToTable("ResultRecords");
});
modelBuilder.Entity("GSS2.Core.Analysis.AmineContent.Database.SampleRecord", b =>
{
b.Property<int>("Id")
@@ -104,7 +212,15 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
.HasColumnType("INTEGER")
.HasComment("Марка");
b.PrimitiveCollection<string>("FeatureIds")
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<string>("Features")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Признаки");
@@ -123,7 +239,7 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
b.Property<string>("SampleComment")
.IsRequired()
.HasMaxLength(512)
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация о пробе");
@@ -161,7 +277,21 @@ namespace GSS2.Core.Analysis.AmineContent.Database.Migrations
.HasColumnType("INTEGER")
.HasComment("Идентификатор");
b.PrimitiveCollection<string>("FeatureIds")
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("TEXT")
.HasComment("Дополнительная информация");
b.Property<DateTime>("CreateDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время создания");
b.Property<DateTime>("EditDateTime")
.HasColumnType("TEXT")
.HasComment("Дата и время редактирования");
b.Property<string>("Features")
.IsRequired()
.HasColumnType("TEXT")
.HasComment("Признаки");
@@ -1,60 +1,149 @@
// using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
// using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
// namespace GSS2.Core.Analysis.AmineContent.Database;
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; }
// }
public class ResultRecord
{
[Comment("Идентификатор")]
public int Id { get; set; }
[Comment("Уникальный идентификатор")]
[MaxLength(36)]
public string Uuid { get; set; }
[Comment("Дата и время создания")]
public DateTime CreateDateTime { get; set; }
[Comment("Дата и время редактирования")]
public DateTime EditDateTime { get; set; }
[Comment("Название пробы")]
[MaxLength(256)]
public string SampleName { get; set; }
[Comment("Дополнительная информация о пробе")]
[MaxLength(512)]
public string SampleComment { get; set; }
[Comment("Дата и время отбора пробы")]
public DateTime SamplingDateTime { get; set; }
[Comment("Место отбора пробы")]
[MaxLength(256)]
public string SamplingPlace { get; set; }
[Comment("Тип сепаратора")]
[MaxLength(256)]
public string SeparatorType { get; set; }
[Comment("Марка пробы")]
[MaxLength(256)]
public string BrandName { get; set; }
[Comment("Название кондиционирующей смеси")]
[MaxLength(256)]
public string MixtureName { get; set; }
[Comment("Норма расхода кондиционирующей смеси (кг/т | гр/кг)")]
public double MixtureNormalRate { get; set; }
[Comment("Изображение")]
[MaxLength(256)]
public int ImageId { get; set; }
[Comment("Маска")]
[MaxLength(256)]
public int MaskImageId { get; set; }
[Comment("Изображение результата")]
[MaxLength(256)]
public int ResultImageId { get; set; }
[Comment("Количество частиц")]
public int ParticlesCount { get; set; }
[Comment("Значения частиц (количество)")]
public List<int> ValueCount { get; set; }
[Comment("Значения частиц (данные)")]
public List<float> ValueData { get; set; }
[Comment("Контура частиц, X координаты (количество)")]
public List<int> XCount { get; set; }
[Comment("Контура частиц, X координаты (данные)")]
public List<float> XData { get; set; }
[Comment("Контура частиц, Y координаты (количество)")]
public List<int> YCount { get; set; }
[Comment("Контура частиц, Y координаты (данные)")]
public List<float> YData { get; set; }
public ResultRecord()
: this(0, null, null, null, "", "", null, "", "", "", "", -1, 0, 0, 0, -1, null, null, null)
{ }
public ResultRecord(
int id = 0,
string? uuid = null,
DateTime? createDateTime = null,
DateTime? editDateTime = null,
string sampleName = "",
string sampleComment = "",
DateTime? samplingDateTime = null,
string samplingPlace = "",
string separatorType = "",
string brandName = "",
string mixtureName = "",
double mixtureNormalRate = -1,
int imageId = 0,
int maskImageId = 0,
int resultImageId = 0,
int particlesCount = -1,
List<float[]>? values = null,
List<float[]>? xs = null,
List<float[]>? ys = null
)
{
Id = id;
if (uuid is null)
Uuid = Guid.NewGuid().ToString();
else
Uuid = uuid;
if (createDateTime is null)
CreateDateTime = DateTime.UtcNow;
else
CreateDateTime = createDateTime.Value;
if (editDateTime is null)
EditDateTime = DateTime.UtcNow;
else
EditDateTime = editDateTime.Value;
SampleName = sampleName;
SampleComment = sampleComment;
if (samplingDateTime is null)
SamplingDateTime = DateTime.UtcNow;
else
SamplingDateTime = samplingDateTime.Value;
SamplingPlace = samplingPlace;
SeparatorType = separatorType;
BrandName = brandName;
MixtureName = mixtureName;
MixtureNormalRate = mixtureNormalRate;
ImageId = imageId;
MaskImageId = maskImageId;
ResultImageId = resultImageId;
ParticlesCount = particlesCount;
if (values is null)
{
ValueCount = new List<int>();
ValueData = new List<float>();
}
else
{
ValueCount = values.Select(fs => fs.Count()).ToList();
ValueData = values.SelectMany(fs => fs).ToList();
}
if (xs is null)
{
XCount = new List<int>();
XData = new List<float>();
}
else
{
XCount = xs.Select(fs => fs.Count()).ToList();
XData = xs.SelectMany(fs => fs).ToList();
}
if (ys is null)
{
YCount = new List<int>();
YData = new List<float>();
}
else
{
YCount = ys.Select(fs => fs.Count()).ToList();
YData = ys.SelectMany(fs => fs).ToList();
}
}
}
@@ -11,11 +11,15 @@ public class SampleRecord
[Comment("Уникальный идентификатор")]
[MaxLength(36)]
public string Uuid { get; set; }
[Comment("Дата и время создания")]
public DateTime CreateDateTime { get; set; }
[Comment("Дата и время редактирования")]
public DateTime EditDateTime { get; set; }
[Comment("Название пробы")]
[MaxLength(256)]
public string SampleName { get; set; }
[Comment("Дополнительная информация о пробе")]
[MaxLength(512)]
[MaxLength(1024)]
public string SampleComment { get; set; }
[Comment("Дата и время отбора пробы (utc)")]
public DateTime SamplingDateTime { get; set; }
@@ -31,14 +35,16 @@ public class SampleRecord
[Comment("Изображение")]
public int ImageId { get; set; }
[Comment("Признаки")]
public List<int> FeatureIds { get; set; }
public List<float> Features { get; set; }
public SampleRecord()
: this(0, null, "", "", null, 0, "", -1, -1, 0, null)
: this(0, null, null, null, "", "", null, 0, "", -1, -1, 0, null)
{ }
public SampleRecord(
int id = 0,
string? uuid = null,
DateTime? createDateTime = null,
DateTime? editDateTime = null,
string sampleName = "",
string sampleComment = "",
DateTime? samplingDateTime = null,
@@ -47,7 +53,7 @@ public class SampleRecord
double mixtureActualRate = -1,
double measuredContent = -1,
int imageId = 0,
List<int>? featureIds = null
List<float[]>? features = null
)
{
Id = id;
@@ -55,6 +61,14 @@ public class SampleRecord
Uuid = Guid.NewGuid().ToString();
else
Uuid = uuid;
if (createDateTime is null)
CreateDateTime = DateTime.UtcNow;
else
CreateDateTime = createDateTime.Value;
if (editDateTime is null)
EditDateTime = DateTime.UtcNow;
else
EditDateTime = editDateTime.Value;
SampleName = sampleName;
SampleComment = sampleComment;
if (samplingDateTime is null)
@@ -66,9 +80,9 @@ public class SampleRecord
MixtureActualRate = mixtureActualRate;
MeasuredContent = measuredContent;
ImageId = imageId;
if (featureIds is null)
FeatureIds = new List<int>();
if (features is null)
Features = new List<float>();
else
FeatureIds = featureIds;
Features = features.SelectMany(fs => fs).ToList();
}
}
@@ -11,24 +11,34 @@ public class SeparatorRecord
[Comment("Уникальный идентификатор")]
[MaxLength(36)]
public string Uuid { get; set; }
[Comment("Дата и время создания")]
public DateTime CreateDateTime { get; set; }
[Comment("Дата и время редактирования")]
public DateTime EditDateTime { get; set; }
[Comment("Тип")]
[MaxLength(256)]
public string Type { get; set; }
[Comment("Дополнительная информация")]
[MaxLength(1024)]
public string Comment { get; set; }
[Comment("Изображение")]
public int ImageId { get; set; }
[Comment("Признаки")]
public List<int> FeatureIds { get; set; }
public List<float> Features { get; set; }
public SeparatorRecord()
: this(0, "", "", 0, null)
: this(0, null, null, null, "", "", 0, null)
{ }
public SeparatorRecord(
int id = 0,
string? uuid = null,
DateTime? createDateTime = null,
DateTime? editDateTime = null,
string type = "",
string comment = "",
int imageId = 0,
List<int>? featureIds = null
List<float[]>? features = null
)
{
Id = id;
@@ -36,11 +46,20 @@ public class SeparatorRecord
Uuid = Guid.NewGuid().ToString();
else
Uuid = uuid;
Type = type;
ImageId = imageId;
if (featureIds is null)
FeatureIds = new List<int>();
if (createDateTime is null)
CreateDateTime = DateTime.UtcNow;
else
FeatureIds = featureIds;
CreateDateTime = createDateTime.Value;
if (editDateTime is null)
EditDateTime = DateTime.UtcNow;
else
EditDateTime = editDateTime.Value;
Type = type;
Comment = comment;
ImageId = imageId;
if (features is null)
Features = new List<float>();
else
Features = features.SelectMany(fs => fs).ToList();
}
}