Initiate Data Review in Nominal with Python

Data review is the process of:

  1. Applying a checklist to a run
  2. Reviewing time ranges where checks were violated
  3. Determining if violations should be ignored or require further action

Read more on data review in the platform guide

In this guide, we focus on Step 1: Applying a checklist to a run using the Nominal Python client.

Prerequisites

Make sure you have the nominal Python package installed. You can install it using:

1pip3 install nominal

Connect to Nominal

Get your Nominal API token from your User settings page.

See the Quickstart for more details on connecting to Nominal from Python.

1import nominal.nominal as nm
2
3nm._config.set_token(
4 url = 'https://api.gov.nominal.io/api',
5 token = '* * *' # Replace with your Access Token from
6 # https://app.gov.nominal.io/settings/user?tab=tokens
7)
If you’re not sure whether your company has a Nominal tenant, please reach out to us.

Applying Checklists to Runs

Nominal allows you to apply multiple checklists to multiple runs simultaneously. You can also optionally specify integrations to send notifications if violations are found.

  1. Locate or Create Run RIDs

    Find the run RID(s) in the platform or create new runs with the Nominal client. Then paste the run RID(s) below.

    1run1_rid = "paste_rid_here"
    2run2_rid = "paste_rid_here"
  2. Locate Checklist RIDs and Commits

    Find the checklist RID(s) in the platform. You will also need the commit SHA for the version you want to apply (listed under “Latest version”).

    1checklist1_rid = "paste_rid_here"
    2checklist1_commit = "paste_commit_sha_here"
    3
    4checklist2_rid = "paste_rid_here"
    5checklist2_commit = "paste_commit_sha_here"
  3. Optionally, Specify an Integration

    If you would like to send notifications when violations occur, you can specify an integration RID. You can find the integration RID in the platform.

    1integration_rid = "paste_rid_here"
  4. Apply Checklists Use the Nominal client to create a data review builder, add your integration (optional), and add each request (which associates a run with a checklist). Then initiate the reviews.

    1review_builder = nm.data_review_builder()
    2review_builder.add_integration(integration_rid) # Optional
    3
    4# Add requests for run1
    5review_builder.add_request(run1_rid, checklist1_rid, checklist1_commit)
    6review_builder.add_request(run1_rid, checklist2_rid, checklist2_commit) # Optional
    7
    8# Add requests for run2
    9review_builder.add_request(run2_rid, checklist1_rid, checklist1_commit) # Optional
    10
    11# Initiate reviews
    12reviews = review_builder.initiate()
    13
    14# Print out results
    15for review in reviews:
    16 print(f"review: {review.rid}, URL: {review.nominal_url}")
    17 print(f" nr. of violations: {len(review.get_violations())})

That’s it! You have now applied one or more checklists to your runs, and you’ll be able to see any violations that arose.

Retrieving Data Review Results Later

You can retrieve the results of a data review at any time using the nm.get_data_review() function.

1review = nm.get_data_review(review_rid)
Built with