lomas_core package

Subpackages

Submodules

lomas_core.constants module

class lomas_core.constants.DPLibraries(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Name of DP Library used in the query.

DIFFPRIVLIB = 'diffprivlib'
OPENDP = 'opendp'
SMARTNOISE_SQL = 'smartnoise_sql'
SMARTNOISE_SYNTH = 'smartnoise_synth'
class lomas_core.constants.SSynthGanSynthesizer(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

GAN Synthesizer models for smartnoise synth.

DP_CTGAN = 'dpctgan'
DP_GAN = 'dpgan'
PATE_CTGAN = 'patectgan'
PATE_GAN = 'pategan'
class lomas_core.constants.SSynthMarginalSynthesizer(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Marginal Synthesizer models for smartnoise synth.

AIM = 'aim'
MST = 'mst'
MWEM = 'mwem'
PAC_SYNTH = 'pacsynth'

lomas_core.error_handler module

exception lomas_core.error_handler.ExternalLibraryException(library: DPLibraries, error_message: str)[source]

Bases: Exception

Custom exception for issues within external libraries.

This exception will occur when the processes fail within the external libraries (smartnoise-sql, opendp, diffprivlib)

exception lomas_core.error_handler.InternalServerException(error_message: str)[source]

Bases: Exception

Custom exception for issues within server internal functionalities.

exception lomas_core.error_handler.InvalidQueryException(error_message: str)[source]

Bases: Exception

Custom exception for invalid queries.

For example, this exception will occur when the query:
  • is not an opendp measurement

  • cannot be reconstructed properly (for opendp and diffprivlib)

exception lomas_core.error_handler.UnauthorizedAccessException(error_message: str)[source]

Bases: Exception

Custom exception for unauthorized access:

(unknown user, no access to dataset, etc)

lomas_core.error_handler.add_exception_handlers(app: FastAPI) None[source]

Translates custom exceptions to JSONResponses.

Parameters:

app (FastAPI) – A fastapi App.

lomas_core.logger module

Module contents