|
1 | 1 | # pylint: disable=too-many-locals, too-many-instance-attributes
|
2 | 2 | import asyncio
|
3 | 3 | import itertools
|
4 |
| -import json |
5 | 4 | import re
|
6 | 5 | from collections import defaultdict
|
7 | 6 | from datetime import date
|
|
15 | 14 | from db.python.tables.base import DbBase
|
16 | 15 | from db.python.tables.project import ProjectPermissionsTable
|
17 | 16 | from db.python.tables.sequencing_group import SequencingGroupTable
|
18 |
| -from db.python.utils import escape_like_term |
| 17 | +from db.python.utils import escape_like_term, from_db_json |
19 | 18 | from models.models import (
|
20 | 19 | AssayInternal,
|
21 | 20 | FamilySimpleInternal,
|
@@ -114,7 +113,7 @@ def _project_summary_process_assay_rows_by_sample_id(
|
114 | 113 | AssayInternal(
|
115 | 114 | id=seq['id'],
|
116 | 115 | type=seq['type'],
|
117 |
| - meta=json.loads(seq['meta']), |
| 116 | + meta=from_db_json(seq['meta']), |
118 | 117 | sample_id=seq['sample_id'],
|
119 | 118 | )
|
120 | 119 | for seq in assay_rows
|
@@ -153,7 +152,7 @@ def _project_summary_process_sequencing_group_rows_by_sample_id(
|
153 | 152 | sg_id_to_sample_id[sg_id] = row['sample_id']
|
154 | 153 | sg_by_id[sg_id] = NestedSequencingGroupInternal(
|
155 | 154 | id=sg_id,
|
156 |
| - meta=json.loads(row['meta']), |
| 155 | + meta=from_db_json(row['meta']), |
157 | 156 | type=row['type'],
|
158 | 157 | technology=row['technology'],
|
159 | 158 | platform=row['platform'],
|
@@ -189,9 +188,9 @@ def _project_summary_process_sample_rows(
|
189 | 188 | smodels = [
|
190 | 189 | NestedSampleInternal(
|
191 | 190 | id=s['id'],
|
192 |
| - external_ids=json.loads(s['external_ids']), |
| 191 | + external_ids=from_db_json(s['external_ids']), |
193 | 192 | type=s['type'],
|
194 |
| - meta=json.loads(s['meta']) or {}, |
| 193 | + meta=from_db_json(s['meta']) or {}, |
195 | 194 | created_date=str(sample_id_start_times.get(s['id'], '')),
|
196 | 195 | sequencing_groups=sg_models_by_sample_id.get(s['id'], []),
|
197 | 196 | non_sequencing_assays=filtered_assay_models_by_sid.get(s['id'], []),
|
@@ -450,8 +449,8 @@ async def get_project_summary(
|
450 | 449 | pmodels.append(
|
451 | 450 | NestedParticipantInternal(
|
452 | 451 | id=p['id'],
|
453 |
| - external_ids=json.loads(p['external_ids']), |
454 |
| - meta=json.loads(p['meta']), |
| 452 | + external_ids=from_db_json(p['external_ids']), |
| 453 | + meta=from_db_json(p['meta']), |
455 | 454 | families=pid_to_families.get(p['id'], []),
|
456 | 455 | samples=list(smodels_by_pid.get(p['id'])),
|
457 | 456 | reported_sex=p['reported_sex'],
|
|
0 commit comments