Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ dependencies = [
"spacy>=3.8.11",
"en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl",
"flask-sqlalchemy>=3.1.1",
"python-dateutil>=2.9.0.post0",
]
7 changes: 6 additions & 1 deletion src/app/swagger_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@
"type": "string",
"description": "Information about supplementary files",
"example": "ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE12nnn/GSE12345/suppl/"
},
"publication_date": {
"type": "string",
"description": "Date of publication",
"example": "2026-01-01"
}
}
},
"ScoredGSE": {
"type": "object",
"properties": {
"gse": {
"gse_accession": {
"$ref": "#/definitions/GSE"
},
"score": {
Expand Down
14 changes: 13 additions & 1 deletion src/db/models/gse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Gene Expression Omnibus Series (GSE) data model."""
import datetime
from dataclasses import dataclass, field
from typing import Optional, List

Expand All @@ -8,6 +9,7 @@
from src.db.models.gse_gsm import GSE_GSM
from src.db.models.mapper_registry import mapper_registry

from dateutil import parser
from sqlalchemy import Index, Integer, PrimaryKeyConstraint, REAL, Text, Column

SUPERSERIES_SUMMARY = "This SuperSeries is composed of the SubSeries listed below."
Expand Down Expand Up @@ -51,8 +53,16 @@ class GSE:
def is_superseries(self):
return self.summary == SUPERSERIES_SUMMARY

@property
def publication_date(self) -> Optional[datetime.datetime]:
public_status_prefix = "Public on "
if self.status and self.status.startswith(public_status_prefix):
publication_date = self.status[len(public_status_prefix):]
return parser.parse(publication_date)
return parser.parse(self.last_update_date) if self.last_update_date else None

@dataclass()

@dataclass
class GSE_DTO:
ID: Optional[float]
title: Optional[str]
Expand All @@ -73,6 +83,7 @@ class GSE_DTO:
contact: Optional[str]
supplementary_file: Optional[str]
gsm_ids: List[str]
publication_date: Optional[str]

def __init__(self, gse: GSE):
self.ID = gse.ID
Expand All @@ -94,3 +105,4 @@ def __init__(self, gse: GSE):
self.contact = gse.contact
self.supplementary_file = gse.supplementary_file
self.gsm_ids = list(gse.gsm_ids)
self.publication_date = gse.publication_date.strftime("%Y-%m-%d") or None
2 changes: 2 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.