lomas_server.dp_queries package

Subpackages

Submodules

lomas_server.dp_queries.dp_querier module

class lomas_server.dp_queries.dp_querier.DPQuerier(private_dataset: PrivateDataset)[source]

Bases: ABC

Abstract Base Class for Queriers to external DP library.

A querier type is specific to a DP library and a querier instance is specific to a PrivateDataset instance.

abstract cost(query_json: BaseModel) tuple[float, float][source]

Estimate cost of query.

Parameters:

query_json (BaseModel) – The JSON request object for the query.

Returns:

The tuple of costs, the first value is

the epsilon cost, the second value is the delta value.

Return type:

tuple[float, float]

abstract query(query_json: BaseModel) str[source]

Perform the query and return the response.

Parameters:

query_json (BaseModel) – The JSON request object for the query.

Returns:

TODO check this. str: The JSON encoded string representation of the query result.

lomas_server.dp_queries.dummy_dataset module

lomas_server.dp_queries.dummy_dataset.get_dummy_dataset_for_query(admin_database: AdminDatabase, query_json: GetDummyDataset) InMemoryDataset[source]

Get a dummy dataset for a given query.

Parameters:
  • admin_database (AdminDatabase) – An initialized instance of AdminDatabase.

  • query_json (GetDummyDataset) – The JSON request object for the query.

Returns:

An in memory dummy dataset instance.

Return type:

InMemoryDataset

lomas_server.dp_queries.dummy_dataset.make_dummy_dataset(metadata: dict, nb_rows: int = 100, seed: int = 42) DataFrame[source]

Create a dummy dataset based on a metadata dictionnary

Parameters:
  • metadata (dict) – dictionnary of the metadata of the real dataset

  • nb_rows (int, optional) – _description_. Defaults to DUMMY_NB_ROWS.

  • seed (int, optional) – _description_. Defaults to DUMMY_SEED.

Raises:

InternalServerException – If any unknown column type occurs.

Returns:

dummy dataframe based on metadata

Return type:

pd.DataFrame

Module contents