• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Clinical-Genomics / arnold / 7102454002

05 Dec 2023 02:52PM UTC coverage: 0.0%. Remained the same
7102454002

push

github

web-flow
Update to pydantic v2 (#47) (patch)

Added
Move the models to pydantic v2

add Codeowners for automatic reviewer tagging

0 of 89 new or added lines in 5 files covered. (0.0%)

28 existing lines in 5 files now uncovered.

0 of 699 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/arnold/crud/read/plot/trend_step_fields.py
1
from typing import Optional
×
2

3
from arnold.adapter import ArnoldAdapter
×
4
from arnold.crud.read.plot.format_plot_data import format_grouped_plot_data, format_plot_data
×
5

6

7
def trend_step_fields(
×
8
    adapter: ArnoldAdapter,
9
    year: int,
10
    workflow: str,
11
    step_type: str,
12
    field: str,
13
    group: Optional[str],
14
) -> list:
15
    lookup = {
×
16
        "$lookup": {
17
            "from": "sample",
18
            "localField": "sample_id",
19
            "foreignField": "_id",
20
            "as": "sample",
21
        }
22
    }
23
    unwind = {"$unwind": {"path": "$sample"}}
×
UNCOV
24
    match = {
×
25
        "$match": {
26
            "date_run": {"$exists": "True"},
27
            field: {"$exists": "True"},
28
            "workflow": workflow,
29
            "step_type": step_type,
30
        }
31
    }
UNCOV
32
    project = {
×
33
        "$project": {
34
            "month": {"$month": "$date_run"},
35
            "year": {"$year": "$date_run"},
36
            field: 1,
37
        }
38
    }
39
    match_year = {"$match": {"year": year}}
×
40
    field_replaced_dot = field.split(".")[1]
×
UNCOV
41
    group_by = {
×
42
        "$group": {
43
            "_id": {"month": "$month"},
44
            field_replaced_dot: {"$push": f"${field}"},
45
        }
46
    }
UNCOV
47
    add_average = {
×
48
        "$addFields": {f"average_{field_replaced_dot}": {"$avg": f"${field_replaced_dot}"}}
49
    }
50

51
    if group:
×
52
        match["$match"][f"sample.{group}"] = {"$exists": "True"}
×
53
        project["$project"][group] = f"$sample.{group}"
×
UNCOV
54
        group_by["$group"]["_id"][group] = f"${group}"
×
55

UNCOV
56
    pipe = [lookup, unwind, match, project, match_year, group_by, add_average]
×
57

58
    data = list(adapter.step_collection.aggregate(pipe))
×
UNCOV
59
    return (
×
60
        format_grouped_plot_data(
61
            plot_data=data, group_field=group, trend_field=f"average_{field_replaced_dot}"
62
        )
63
        if group
64
        else format_plot_data(plot_data=data, trend_field=f"average_{field_replaced_dot}")
65
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc