nci-cidc-api-modules 1.2.7__py3-none-any.whl → 1.2.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cidc_api/models/models.py +26 -11
- {nci_cidc_api_modules-1.2.7.dist-info → nci_cidc_api_modules-1.2.9.dist-info}/METADATA +1 -1
- {nci_cidc_api_modules-1.2.7.dist-info → nci_cidc_api_modules-1.2.9.dist-info}/RECORD +6 -6
- {nci_cidc_api_modules-1.2.7.dist-info → nci_cidc_api_modules-1.2.9.dist-info}/WHEEL +0 -0
- {nci_cidc_api_modules-1.2.7.dist-info → nci_cidc_api_modules-1.2.9.dist-info}/licenses/LICENSE +0 -0
- {nci_cidc_api_modules-1.2.7.dist-info → nci_cidc_api_modules-1.2.9.dist-info}/top_level.txt +0 -0
cidc_api/models/models.py
CHANGED
@@ -28,6 +28,7 @@ __all__ = [
|
|
28
28
|
"JobFileCategories",
|
29
29
|
"ValidationConfigs",
|
30
30
|
"TRIAL_APPENDIX_A",
|
31
|
+
"TRIAL_APPENDIX_A_CELL_THAT_ENDS_THE_HEADER",
|
31
32
|
"REQUEST_LETTER",
|
32
33
|
"ADMIN_FILE_CATEGORIES",
|
33
34
|
"FINAL_JOB_STATUS",
|
@@ -82,7 +83,6 @@ from sqlalchemy import (
|
|
82
83
|
Boolean,
|
83
84
|
CheckConstraint,
|
84
85
|
Column,
|
85
|
-
Date,
|
86
86
|
DateTime,
|
87
87
|
Enum,
|
88
88
|
ForeignKey,
|
@@ -150,6 +150,10 @@ from ..shared.gcloud_client import (
|
|
150
150
|
os.environ["TZ"] = "UTC"
|
151
151
|
logger = get_logger(__name__)
|
152
152
|
|
153
|
+
# pylint: disable=protected-access,not-callable,no-value-for-parameter,too-many-positional-arguments
|
154
|
+
# pylint: disable=unsubscriptable-object,singleton-comparison,broad-exception-raised,redefined-builtin
|
155
|
+
# pylint: disable=arguments-renamed,logging-fstring-interpolation,disable=comparison-with-callable
|
156
|
+
|
153
157
|
|
154
158
|
class FileGroups:
|
155
159
|
pass
|
@@ -3243,7 +3247,8 @@ def upload_manifest_json(
|
|
3243
3247
|
|
3244
3248
|
TRIAL_APPENDIX_A = "trial_appendix_a"
|
3245
3249
|
REQUEST_LETTER = "request_letter"
|
3246
|
-
|
3250
|
+
DETAILED_VALIDATION = "detailed_validation"
|
3251
|
+
ADMIN_FILE_CATEGORIES = [TRIAL_APPENDIX_A, REQUEST_LETTER, DETAILED_VALIDATION]
|
3247
3252
|
|
3248
3253
|
|
3249
3254
|
class PreprocessedFiles(CommonColumns):
|
@@ -3391,8 +3396,8 @@ class PreprocessedFiles(CommonColumns):
|
|
3391
3396
|
"""
|
3392
3397
|
if job_id is not None:
|
3393
3398
|
return query.filter_by(job_id=job_id)
|
3394
|
-
|
3395
|
-
|
3399
|
+
|
3400
|
+
return query.filter(cls.job_id.is_(None))
|
3396
3401
|
|
3397
3402
|
|
3398
3403
|
INGESTION_JOB_STATUSES = [
|
@@ -3415,6 +3420,7 @@ INGESTION_JOB_COLORS = {
|
|
3415
3420
|
}
|
3416
3421
|
# TODO If have "CANCELLED" concept or other final status, add here
|
3417
3422
|
FINAL_JOB_STATUS = ["PUBLISHED"]
|
3423
|
+
TRIAL_APPENDIX_A_CELL_THAT_ENDS_THE_HEADER = "Data Category"
|
3418
3424
|
|
3419
3425
|
|
3420
3426
|
class IngestionJobs(CommonColumns):
|
@@ -3455,16 +3461,16 @@ class IngestionJobs(CommonColumns):
|
|
3455
3461
|
df = gcs_xlsx_or_csv_file_to_pandas_dataframe(GOOGLE_CLINICAL_DATA_BUCKET, appendix_a.object_url)
|
3456
3462
|
categories = []
|
3457
3463
|
headers_ended = False
|
3458
|
-
for
|
3464
|
+
for _index, row in df.iterrows():
|
3459
3465
|
cell = str(row.iloc[0])
|
3460
3466
|
if headers_ended:
|
3461
|
-
if
|
3467
|
+
if cell != "nan" and cell not in categories:
|
3462
3468
|
categories.append(cell)
|
3463
|
-
elif cell ==
|
3469
|
+
elif cell.lower() == TRIAL_APPENDIX_A_CELL_THAT_ENDS_THE_HEADER.lower():
|
3464
3470
|
headers_ended = True
|
3465
|
-
if "
|
3471
|
+
if "data_dictionary" not in categories:
|
3466
3472
|
# Ensure Data_Dictionary is always a required file category
|
3467
|
-
categories.append("
|
3473
|
+
categories.append("data_dictionary")
|
3468
3474
|
return categories
|
3469
3475
|
|
3470
3476
|
@classmethod
|
@@ -3608,13 +3614,22 @@ class FileValidationErrors(CommonColumns):
|
|
3608
3614
|
@classmethod
|
3609
3615
|
@with_default_session
|
3610
3616
|
def get_errors_for_job_sorted_by_file_id(cls, job_id: int, session: Session = None) -> list["FileValidationErrors"]:
|
3611
|
-
|
3617
|
+
errors = (
|
3618
|
+
session.query(cls)
|
3619
|
+
.join(PreprocessedFiles)
|
3620
|
+
.filter(PreprocessedFiles.status == "current")
|
3621
|
+
.filter(cls.job_id == job_id)
|
3622
|
+
.order_by(cls.file_id.asc())
|
3623
|
+
.all()
|
3624
|
+
)
|
3625
|
+
|
3626
|
+
return errors
|
3612
3627
|
|
3613
3628
|
|
3614
3629
|
class ValidationConfigs(CommonColumns):
|
3615
3630
|
__tablename__ = "validation_configs"
|
3616
3631
|
|
3617
|
-
|
3632
|
+
data_element = Column(String, nullable=True)
|
3618
3633
|
validation = Column(String, nullable=True)
|
3619
3634
|
scope = Column(String, nullable=True)
|
3620
3635
|
active = Column(Boolean, nullable=False, default=True, server_default="true")
|
@@ -5,7 +5,7 @@ cidc_api/config/secrets.py,sha256=jRFj7W43pWuPf9DZQLCKF7WPXf5cUv-BAaS3ASqhV_Q,14
|
|
5
5
|
cidc_api/config/settings.py,sha256=NsJbqW6Vqcz2f79xcAbk4th5tHne_I-RPCbKq_3hpz0,4427
|
6
6
|
cidc_api/models/__init__.py,sha256=bl445G8Zic9YbhZ8ZBni07wtBMhLJRMBA-JqjLxx2bw,66
|
7
7
|
cidc_api/models/migrations.py,sha256=gp9vtkYbA9FFy2s-7woelAmsvQbJ41LO2_DY-YkFIrQ,11464
|
8
|
-
cidc_api/models/models.py,sha256=
|
8
|
+
cidc_api/models/models.py,sha256=UuMSZCJnKwik-xxijZJzRRlSkM6DL3325VVwqyLwrdE,146929
|
9
9
|
cidc_api/models/schemas.py,sha256=6IE2dJoEMcMbi0Vr1V3cYKnPKU0hv9vRKBixOZHe88s,2766
|
10
10
|
cidc_api/models/files/__init__.py,sha256=8BMTnUSHzUbz0lBeEQY6NvApxDD3GMWMduoVMos2g4Y,213
|
11
11
|
cidc_api/models/files/details.py,sha256=sZkGM7iEV4-J6IDQCdiMV6KBDLbPxCOqUMaU3aY9rX8,65153
|
@@ -17,8 +17,8 @@ cidc_api/shared/file_handling.py,sha256=l4wiRkVJLL7QbCoODsLx-uki6Km8QoMmUlRVnUV9
|
|
17
17
|
cidc_api/shared/gcloud_client.py,sha256=ETQ34qKtO7l0svVhiHXxXewiyNjwIMgoeVcqrg-Twtk,36902
|
18
18
|
cidc_api/shared/jose.py,sha256=-qzGzEDAlokEp9E7WtBtQkXyyfPWTYXlwYpCqVJWmqM,1830
|
19
19
|
cidc_api/shared/rest_utils.py,sha256=RwR30WOUAYCxL7V-i2totEyeriG30GbBDvBcpLXhM9w,6594
|
20
|
-
nci_cidc_api_modules-1.2.
|
21
|
-
nci_cidc_api_modules-1.2.
|
22
|
-
nci_cidc_api_modules-1.2.
|
23
|
-
nci_cidc_api_modules-1.2.
|
24
|
-
nci_cidc_api_modules-1.2.
|
20
|
+
nci_cidc_api_modules-1.2.9.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
|
21
|
+
nci_cidc_api_modules-1.2.9.dist-info/METADATA,sha256=YtN0QLuxkUxBd_pqLLO9RcukYocWaevXw91L0F-sqoY,39538
|
22
|
+
nci_cidc_api_modules-1.2.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
nci_cidc_api_modules-1.2.9.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
|
24
|
+
nci_cidc_api_modules-1.2.9.dist-info/RECORD,,
|
File without changes
|
{nci_cidc_api_modules-1.2.7.dist-info → nci_cidc_api_modules-1.2.9.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|