UPDATE
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import uuid
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("location_data", "0016_remove_analysisgridobservation_lst_c"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="RemoteSensingClusterBlock",
|
||||
fields=[
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("uuid", models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, unique=True)),
|
||||
("block_code", models.CharField(blank=True, db_index=True, default="", help_text="شناسه بلوک والد که این زیربلاک KMeans داخل آن ساخته شده است.", max_length=64)),
|
||||
("sub_block_code", models.CharField(db_index=True, help_text="شناسه زیربلاک ساختهشده توسط KMeans مثل cluster-0.", max_length=64)),
|
||||
("cluster_label", models.PositiveIntegerField(db_index=True)),
|
||||
("chunk_size_sqm", models.PositiveIntegerField(default=900)),
|
||||
("centroid_lat", models.DecimalField(db_index=True, decimal_places=6, help_text="عرض جغرافیایی مرکز زیربلاک.", max_digits=9)),
|
||||
("centroid_lon", models.DecimalField(db_index=True, decimal_places=6, help_text="طول جغرافیایی مرکز زیربلاک.", max_digits=9)),
|
||||
("geometry", models.JSONField(blank=True, default=dict, help_text="هندسه GeoJSON زیربلاک KMeans. فعلا از چندضلعی/چندچندضلعی سلولهای عضو ساخته میشود.")),
|
||||
("cell_count", models.PositiveIntegerField(default=0)),
|
||||
("cell_codes", models.JSONField(blank=True, default=list)),
|
||||
("metadata", models.JSONField(blank=True, default=dict)),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("block_subdivision", models.ForeignKey(blank=True, null=True, on_delete=models.deletion.SET_NULL, related_name="remote_sensing_cluster_blocks", to="location_data.blocksubdivision")),
|
||||
("result", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="cluster_blocks", to="location_data.remotesensingsubdivisionresult")),
|
||||
("soil_location", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="remote_sensing_cluster_blocks", to="location_data.soillocation")),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "remote sensing cluster block",
|
||||
"verbose_name_plural": "remote sensing cluster blocks",
|
||||
"ordering": ["result", "cluster_label", "id"],
|
||||
},
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="remotesensingclusterblock",
|
||||
constraint=models.UniqueConstraint(fields=("result", "cluster_label"), name="rs_cluster_block_unique_result_label"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="remotesensingclusterblock",
|
||||
index=models.Index(fields=["soil_location", "block_code", "cluster_label"], name="rs_cluster_block_lookup_idx"),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,92 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("location_data", "0017_remotesensingclusterblock"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="RemoteSensingSubdivisionOption",
|
||||
fields=[
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("requested_k", models.PositiveIntegerField(db_index=True)),
|
||||
("effective_cluster_count", models.PositiveIntegerField(default=0)),
|
||||
("is_active", models.BooleanField(db_index=True, default=False)),
|
||||
("is_recommended", models.BooleanField(db_index=True, default=False)),
|
||||
("selection_source", models.CharField(default="system", help_text="منشا انتخاب این گزینه؛ مثل system یا user.", max_length=32)),
|
||||
("metadata", models.JSONField(blank=True, default=dict)),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("result", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="options", to="location_data.remotesensingsubdivisionresult")),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "remote sensing subdivision option",
|
||||
"verbose_name_plural": "remote sensing subdivision options",
|
||||
"ordering": ["result", "requested_k", "id"],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="RemoteSensingSubdivisionOptionBlock",
|
||||
fields=[
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("cluster_label", models.PositiveIntegerField(db_index=True)),
|
||||
("sub_block_code", models.CharField(db_index=True, max_length=64)),
|
||||
("chunk_size_sqm", models.PositiveIntegerField(default=900)),
|
||||
("centroid_lat", models.DecimalField(db_index=True, decimal_places=6, max_digits=9)),
|
||||
("centroid_lon", models.DecimalField(db_index=True, decimal_places=6, max_digits=9)),
|
||||
("geometry", models.JSONField(blank=True, default=dict)),
|
||||
("cell_count", models.PositiveIntegerField(default=0)),
|
||||
("cell_codes", models.JSONField(blank=True, default=list)),
|
||||
("metadata", models.JSONField(blank=True, default=dict)),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("option", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="cluster_blocks", to="location_data.remotesensingsubdivisionoption")),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "remote sensing subdivision option block",
|
||||
"verbose_name_plural": "remote sensing subdivision option blocks",
|
||||
"ordering": ["option", "cluster_label", "id"],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="RemoteSensingSubdivisionOptionAssignment",
|
||||
fields=[
|
||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
||||
("cluster_label", models.PositiveIntegerField(db_index=True)),
|
||||
("raw_feature_values", models.JSONField(blank=True, default=dict)),
|
||||
("scaled_feature_values", models.JSONField(blank=True, default=dict)),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("cell", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="subdivision_option_assignments", to="location_data.analysisgridcell")),
|
||||
("option", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="assignments", to="location_data.remotesensingsubdivisionoption")),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "remote sensing subdivision option assignment",
|
||||
"verbose_name_plural": "remote sensing subdivision option assignments",
|
||||
"ordering": ["option", "cluster_label", "cell__cell_code"],
|
||||
},
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="remotesensingsubdivisionoption",
|
||||
constraint=models.UniqueConstraint(fields=("result", "requested_k"), name="rs_subdiv_option_unique_result_requested_k"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="remotesensingsubdivisionoption",
|
||||
index=models.Index(fields=["result", "is_active"], name="rs_subdiv_option_active_idx"),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="remotesensingsubdivisionoptionblock",
|
||||
constraint=models.UniqueConstraint(fields=("option", "cluster_label"), name="rs_subdiv_option_block_unique_option_label"),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="remotesensingsubdivisionoptionassignment",
|
||||
constraint=models.UniqueConstraint(fields=("option", "cell"), name="rs_subdiv_option_assign_unique_option_cell"),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name="remotesensingsubdivisionoptionassignment",
|
||||
index=models.Index(fields=["option", "cluster_label"], name="rs_subopt_assign_lbl_idx"),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,81 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("location_data", "0018_remotesensingsubdivisionoption_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="remotesensingclusterblock",
|
||||
name="center_cell_code",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
default="",
|
||||
help_text="شناسه سلول مرکزی انتخابشده با بهینهسازی 1-center در همین کلاستر.",
|
||||
max_length=64,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="remotesensingclusterblock",
|
||||
name="center_cell_lat",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
decimal_places=6,
|
||||
help_text="عرض جغرافیایی سلول مرکزی کلاستر.",
|
||||
max_digits=9,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="remotesensingclusterblock",
|
||||
name="center_cell_lon",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
decimal_places=6,
|
||||
help_text="طول جغرافیایی سلول مرکزی کلاستر.",
|
||||
max_digits=9,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="remotesensingsubdivisionoptionblock",
|
||||
name="center_cell_code",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
default="",
|
||||
help_text="شناسه سلول مرکزی انتخابشده با بهینهسازی 1-center روی اعضای همین کلاستر.",
|
||||
max_length=64,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="remotesensingsubdivisionoptionblock",
|
||||
name="center_cell_lat",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
decimal_places=6,
|
||||
help_text="عرض جغرافیایی سلول مرکزی کلاستر.",
|
||||
max_digits=9,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="remotesensingsubdivisionoptionblock",
|
||||
name="center_cell_lon",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
decimal_places=6,
|
||||
help_text="طول جغرافیایی سلول مرکزی کلاستر.",
|
||||
max_digits=9,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user