nci-cidc-api-modules 1.1.32__py3-none-any.whl → 1.1.34__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 CHANGED
@@ -3241,9 +3241,9 @@ class PreprocessedFiles(CommonColumns):
3241
3241
 
3242
3242
  @classmethod
3243
3243
  @with_default_session
3244
- def delete_pending_files_by_category(cls, file_category: str, session: Session = None):
3245
- """Delete all pending files matching given file_category."""
3246
- records = cls.get_files_by_category_and_status(file_category, "pending", session=session)
3244
+ def delete_pending_files_by_category(cls, file_category: str, trial_id: str = None, session: Session = None):
3245
+ """Delete all pending files matching given file_category and optional trial_id."""
3246
+ records = cls.get_files_by_category_and_status(file_category, "pending", trial_id=trial_id, session=session)
3247
3247
  for record in records:
3248
3248
  session.delete(record)
3249
3249
  session.commit()
@@ -3251,7 +3251,18 @@ class PreprocessedFiles(CommonColumns):
3251
3251
  @classmethod
3252
3252
  @with_default_session
3253
3253
  def get_files_by_category_and_status(
3254
- cls, file_category: str, status: str, session: Session = None
3254
+ cls, file_category: str, status: str, trial_id: str = None, session: Session = None
3255
3255
  ) -> list["PreprocessedFiles"]:
3256
- """Return all files matching given file_category and status."""
3257
- return session.query(cls).filter_by(file_category=file_category, status=status).all()
3256
+ """Return all files matching given file_category and status, optionally filtered by trial_id."""
3257
+ query = session.query(cls).filter_by(file_category=file_category, status=status)
3258
+ if trial_id:
3259
+ query = query.filter_by(trial_id=trial_id)
3260
+ return query.all()
3261
+
3262
+ @classmethod
3263
+ @with_default_session
3264
+ def get_file_by_category_and_version(
3265
+ cls, file_category: str, version: int, session: Session = None
3266
+ ) -> Optional["PreprocessedFiles"]:
3267
+ """Return the file matching the given category and version number."""
3268
+ return session.query(cls).filter_by(file_category=file_category, version=version).one_or_none()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_api_modules
3
- Version: 1.1.32
3
+ Version: 1.1.34
4
4
  Summary: SQLAlchemy data models and configuration tools used in the NCI CIDC API
5
5
  Home-page: https://github.com/NCI-CIDC/cidc-api-gae
6
6
  License: MIT license
@@ -28,7 +28,7 @@ Requires-Dist: python-dotenv==0.10.3
28
28
  Requires-Dist: requests==2.32.4
29
29
  Requires-Dist: jinja2==3.1.6
30
30
  Requires-Dist: certifi==2024.7.4
31
- Requires-Dist: nci-cidc-schemas==0.27.22
31
+ Requires-Dist: nci-cidc-schemas==0.27.25
32
32
  Dynamic: description
33
33
  Dynamic: description-content-type
34
34
  Dynamic: home-page
@@ -5,7 +5,7 @@ cidc_api/config/secrets.py,sha256=jRFj7W43pWuPf9DZQLCKF7WPXf5cUv-BAaS3ASqhV_Q,14
5
5
  cidc_api/config/settings.py,sha256=mA-4r7oB60uFepYtl5abbPigjwX8aBz__qCJXdcWWbs,4272
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=WU9nCAyYJEi1_TWyjSCrJ8XX1btPNa2xO7tpDWGccdU,131992
8
+ cidc_api/models/models.py,sha256=JceOfSBetV6ifhYIPL4Qp0T3YpG55M016YvEajLUQ8o,132587
9
9
  cidc_api/models/schemas.py,sha256=7tDYtmULuzTt2kg7RorWhte06ffalgpQKrFiDRGcPEQ,2711
10
10
  cidc_api/models/files/__init__.py,sha256=8BMTnUSHzUbz0lBeEQY6NvApxDD3GMWMduoVMos2g4Y,213
11
11
  cidc_api/models/files/details.py,sha256=WrWPxJqlsteinoNbGTaQ3fcxgvChqLGJ9vY7H829jtk,62842
@@ -16,8 +16,8 @@ cidc_api/shared/emails.py,sha256=GY-l0EkoVU_3hjV0g-xo7N9d1iyCdluyq_arftEPPe0,498
16
16
  cidc_api/shared/gcloud_client.py,sha256=oD7Y3Glp1ZrPYkonv7DvX1koGtF30lgm3ENXYQ7G5cI,35634
17
17
  cidc_api/shared/jose.py,sha256=-qzGzEDAlokEp9E7WtBtQkXyyfPWTYXlwYpCqVJWmqM,1830
18
18
  cidc_api/shared/rest_utils.py,sha256=RwR30WOUAYCxL7V-i2totEyeriG30GbBDvBcpLXhM9w,6594
19
- nci_cidc_api_modules-1.1.32.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
20
- nci_cidc_api_modules-1.1.32.dist-info/METADATA,sha256=K5SKeS-yZim2JWbhfsbrFo7G2vSegE4uYk5xy3lgtIA,41285
21
- nci_cidc_api_modules-1.1.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- nci_cidc_api_modules-1.1.32.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
23
- nci_cidc_api_modules-1.1.32.dist-info/RECORD,,
19
+ nci_cidc_api_modules-1.1.34.dist-info/licenses/LICENSE,sha256=pNYWVTHaYonnmJyplmeAp7tQAjosmDpAWjb34jjv7Xs,1102
20
+ nci_cidc_api_modules-1.1.34.dist-info/METADATA,sha256=RLRMhMdB-8zd-vX3O77F8VEdQf4cHISKnBF7fy-aEMc,41285
21
+ nci_cidc_api_modules-1.1.34.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ nci_cidc_api_modules-1.1.34.dist-info/top_level.txt,sha256=rNiRzL0lJGi5Q9tY9uSoMdTbJ-7u5c_D2E86KA94yRA,9
23
+ nci_cidc_api_modules-1.1.34.dist-info/RECORD,,