Delta-presence (*δ* -presence) is a metric that quantifies the probability that
an individual belongs to an analyzed dataset. Like [*k*-map](https://docs.cloud.google.com/sensitive-data-protection/docs/compute-d-presence.md.txt#compute-k-map),
you can estimate *δ*-presence values using Sensitive Data Protection, which
uses a statistical model to estimate the attack dataset.

*δ*-presence contrasts with the other risk analysis methods, in which the
attack dataset is explicitly known. Depending on the type of data,
Sensitive Data Protection uses publicly available datasets (for example, from the
US Census) or a custom statistical model (for example, one or more
BigQuery tables that you specify), or it extrapolates from the
distribution of values in your input dataset.

This topic demonstrates how to compute *δ* -presence values for a dataset using
Sensitive Data Protection. For more information about *δ* -presence or risk analysis in
general, see the [risk analysis concept topic](https://docs.cloud.google.com/sensitive-data-protection/docs/concepts-risk-analysis.md.txt)
before continuing on.

> [!NOTE]
> **Note:** At this time, you can only compute *δ* -presence values using the DLP API or Sensitive Data Protection-supported [client
> libraries](https://docs.cloud.google.com/sensitive-data-protection/docs/libraries). Sensitive Data Protection in the Google Cloud console doesn't support computing *δ*-presence values.

<br />

> [!IMPORTANT]
> **Note:** Prematurely canceling an operation midway through a job still incurs costs for the portion of the job that was completed. For more information about billing, see [Sensitive Data Protection pricing](https://cloud.google.com/sensitive-data-protection/pricing).

<br />

## Before you begin


Before continuing, be sure you've done the following:

1. [Sign in](https://accounts.google.com/Login) to your Google Account.
2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
[Go to the project selector](https://console.cloud.google.com/projectselector2/home/dashboard)
3. Make sure that billing is enabled for your Google Cloud project. [Learn how to confirm billing is enabled for your
   project.](https://docs.cloud.google.com/billing/docs/how-to/modify-project)
4. Enable Sensitive Data Protection.
[Enable Sensitive Data Protection](https://console.cloud.google.com/apis/enableflow?apiid=dlp.googleapis.com)
5. Select a BigQuery dataset to analyze. Sensitive Data Protection estimates the *δ*-presence metric by scanning a BigQuery table.
6. Determine the types of datasets you want to use to model the attack dataset. For more information, see the reference page for the [`DeltaPresenceEstimationConfig`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#deltapresenceestimationconfig) object, as well as [Risk
   analysis terms and techniques](https://docs.cloud.google.com/sensitive-data-protection/docs/concepts-risk-analysis#risk_analysis_terms_and_techniques).

<br />

## Compute *δ*-presence metrics

To compute a *δ* -presence estimate using Sensitive Data Protection, send a request
to the following URL, where <var translate="no">PROJECT_ID</var> indicates your [project
identifier](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects):

```
https://dlp.googleapis.com/v2/projects/PROJECT_ID/dlpJobs
```

The request contains a
[`RiskAnalysisJobConfig`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#DlpJob.RiskAnalysisJobConfig)
object, which is composed of the following:

- A
  [`PrivacyMetric`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#privacymetric)
  object. This is where you specify that you want to calculate *δ* -presence by
  specifying a
  [`DeltaPresenceEstimationConfig`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#deltapresenceestimationconfig)
  object containing the following:

  - `quasiIds[]`: Required. Fields
    ([`QuasiId`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#quasiid)
    objects) considered to be quasi-identifiers to scan and use to compute
    *δ*-presence. No two columns can have the same tag. These can be any of the
    following:

    - An [infoType](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/InfoType.md.txt): This causes Sensitive Data Protection to use the relevant public dataset as a statistical model of population, including US ZIP codes, region codes, ages, and genders.
    - A custom infoType: A custom tag wherein you indicate an auxiliary table (an [`AuxiliaryTable`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#DlpJob.AuxiliaryTable) object) that contains statistical information about the possible values of this column.
    - The `inferred` tag: If no semantic tag is indicated, specify `inferred`. Sensitive Data Protection infers the statistical model from the distribution of values in the input data.
  - `regionCode`: An
    [ISO 3166-1 alpha-2 region code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
    for Sensitive Data Protection to use in statistical modeling. This value
    is required if no column is tagged with a region-specific infoType (for
    example, a US ZIP code) or a region code.

  - `auxiliaryTables[]`: Auxiliary tables
    ([`StatisticalTable`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#statisticaltable)
    objects) to use in the analysis. Each custom tag used to tag a
    quasi-identifier column (from `quasiIds[]`) must appear in exactly one
    column of one auxiliary table.

- A [`BigQueryTable`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/BigQueryTable.md.txt)
  object. Specify the BigQuery table to scan by including all of
  the following:

  - `projectId`: The project ID of the project containing the table.
  - `datasetId`: The dataset ID of the table.
  - `tableId`: The name of the table.
- A set of one or more
  [`Action`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/Action.md.txt)
  objects, which represent actions to run, in the order given, at the
  completion of the job. Each `Action` object can contain one of the
  following actions:

  - [`SaveFindings`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/Action.md.txt#SaveFindings) object: Saves the results of the risk analysis scan to a BigQuery table.
  - [`PublishToPubSub`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/Action.md.txt#PublishToPubSub) object: [Publishes a notification to a Pub/Sub topic](https://docs.cloud.google.com/pubsub/docs/publisher.md.txt).

  > [!NOTE]
  > **Note:** If there are configuration or permission issues with the Pub/Sub topic, Sensitive Data Protection retries sending the Pub/Sub notification for up to two weeks. After two weeks, the notification is discarded.

  - [`PublishSummaryToCscc`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/InspectJobConfig.md.txt#PublishSummaryToCscc) object: Saves a results summary to Security Command Center.
  - [`JobNotificationEmails`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/InspectJobConfig.md.txt#JobNotificationEmails) object: Sends you an email with results.
  - [`PublishToStackdriver`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/InspectJobConfig.md.txt#PublishToStackdriver) object: Saves results to Google Cloud Observability.

## Viewing *δ*-presence job results

To retrieve the results of the *δ* -presence risk analysis job using the REST
API, send the following GET request to the
[`projects.dlpJobs`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs/get.md.txt)
resource. Replace <var translate="no">PROJECT_ID</var> with your project ID and
<var translate="no">JOB_ID</var> with the identifier of the job you want to obtain results for.
The job ID was returned when you started the job, and can also be retrieved by
[listing all jobs](https://docs.cloud.google.com/sensitive-data-protection/docs/compute-d-presence.md.txt#list-jobs).

```
GET https://dlp.googleapis.com/v2/projects/PROJECT_ID/dlpJobs/JOB_ID
```

The request returns a JSON object containing an instance of the job. The results
of the analysis are inside the `"riskDetails"` key, in an
[`AnalyzeDataSourceRiskDetails`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#DlpJob.AnalyzeDataSourceRiskDetails)
object. For more information, see the API reference for the
[`DlpJob`](https://docs.cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs.md.txt#DlpJob)
resource.

## What's next

- Learn how to calculate the [*k*-anonymity](https://docs.cloud.google.com/sensitive-data-protection/docs/compute-k-anonymity.md.txt) value for a dataset.
- Learn how to calculate the [*l*-diversity](https://docs.cloud.google.com/sensitive-data-protection/docs/compute-l-diversity.md.txt) value for a dataset.
- Learn how to calculate the [*k*-map](https://docs.cloud.google.com/sensitive-data-protection/docs/compute-k-map.md.txt) value for a dataset.