# Build an OEWS market data solution

> Pull BLS wage statistics into Rippling with custom settings, functions, custom objects, and a custom app.

## Overview

This guide shows you how to store Occupational Employment and Wage Statistics (OEWS) from the U.S. Bureau of Labor Statistics (BLS) in Rippling. You save a registration key and series IDs, a function calls the BLS timeseries API, and Rippling keeps both the wage snapshots and every ingest attempt.

The OEWS package installs the working app, including a Software Developer wage series. Use it to load that series, then read the source and point the same pattern at another dataset.

### When to use this solution

Use this approach when market wage data should live in Rippling and you want to:

-   Pull a chosen set of BLS series on demand.
-   Keep wage observations separate from the history of each pull.
-   Review the latest snapshots and ingest results in one app.

### What you'll build

-   [Custom settings](https://developer.rippling.com/documentation/rippling-platform/developer/custom-settings) that store the BLS key as a secret and the series list as configuration.
-   An [SDUI function](https://developer.rippling.com/documentation/rippling-platform/sdui/getting-started) that renders settings, refresh controls, recent snapshots, and ingest results.
-   An [async function](https://developer.rippling.com/documentation/rippling-platform/developer/functions/getting-started) that calls BLS, normalizes the response, and upserts records.
-   [Allowed domains](https://developer.rippling.com/documentation/rippling-platform/developer/functions/getting-started#update-allowed-domains) that restrict outbound requests to `api.bls.gov`.
-   [Custom objects](https://developer.rippling.com/documentation/rippling-platform/custom-objects/getting-started) that store market snapshots and ingest history.
-   [Validations](https://developer.rippling.com/documentation/rippling-platform/custom-objects/rules-and-validations#validations) that reject inconsistent successful snapshots and malformed metro area codes.
-   [Rules](https://developer.rippling.com/documentation/rippling-platform/custom-objects/rules-and-validations#rules) that default new snapshot and ingest statuses.
-   A [custom app](https://developer.rippling.com/documentation/rippling-platform/custom-apps/get-started) that combines configuration, data, and operational history.

### Architecture

1.  Install the package so the settings, objects, functions, and app land together.
2.  Save a BLS registration key and up to 50 series IDs.
3.  Refresh market data. The function calls `api.bls.gov`, groups related wage measures into one snapshot, and writes an ingest run.
4.  Review **OEWS Snapshots** and **Ingest Runs** in the app.

_**Figure 1:** A saved BLS key and series list call api.bls.gov, then land as snapshot rows and an ingest run._

## Requirements

Before you begin, you need:

-   **Rippling products:** Custom Objects, Custom Apps, Functions, and Custom Settings.
-   A test company where you can install a developer package.
-   A BLS registration key from the [BLS Public Data API](https://data.bls.gov/registrationEngine/). The public API allows calls without a key at a lower limit. This package expects a key.
-   Outbound access from the pull function to `api.bls.gov` only. The package sets that allowed domain.

The settings page stores the key as a secret and does not read it back after you save it. The pull runs as the signed-in user. You do not create a separate Rippling API token for this package.

* * *

## Install the package

> **Example package:**
> This package is designed for learning and demonstrations. Review the BLS API terms, rate limits, source series, data freshness, permissions, and error handling before adapting it for production use.

1.  Open the [OEWS Market Data package](https://app.rippling.com/developer/packages/install/oews_market_data/1.0.11).
2.  Review the included components.
3.  Complete the installation in a test company.
4.  Open **OEWS Market Data** from the Rippling sidebar.

* * *

## Save the BLS settings

Register through the [BLS Public Data API](https://data.bls.gov/registrationEngine/), then enter the key on the package settings page.

| Display name | Input type | Value |
| --- | --- | --- |
| BLS registration key | Secret | Registration key from BLS |
| OEWS series IDs | String | Up to 50 series IDs, 25 characters each |

### Review the default series

The package starts with 20 series for Software Developers (`SOC 15-1252`). Each location requests annual p25, median, p75, and employment.

| Area | Area code | Measures |
| --- | --- | --- |
| San Francisco | `0041860` | p25, median, p75, employment |
| New York | `0035620` | p25, median, p75, employment |
| Seattle | `0042660` | p25, median, p75, employment |
| Austin | `0012420` | p25, median, p75, employment |
| Charlotte | `0016740` | p25, median, p75, employment |

The settings page supplies the same full series IDs used by the demo package:

```text
OEUM004186000000015125212, OEUM004186000000015125213,
OEUM004186000000015125214, OEUM004186000000015125201,
OEUM003562000000015125212, OEUM003562000000015125213,
OEUM003562000000015125214, OEUM003562000000015125201,
OEUM004266000000015125212, OEUM004266000000015125213,
OEUM004266000000015125214, OEUM004266000000015125201,
OEUM001242000000015125212, OEUM001242000000015125213,
OEUM001242000000015125214, OEUM001242000000015125201,
OEUM001674000000015125212, OEUM001674000000015125213,
OEUM001674000000015125214, OEUM001674000000015125201
```

### Save and refresh

1.  Enter the BLS registration key.
2.  Keep the default series, or replace them with up to 50 valid 25-character series IDs.
3.  Save the settings.
4.  Select **Refresh market data**.
5.  Wait for the async function to finish, then reload the results.
6.  Review **OEWS Snapshots** and **Ingest Runs**.

A second refresh updates the same snapshots. It does not create a duplicate row for a series you already stored.

* * *

## Read the stored records

Each snapshot is one market cell for an occupation, area, industry, and survey year. Ingest history stays on its own object so a failed pull does not become a wage row.

### OEWS Snapshot

| Field name | API name | Field type | Data type | Description |
| --- | --- | --- | --- | --- |
| Series ID | `series_id__c` | Basic | Text | Representative BLS series ID for this snapshot |
| SOC code | `soc_code__c` | Basic | Text | Occupation code parsed from the series ID |
| NAICS code | `naics_code__c` | Basic | Text | Industry code parsed from the series ID |
| Area type | `area_type__c` | Basic | Choice | National (`N`), state (`S`), or metro (`M`) |
| Area code | `area_code__c` | Basic | Text | Geographic code parsed from the series ID |
| Area label | `area_label__c` | Basic | Text | Readable area name |
| Survey year | `survey_year__c` | Basic | Date | Survey year, stored as May 1 of that year |
| P25 annual | `p25_annual__c` | Basic | Currency | 25th-percentile annual wage |
| Median annual | `median_annual__c` | Basic | Currency | Median annual wage |
| P75 annual | `p75_annual__c` | Basic | Currency | 75th-percentile annual wage |
| Mean annual | `mean_annual__c` | Basic | Currency | Mean annual wage, when requested |
| Employment | `employment__c` | Basic | Number | Employment estimate, when requested |
| Footnote | `footnote__c` | Basic | Long text | BLS footnote or suppression note |
| Sync status | `sync_status__c` | Basic | Choice | `OK`, `SUPPRESSED`, or `ERROR` |
| Synced at | `synced_at__c` | Basic | Date time | When this snapshot was last written |

A snapshot can be `OK` only when it stores a p25, median, or p75 wage. Metro area codes must be 7 characters.

### Ingest Run

| Field name | API name | Field type | Data type | Description |
| --- | --- | --- | --- | --- |
| Status | `status__c` | Basic | Choice | `RUNNING`, `OK`, or `ERROR` |
| Series requested | `series_requested__c` | Basic | Long text | Series IDs submitted to BLS |
| BLS message | `bls_message__c` | Basic | Long text | Response or failure detail, with the API key removed |
| Records upserted | `records_upserted__c` | Basic | Number | Snapshot rows written by this pull |
| Started at | `started_at__c` | Basic | Date time | When the pull started |
| Finished at | `finished_at__c` | Basic | Date time | When the pull finished |

New snapshots default to `SUPPRESSED` until a pull writes `OK` or `ERROR`. New ingest runs default to `RUNNING`.

* * *

## Explore the source

The public sample is a sanitized copy of the package source. Internal logging utilities and internal-only references have been removed.

### Package manifest

`pull_oews_snapshots` is async, can run for up to 15 minutes, and can call only `api.bls.gov`. The manifest also defines layouts, list views, validations, defaulting rules, search fields, and the custom app.

[View the full OEWS package manifest](https://developer.rippling.com/assets/files/rippling.manifest-7fcfa6a8d5f4c8c5d4b7ab2d4856d0b1.ts)

The pull function is async, can run for up to 15 minutes, and can only call BLS:

```typescript
new ManifestFunction(manifest, {
  apiName: 'pull_oews_snapshots',
  name: 'Pull OEWS snapshots',
  code: readFunction('pull_oews_snapshots'),
  dependencies: { '@rippling/rippling-sdk': '0.2.0-alpha.85' },
  deploymentOptions: { lambda_timeout_sec: 900 },
  allowedDomains: ['api.bls.gov'],
  isAsync: true,
});
```

The manifest also defines record layouts, public list views, validation rules, defaulting rules, search fields, and the three-page custom app.

### Settings page function

[View the full OEWS settings function](https://developer.rippling.com/assets/files/function-1987bf0240add6574f29e51005c67e19.ts)

The settings function:

-   Uses a password input for the BLS key
-   Validates the count and length of series IDs
-   Stores the key with the `SECRET` data type
-   Stores the normalized series list as a string
-   Invokes the async pull function from the same page
-   Shows recent snapshots and ingest runs

```typescript
await saveSetting(
  writer,
  settings,
  keyApiName,
  'BLS registration key',
  'SECRET',
  apiKey,
);
```

Managed installations namespace custom settings just like other package components. The function derives the prefix from its installed function API name before reading or writing settings.

### Ingest function

[View the full OEWS ingest function](https://developer.rippling.com/assets/files/function-a4e52ce247742f2843817ecb5d6817da.ts)

The function posts the configured series to the BLS API:

```typescript
const blsHttpResponse = await fetch(BLS_TIMESERIES_URL, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    seriesid: seriesIds,
    registrationkey: blsApiKey,
  }),
});
```

It then parses every 25-character series ID into area, industry, occupation, and measure segments. Related measures are grouped into one snapshot before the record is upserted by its stable name.

The function also protects the API key when handling BLS errors. BLS can echo an invalid key in its response, so persisted messages pass through a redaction step before they are written to the ingest history.

* * *

### Test the complete flow

1.  Save a valid BLS key and the default series.
2.  Run **Refresh market data**.
3.  Confirm the snapshots for the default locations are created.
4.  Confirm the ingest run status is `OK` and **Records upserted** matches the rows written.

### Test the full path

1.  Run the refresh again.
2.  Confirm the existing snapshots update and no duplicate market cell appears.
3.  Save an invalid key, run the refresh, and confirm the ingest run is `ERROR`.
4.  Open the BLS message and confirm the key is not stored.
5.  Restore the valid key and confirm the next run succeeds.

* * *

## When a row fails

### Common errors and solutions

| Error | Cause | Solution |
| --- | --- | --- |
| Sign-in error before BLS is called | The signed-in user token is missing | Refresh while signed in to Rippling |
| Configuration error | The key or series list is empty | Save both settings, then refresh |
| "Enter at most 50 OEWS series IDs." | More than 50 series were entered | Shorten the list and save again |
| Series ID length error | A series ID is not 25 characters | Replace the ID with a valid OEWS series ID |
| "BLS rate limit reached. Try again later." | BLS returned HTTP 429 | Wait, then refresh. The ingest run is `ERROR` |
| Ingest status `ERROR` with an HTTP status | BLS rejected the request | Read `bls_message__c`, fix the key or series, and refresh |
| Snapshot status `SUPPRESSED` | BLS returned an empty wage cell | Keep the row for history, or drop that series if you do not need it |

A pull that fails still writes an ingest run. Check that object before you look for a missing snapshot.

### Set up monitoring

| What to watch | Where to look |
| --- | --- |
| Whether `pull_oews_snapshots` ran, and what it returned | [Get started with functions](https://developer.rippling.com/documentation/rippling-platform/developer/functions/getting-started#view-execution-logs) |
| Which pulls failed, and the redacted reason in `bls_message__c` | **Ingest Runs** in the app. See [Get started with custom objects](https://developer.rippling.com/documentation/rippling-platform/custom-objects/getting-started) |
| Which snapshots are `ERROR` or still `SUPPRESSED` | **OEWS Snapshots**. Filter the list the same way as [list views](https://developer.rippling.com/documentation/rippling-platform/custom-apps/table-views) |

* * *

## Build on the imported data (optional)

### Publish a transformation

Use [transformations](https://developer.rippling.com/documentation/rippling-platform/transformations/getting-started) on `OEWS Snapshot` when you want an analysis layer. For example:

-   Join market data to employee job or location data.
-   Calculate a compa-ratio against the market median.
-   Convert annual wages to hourly or monthly values.
-   Keep the latest survey year for each occupation and area.
-   Publish a smaller reporting object with only the fields you want to share.

The function keeps retrieving and storing source data. The transformation handles joins, calculations, and the reporting shape.

### Schedule refreshes

Trigger `pull_oews_snapshots` from as [automation](https://developer.rippling.com/documentation/rippling-platform/developer/workflows/get-started) on a cadence that fits the source data. Stay inside the BLS rate limits and the package limit of 50 series. For how an automation starts a function, see [Invoke functions](https://developer.rippling.com/documentation/rippling-platform/developer/functions/invoking-functions).

### Add dashboards or an AI experience

Create reports and dashboards from the snapshots or a published transformation. You can also build an agent that compares a role to selected market data, provided the agent and users have access to the underlying objects.

* * *

## See also

-   [Get started with custom settings](https://developer.rippling.com/documentation/rippling-platform/developer/custom-settings)
-   [Get started with functions](https://developer.rippling.com/documentation/rippling-platform/developer/functions/getting-started)
-   [Invoke functions](https://developer.rippling.com/documentation/rippling-platform/developer/functions/invoking-functions)
-   [Get started with custom objects](https://developer.rippling.com/documentation/rippling-platform/custom-objects/getting-started)
-   [Get started with custom apps](https://developer.rippling.com/documentation/rippling-platform/custom-apps/get-started)
-   [Get started with transformations](https://developer.rippling.com/documentation/rippling-platform/transformations/getting-started)

Source: https://developer.rippling.com/documentation/rippling-platform/solution-guides/oews-market-data-app

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
