poprox_storage.concepts.manifest#
Experiment Manifest Parser
This module provides functionality for parsing and validating experiment manifest files in TOML format anf converting them into domain concept objects. The manifest files define experiment configurations including phases, user groups, recommenders, and assignments.
Functions
|
Convert duration string to timedelta object. |
|
Convert parsed manifest file to domain concept objects. |
|
Takes raw TOML content as a string, parses it, and restructures the phases section to match the expected ManifestFile schema. |
Classes
|
Experiment metadata and configuration. |
|
Parses and validates experiment manifest files that have been converted from TOML to Dict[str,Any] (e.g. using tomli). |
|
Specification of user groups for the experiment. |
|
Configuration for a single experiment phase. |
|
Assignment of a group to a recommender during a phase. |
|
Container for experiment phase configuration. |
|
Configuration for a recommender system. |
|
Information of the team that owns and manages the experiment, including team id and members. |
|
Specification for a single user group. |
- class poprox_storage.concepts.manifest.ManifestFile(**data)#
Bases:
BaseModel
Parses and validates experiment manifest files that have been converted from TOML to Dict[str,Any] (e.g. using tomli).
- Parameters:
data (Any)
experiment (ManifestExperiment)
owner (ManifestTeam)
users (ManifestGroupSpec)
recommenders (dict[str, ManifestRecommender])
phases (ManifestPhases)
- experiment#
Experiment metadata and configuration
- owner#
Experiment team owner
- users#
Specification of user groups participating in the experiment
- recommenders#
Dictionary mapping recommender names to their configurations
- phases#
Sequence of experiment phases
- class poprox_storage.concepts.manifest.ManifestExperiment(*, id, description, duration, start_date=None)#
Bases:
BaseModel
Experiment metadata and configuration.
Defines the basic properties of an experiment including its id, description, duration, and optional start date.
- start_date#
Optional start date. If None, defaults to tomorrow
- Type:
datetime.date | None
- class poprox_storage.concepts.manifest.ManifestTeam(*, team_id, team_name, members)#
Bases:
BaseModel
Information of the team that owns and manages the experiment, including team id and members.
- class poprox_storage.concepts.manifest.ManifestPhases(**data)#
Bases:
BaseModel
Container for experiment phase configuration.
Manages the sequence of phases and their individual configurations.
- Parameters:
data (Any)
phases (dict[str, ManifestPhase])
- phases#
Dictionary mapping phase names to their configurations
- class poprox_storage.concepts.manifest.ManifestPhase(**data)#
Bases:
BaseModel
Configuration for a single experiment phase.
Defines the duration and group assignments for a specific phase of the experiment.
- Parameters:
data (Any)
duration (str)
assignments (dict[str, ManifestPhaseAssignment])
- assignments#
Dictionary mapping group names to their phase assignments
- class poprox_storage.concepts.manifest.ManifestPhaseAssignment(*, recommender, template=None)#
Bases:
BaseModel
Assignment of a group to a recommender during a phase.
Specifies which recommender a particular group will use during a phase, along with optional template configuration.
- class poprox_storage.concepts.manifest.ManifestRecommender(*, url)#
Bases:
BaseModel
Configuration for a recommender system.
- Parameters:
url (str)
- class poprox_storage.concepts.manifest.ManifestGroupSpec(**data)#
Bases:
BaseModel
Specification of user groups for the experiment.
- Parameters:
data (Any)
groups (dict[str, ManifestUserGroup])
- groups#
Dictionary mapping group names to their specifications
- class poprox_storage.concepts.manifest.ManifestUserGroup(*, minimum_size=None, identical_to=None)#
Bases:
BaseModel
Specification for a single user group.
Defines the configuration for a user group, including size constraints and the ability to create identical copies of existing groups.
- poprox_storage.concepts.manifest.manifest_to_experiment(manifest)#
Convert parsed manifest file to domain concept objects.
Resolves manifest fields into their corresponding domain fields, including duration into dates and identical groups into copies. Doesn’t assign users to groups, which would require additional information about the state of the system beyond what’s contained in the manifest.
- Parameters:
manifest (ManifestFile) – A parsed experiment manifest as a Pydantic model
- Returns:
A transformed version of the manifest file as a domain object
- Return type:
- poprox_storage.concepts.manifest.convert_duration(duration)#
Convert duration string to timedelta object.
Supported formats: - “N week” or “N weeks” (where N is an integer) - “N day” or “N days” (where N is an integer)
- Parameters:
duration (str) – Duration on string format (e.g., “2 weeks”, “5 days”)
- Returns:
Equvalent timedelta object
- Return type:
timedelta
- poprox_storage.concepts.manifest.parse_manifest_toml(manifest_file)#
Takes raw TOML content as a string, parses it, and restructures the phases section to match the expected ManifestFile schema.
- Parameters:
manifest_file (str) – Raw TOML content as a string
- Returns:
Validated and parsed manifest file object
- Return type: