Skip to content

Commit

Permalink
Merge branch 'master' into dev-pacbio-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
diitaz93 authored Jul 29, 2024
2 parents 8b78253 + 36c50aa commit 9e7c594
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 62.0.24
current_version = 62.0.25
commit = True
tag = True
tag_name = v{new_version}
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion cg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = "cg"
__version__ = "62.0.24"
__version__ = "62.0.25"
1 change: 1 addition & 0 deletions cg/meta/report/report_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 11 additions & 1 deletion cg/meta/report/templates/macros/data_analysis/data_analysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ <h4 class="mt-4 mb-3">Dataanalys</h4>
<td>{{ workflow }} (v{{ case.data_analysis.workflow_version }})</td>
<td>{{ case.data_analysis.genome_build }}</td>
<td>{% if "balsamic" in workflow %} {{ case.data_analysis.type }} {% endif %}</td>
<td>{% if "balsamic" in workflow and case.data_analysis.pons != "N/A" %} {{ case.data_analysis.pons }} {% endif %}</th>
<td>{% if "balsamic" in workflow and case.data_analysis.pons != "N/A" %} {{ case.data_analysis.pons }} {% endif %}</td>
<td class="text-start">{% if workflow in ("balsamic", "balsamic-umi") %} {{ case.data_analysis.variant_callers }} {% endif %}</td>
<td>{% if workflow in ("mip-dna", "raredisease", "rnafusion", "tomte") %} {{ case.data_analysis.panels }} {% endif %}</td>
</tr>
</tbody>
</table>
<!--Data analysis comment warning -->
{{ data_analysis_comment_alert(comment=case.data_analysis.comment) }}
<!-- Data analysis alert component -->
{{ data_analysis_alert(case=case) }}
{% endmacro %}
Expand Down Expand Up @@ -97,3 +99,11 @@ <h4 class="mt-4 mb-3">Dataanalys</h4>
</div>
{% endif %}
{% endmacro %}

{% macro data_analysis_comment_alert(comment) %}
{% if comment != "N/A" %}
<div class="alert alert-warning" role="alert">
{{ comment }}
</div>
{% endif %}
{% endmacro %}
2 changes: 2 additions & 0 deletions cg/models/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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[
Expand Down
2 changes: 1 addition & 1 deletion cg/server/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
3 changes: 1 addition & 2 deletions cg/store/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 9e7c594

Please sign in to comment.