|
26 | 26 | AssayLayer,
|
27 | 27 | CohortLayer,
|
28 | 28 | FamilyLayer,
|
| 29 | + OurDnaDashboardLayer, |
29 | 30 | SampleLayer,
|
30 | 31 | SequencingGroupLayer,
|
31 | 32 | )
|
|
53 | 54 | )
|
54 | 55 | from models.models.analysis_runner import AnalysisRunnerInternal
|
55 | 56 | from models.models.family import PedRowInternal
|
| 57 | +from models.models.ourdna import OurDNADashboard, OurDNALostSample |
56 | 58 | from models.models.project import ProjectId
|
57 | 59 | from models.models.sample import sample_id_transform_to_raw
|
58 | 60 | from models.utils.cohort_id_format import cohort_id_format, cohort_id_transform_to_raw
|
@@ -89,6 +91,28 @@ async def m(info: Info) -> list[str]:
|
89 | 91 | GraphQLAnalysisStatus = strawberry.enum(AnalysisStatus)
|
90 | 92 |
|
91 | 93 |
|
| 94 | +@strawberry.experimental.pydantic.type(model=OurDNALostSample, all_fields=True) # type: ignore |
| 95 | +class GraphQLOurDNALostSample: |
| 96 | + """OurDNA Lost Sample GraphQL model to be used in OurDNA Dashboard""" |
| 97 | + |
| 98 | + pass # pylint: disable=unnecessary-pass |
| 99 | + |
| 100 | + |
| 101 | +@strawberry.experimental.pydantic.type(model=OurDNADashboard) # type: ignore |
| 102 | +class GraphQLOurDNADashboard: |
| 103 | + """OurDNA Dashboard model""" |
| 104 | + |
| 105 | + collection_to_process_end_time: strawberry.scalars.JSON |
| 106 | + collection_to_process_end_time_statistics: strawberry.scalars.JSON |
| 107 | + collection_to_process_end_time_24h: strawberry.scalars.JSON |
| 108 | + processing_times_by_site: strawberry.scalars.JSON |
| 109 | + total_samples_by_collection_event_name: strawberry.scalars.JSON |
| 110 | + samples_lost_after_collection: list[GraphQLOurDNALostSample] |
| 111 | + samples_concentration_gt_1ug: strawberry.scalars.JSON |
| 112 | + participants_consented_not_collected: list[int] |
| 113 | + participants_signed_not_consented: list[int] |
| 114 | + |
| 115 | + |
92 | 116 | # Create cohort GraphQL model
|
93 | 117 | @strawberry.type
|
94 | 118 | class GraphQLCohort:
|
@@ -244,6 +268,18 @@ async def analysis_runner(
|
244 | 268 | analysis_runners = await alayer.query(filter_)
|
245 | 269 | return [GraphQLAnalysisRunner.from_internal(ar) for ar in analysis_runners]
|
246 | 270 |
|
| 271 | + @strawberry.field |
| 272 | + async def ourdna_dashboard( |
| 273 | + self, info: Info, root: 'Project' |
| 274 | + ) -> 'GraphQLOurDNADashboard': |
| 275 | + connection = info.context['connection'] |
| 276 | + ourdna_layer = OurDnaDashboardLayer(connection) |
| 277 | + if not root.id: |
| 278 | + raise ValueError('Project must have an id') |
| 279 | + ourdna_dashboard = await ourdna_layer.query(project_id=root.id) |
| 280 | + # pylint: disable=no-member |
| 281 | + return GraphQLOurDNADashboard.from_pydantic(ourdna_dashboard) |
| 282 | + |
247 | 283 | @strawberry.field()
|
248 | 284 | async def pedigree(
|
249 | 285 | self,
|
|
0 commit comments