diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index b855f2e4e4..f3f4035c8d 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 62.0.24
+current_version = 62.0.25
commit = True
tag = True
tag_name = v{new_version}
diff --git a/alembic/versions/2024_07_29_0ca61967d364_add_comment_column_to_analysis_table.py b/alembic/versions/2024_07_29_0ca61967d364_add_comment_column_to_analysis_table.py
new file mode 100644
index 0000000000..2e7a0df1d6
--- /dev/null
+++ b/alembic/versions/2024_07_29_0ca61967d364_add_comment_column_to_analysis_table.py
@@ -0,0 +1,28 @@
+"""Add comment column to analysis table
+
+Revision ID: 0ca61967d364
+Revises: 77a75121be31
+Create Date: 2024-07-29 10:43:06.444590
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = "0ca61967d364"
+down_revision = "77a75121be31"
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ op.add_column(
+ table_name="analysis",
+ column=sa.Column("comment", sa.Text(), nullable=True),
+ )
+
+
+def downgrade():
+ op.drop_column(table_name="analysis", column_name="comment")
diff --git a/cg/__init__.py b/cg/__init__.py
index bf4e97dd1f..5f3f08e4f2 100644
--- a/cg/__init__.py
+++ b/cg/__init__.py
@@ -1,2 +1,2 @@
__title__ = "cg"
-__version__ = "62.0.24"
+__version__ = "62.0.25"
diff --git a/cg/meta/report/report_api.py b/cg/meta/report/report_api.py
index e2603334bc..0d15cdb7e9 100644
--- a/cg/meta/report/report_api.py
+++ b/cg/meta/report/report_api.py
@@ -330,6 +330,7 @@ def get_case_analysis_data(self, case: Case, analysis: Analysis) -> DataAnalysis
else None
)
return DataAnalysisModel(
+ comment=analysis.comment,
customer_workflow=case.data_analysis,
data_delivery=case.data_delivery,
delivered_files=delivered_files,
diff --git a/cg/meta/report/templates/macros/data_analysis/data_analysis.html b/cg/meta/report/templates/macros/data_analysis/data_analysis.html
index f2b3f9c4f4..2e30fda381 100644
--- a/cg/meta/report/templates/macros/data_analysis/data_analysis.html
+++ b/cg/meta/report/templates/macros/data_analysis/data_analysis.html
@@ -53,12 +53,14 @@
Dataanalys
{{ workflow }} (v{{ case.data_analysis.workflow_version }}) |
{{ case.data_analysis.genome_build }} |
{% if "balsamic" in workflow %} {{ case.data_analysis.type }} {% endif %} |
- {% if "balsamic" in workflow and case.data_analysis.pons != "N/A" %} {{ case.data_analysis.pons }} {% endif %}
+ | {% if "balsamic" in workflow and case.data_analysis.pons != "N/A" %} {{ case.data_analysis.pons }} {% endif %} |
{% if workflow in ("balsamic", "balsamic-umi") %} {{ case.data_analysis.variant_callers }} {% endif %} |
{% if workflow in ("mip-dna", "raredisease", "rnafusion", "tomte") %} {{ case.data_analysis.panels }} {% endif %} |
+
+ {{ data_analysis_comment_alert(comment=case.data_analysis.comment) }}
{{ data_analysis_alert(case=case) }}
{% endmacro %}
@@ -97,3 +99,11 @@ Dataanalys
{% endif %}
{% endmacro %}
+
+{% macro data_analysis_comment_alert(comment) %}
+ {% if comment != "N/A" %}
+
+ {{ comment }}
+
+ {% endif %}
+{% endmacro %}
diff --git a/cg/models/report/report.py b/cg/models/report/report.py
index 4dd8028827..64668fd695 100644
--- a/cg/models/report/report.py
+++ b/cg/models/report/report.py
@@ -62,6 +62,7 @@ class DataAnalysisModel(BaseModel):
Model that describes the workflow attributes used for the data analysis
Attributes:
+ comment: prod bioinfo comment regarding the data analysis; source: StatusDB/analysis/comment
customer_workflow: data analysis requested by the customer; source: StatusDB/family/data_analysis
data_delivery: data delivery requested by the customer; source: StatusDB/family/data_delivery
delivered_files: list of analysis case files to be delivered
@@ -75,6 +76,7 @@ class DataAnalysisModel(BaseModel):
workflow_version: workflow version; source: statusDB/analysis/workflow_version
"""
+ comment: Annotated[str, BeforeValidator(get_report_string)] = NA_FIELD
customer_workflow: Annotated[str, BeforeValidator(get_report_string)] = NA_FIELD
data_delivery: Annotated[str, BeforeValidator(get_report_string)] = NA_FIELD
delivered_files: Annotated[
diff --git a/cg/server/admin.py b/cg/server/admin.py
index e8bf4d2677..9609a96646 100644
--- a/cg/server/admin.py
+++ b/cg/server/admin.py
@@ -424,7 +424,7 @@ class AnalysisView(BaseView):
"""Admin view for Model.Analysis"""
column_default_sort = ("created_at", True)
- column_editable_list = ["is_primary"]
+ column_editable_list = ["is_primary", "comment"]
column_filters = ["workflow", "workflow_version", "is_primary"]
column_formatters = {"case": CaseView.view_case_link}
column_searchable_list = [
diff --git a/cg/store/models.py b/cg/store/models.py
index 6b8b4e1e70..d94c1e71b9 100644
--- a/cg/store/models.py
+++ b/cg/store/models.py
@@ -274,10 +274,9 @@ class Analysis(Base):
cleaned_at: Mapped[datetime | None]
# primary analysis is the one originally delivered to the customer
is_primary: Mapped[bool | None] = mapped_column(default=False)
-
created_at: Mapped[datetime] = mapped_column(default=datetime.now)
+ comment: Mapped[Text | None]
case_id: Mapped[int] = mapped_column(ForeignKey("case.id", ondelete="CASCADE"))
-
case: Mapped["Case"] = orm.relationship(back_populates="analyses")
def __str__(self):
diff --git a/pyproject.toml b/pyproject.toml
index fc6d6ee708..a47361a143 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "cg"
-version = "62.0.24"
+version = "62.0.25"
description = "Clinical Genomics command center"
authors = ["Clinical Genomics "]
readme = "README.md"