-
Notifications
You must be signed in to change notification settings - Fork 6
interesting statistics from usage
James Kent edited this page Apr 19, 2025
·
1 revision
user_studies_with_analyses = (
BaseStudy.query
.filter(
exists()
.where(
(Study.base_study_id == BaseStudy.id) &
(Study.user_id != None) &
exists().where(
(Analysis.study_id == Study.id)
)
)
)
)
# 1672
user_studies = (
BaseStudy.query
.filter(
exists()
.where(
(Study.base_study_id == BaseStudy.id) &
(Study.user_id != None)
)
)
)
# 8463
publication_by_year = (
BaseStudy.query
.with_entities(
BaseStudy.year,
func.count(BaseStudy.id).label('publication_count')
)
.filter(BaseStudy.year != None) # Exclude records with no year
.group_by(BaseStudy.year)
.order_by(BaseStudy.year)
)