Source code for lomas_core.constants

from enum import StrEnum

from opendp import measures as ms, typing as tp

# Server error messages
INTERNAL_SERVER_ERROR = "Internal server error. Please contact the administrator of this service."


[docs] class DPLibraries(StrEnum): """Name of DP Library used in the query.""" SMARTNOISE_SQL = "smartnoise_sql" SMARTNOISE_SYNTH = "smartnoise_synth" OPENDP = "opendp" OPENDP_POLARS = "opendp_polars" DIFFPRIVLIB = "diffprivlib"
# OpenDP
[docs] class OpenDpMechanism(StrEnum): """Name of OpenDP mechanisms.""" LAPLACE = "laplace" GAUSSIAN = "gaussian"
[docs] class OpenDpPipelineType(StrEnum): """Name of OpenDP pipelines.""" LEGACY = "legacy" POLARS = "polars"
OPENDP_OUTPUT_MEASURE: dict[OpenDpMechanism, tp.Measure] = { OpenDpMechanism.LAPLACE: ms.max_divergence(), OpenDpMechanism.GAUSSIAN: ms.zero_concentrated_divergence(), } OPENDP_TYPE_MAPPING = { "int32": tp.i32, "float32": tp.f32, "int64": tp.i64, "float64": tp.f64, "string": tp.String, "boolean": bool, } # Smartnoise synth
[docs] class SSynthMarginalSynthesizer(StrEnum): """Marginal Synthesizer models for smartnoise synth.""" AIM = "aim" MWEM = "mwem" MST = "mst" PAC_SYNTH = "pacsynth"
[docs] class SSynthGanSynthesizer(StrEnum): """GAN Synthesizer models for smartnoise synth.""" DP_CTGAN = "dpctgan" PATE_CTGAN = "patectgan" PATE_GAN = "pategan" DP_GAN = "dpgan"
# Security # ------------------------------------------------
[docs] class Scopes(StrEnum): """List of security scopes for the server endpoints.""" ADMIN = "admin"