Refactor Condition model: remove legacy synonym and primary fields, introduce canonical field for aliasing. Update related documentation.

This commit is contained in:
Ross
2025-11-24 10:31:13 +00:00
parent 6308fbfcd7
commit 5ccf755e72
2 changed files with 25 additions and 10 deletions
@@ -0,0 +1,21 @@
# Generated by Django 5.2.7 on 2025-11-24 10:31
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('atlas', '0088_remove_finding_primary_remove_finding_synonym_and_more'),
]
operations = [
migrations.RemoveField(
model_name='condition',
name='primary',
),
migrations.RemoveField(
model_name='condition',
name='synonym',
),
]
+4 -10
View File
@@ -231,12 +231,6 @@ class Finding(SynMixin, models.Model):
class Condition(SynMixin, models.Model):
name = models.CharField(max_length=255, unique=True)
synonym = models.ManyToManyField(
"self",
blank=True,
help_text="Use if a direct synonym for the condition exists, e.g. 'Wegener granulomatosis' and 'Granulomatosis with Polyangitis'.",
)
# New canonical/alias field (Option B): if set, this Condition is an alias
# and points to the canonical/master Condition.
canonical = models.ForeignKey(
@@ -256,10 +250,10 @@ class Condition(SynMixin, models.Model):
help_text="Use if the condition could be considered a subset of another, e.g. 'Alzheimer disease' and 'Dementia'.",
)
primary = models.BooleanField(
default="True",
help_text="Sets if this should be the canonical item, all other synonyms will then redirect to this by default.",
)
# Legacy fields `synonym` (M2M) and `primary` (boolean) have been removed.
# Canonical/aliases are represented by the `canonical` ForeignKey and
# the reverse `aliases` related_name. Use `get_synonyms()` /
# `canonical_condition` to access canonical groups.
subspecialty = models.ManyToManyField(
"subspecialty",