ersilia.db.hubdata package

Submodules

ersilia.db.hubdata.interfaces module

class ersilia.db.hubdata.interfaces.JsonModelsInterface(config_json=None)[source]

Bases: ErsiliaBase

Interface for fetching model metadata from models stored in S3.

Parameters:

config_json (dict, optional) – Configuration settings for initializing the interface.

identifier_exists(model_id)[source]

Checks if a model identifier exists in the JSON file.

Parameters:

model_id (str) – Identifier of the model to check.

Returns:

True if the identifier exists, False otherwise.

Return type:

bool

items()[source]

Yields models from the JSON file one by one.

Yields:

dict – A model from the JSON file.

items_all()[source]

Retrieves all models from the JSON file.

Returns:

List of all models.

Return type:

list

ersilia.db.hubdata.localslugs module

class ersilia.db.hubdata.localslugs.SlugDb(config_json=None)[source]

Bases: ErsiliaBase

Manages slug database operations for models.

Parameters:

config_json (dict, optional) – Configuration settings for initializing the slug database.

clean()[source]

Cleans the database by deleting all entries.

create_table()[source]

Creates the slugs table in the database if it does not exist.

delete(model_id, slug)[source]

Deletes a specific entry from the database by model ID and slug.

Parameters:
  • model_id (str) – Identifier of the model.

  • slug (str) – Slug associated with the model.

delete_by_model_id(model_id)[source]

Deletes entries from the database by model ID.

Parameters:

model_id (str) – Identifier of the model to delete.

delete_by_slug(slug)[source]

Deletes entries from the database by slug.

Parameters:

slug (str) – Slug to delete.

insert(model_id, slug)[source]

Inserts a model ID and slug into the database.

Parameters:
  • model_id (str) – Identifier of the model.

  • slug (str) – Slug associated with the model.

models_of_slug(slug)[source]

Retrieves model IDs associated with a specific slug.

Parameters:

slug (str) – Slug to search for.

Returns:

Set of model IDs associated with the slug.

Return type:

set

slugs_of_model(model_id)[source]

Retrieves slugs associated with a specific model ID.

Parameters:

model_id (str) – Identifier of the model to search for.

Returns:

Set of slugs associated with the model ID.

Return type:

set

ersilia.db.hubdata.sanitize module

ersilia.db.hubdata.tables module

class ersilia.db.hubdata.tables.DynamoDbTable[source]

Bases: object

Base class for DynamoDB tables.

class ersilia.db.hubdata.tables.ModelsTable[source]

Bases: DynamoDbTable

Table for storing models.

class ersilia.db.hubdata.tables.PredictionsTable[source]

Bases: DynamoDbTable

Table for storing predictions.

Module contents