Skip to content

Commit

Permalink
some add. stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson committed Dec 26, 2024
1 parent 5503a73 commit 51b4526
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/regbot/fetch/clinical_trials.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import logging
from collections import namedtuple
from enum import StrEnum
from typing import NamedTuple

import requests
from requests.exceptions import RequestException
Expand Down Expand Up @@ -550,9 +551,6 @@ def _format_outcomes(outcomes: dict) -> Outcomes:
return Outcomes(primary_outcomes=primary, secondary_outcomes=secondary)


Eligibility = namedtuple("Eligibility", ("min_age", "max_age", "std_age"))


class StandardAge(StrEnum):
"""Define possible standardized age group values.
Expand All @@ -564,6 +562,17 @@ class StandardAge(StrEnum):
OLDER_ADULT = "older_adult"


class Eligibility(NamedTuple):
"""Describe eligibility for study
https://clinicaltrials.gov/data-api/about-api/study-data-structure#EligibilityModule
"""

min_age: datetime.timedelta
max_age: datetime.timedelta
std_age: StandardAge


# these are obviously imprecise, to varying degrees, but it's what we have to work with
_SECONDS_IN_MINUTE = 60
_SECONDS_IN_HOUR = 60 * _SECONDS_IN_MINUTE
Expand Down

0 comments on commit 51b4526

Please sign in to comment.