Data Hub

Set up an instrument

Go from a fresh instrument PC to an active instrument uploading runs into Data Hub.

ForLab operators and admins

This walkthrough takes you from nothing to an uploading instrument: create an access token, install the watcher, register the instrument, get an admin to confirm it, then start watching. CLI flags, the full config schema, and Windows service setup each have their own page, linked where they come up.

Data Hub is self-hosted. The web app, PostgreSQL database, and AWS stack (S3 plus the processing Lambda) must already be running. If they aren’t, an engineer needs the Deploy Data Hub guide first.

Before you start

You need:

  • The watch folder: the folder your instrument saves its output to.
  • File patterns: which files to upload, written as patterns such as *.csv, *.xlsx, or *.tiff.
  • uv installed on the instrument PC (it manages Python for you).

To make setup and maintenance easier, we recommend setting up remote access to the instrument PC via Windows Remote Desktop.

1. Create an access token

The watcher authenticates to Data Hub with a personal access token. Only admins can create tokens, so ask one if you aren’t an admin.

In the Data Hub web app, go to Settings → Access Tokens and choose Create token.

Give the token a Name that identifies the instrument PC, for example Plate Reader PC.

Set Expiration to No expiry. An admin can still revoke the token at any time.

Under Scopes, choose the Watcher preset. It grants only what a watcher needs: registering, reporting runs, and uploading files.

Choose Create token, then copy the token. It starts with dhub_ and is shown only once.

Create access token window with the name filled in and the Watcher scope preset selected

Keep the token handy: you paste it into the setup wizard in step 3. For rotation, revocation, and the full scope list, see Issue and revoke tokens.

2. Install the watcher

On the instrument PC, install the watcher with uv. The windows-service extra adds pywin32 so you can follow Run as a Windows service, which is the default on a lab PC:

uv tool install "data-hub-watcher[windows-service]"

On macOS or Linux, omit the extra:

uv tool install data-hub-watcher

Install and update the watcher has the full install, check, and update steps.

3. Run the setup wizard

Start the wizard with data-hub-watcher init. It prompts you for one thing at a time:

Choose the environment. For a live lab, this is production.

Enter your Data Hub API URL, for example https://datahub.your-domain.com/api/v1.

Paste the token from step 1 when it asks for the API key. The wizard checks the key, then lists the instruments already registered.

Pick your instrument from the list, or choose Register a new instrument if it isn’t there.

For a new instrument, enter an ID and a display name. The ID is a short, lowercase, hyphenated name like bio-rad-cfx96. It can’t be changed later.

Enter the full path to the folder your instrument writes into.

List which files to upload, such as *.pcrd,*.csv. The watcher ignores files that don’t match.

Choose how files get grouped into runs. Pick the preset that matches how your instrument names its output, or write your own. The wizard previews a few matches so you can check the run IDs. For example, the default preset uses the filename prefix before the first underscore, so RUN001_quant.csv and RUN001_melt.csv both group into run RUN001.

Set the stability period: how many seconds a file must stay unchanged before the watcher treats it as finished. The default is 5. Raise it for instruments that write large files slowly.

Choose the upload mode. Auto uploads each file as soon as it’s stable. Manual waits until someone chooses Upload for the file in the web app.

For run detection options, see Configure run detection and uploads; Watcher configuration lists every preset.

The wizard then registers the watcher, saves the config to ~/.data-hub/config.yaml (C:\Users\your_username\.data-hub\config.yaml on Windows), and sends it to Data Hub. When it reports that setup is complete, an admin confirms the instrument.

4. Confirm the instrument’s registration

A pending instrument can’t upload to Data Hub until an admin confirms it from the web app. Until then its badge reads Pending, and its page shows a Waiting for confirmation card in place of the runs table. Members see one line saying the instrument is waiting for an admin.

In the Data Hub web app, choose Instruments → View all in the sidebar.

Open the Pending tab and find your instrument. It shows an amber Pending badge.

Choose Confirm… on its row. A window shows what the watcher registered: the computer, the watch folder, the file patterns, how files become runs, and the upload mode. Check that it matches what you entered in the wizard. If it doesn’t, choose Change settings first to fix it.

Choose an Instrument type, which is required, then choose Confirm instrument. The instrument moves to the Active tab.

datahub.example.com/instruments?tab=pendingInstruments page on the Pending tab, with a pending instrument showing an amber Pending badge and a Confirm button

The Confirm window, with the instrument’s ID, where the watcher registered from, its watch folder, file patterns, how files become runs, and the instrument type to choose

The instrument’s badge reads Connecting until the watcher service you start in step 5 checks in, and then Online. If the watcher hasn’t checked in 15 minutes after you confirm, the badge reads Offline with the notice “The watcher never checked in”. That’s expected if you haven’t started the service yet, and the badge turns Online at the first check-in.

Open the instrument’s page and check the watch folder and file patterns shown under its name. They should match what you entered in the wizard. Files outside that folder, or with names that don’t match a pattern, won’t reach Data Hub.

Admins can change an instrument’s type later: open the three-dot menu, choose Edit details, and pick a supported type. What each type produces is in Instrument data preprocessing.

Adding a new processor takes code changes; see Adding a new instrument in the developer docs.

Manage instruments covers confirming and editing instruments and reading an instrument’s page.

5. Start the watcher service

First, preview what the watcher will do without starting it:

data-hub-watcher watch --dry-run

The dry run checks the config, checks that Data Hub is reachable and the instrument is active, and lists the files it would upload.

When it looks right, install and start the watcher as a Windows service. Run these from an Administrator terminal:

data-hub-watcher service install
data-hub-watcher service start

The service starts when the PC starts, keeps running after you sign out of Windows, and updates itself. Run as a Windows service covers stopping and restarting it, and where it writes logs.

On macOS or Linux, run the watcher in the foreground instead:

data-hub-watcher watch

The watcher finds new files, groups them into runs, uploads them in auto mode, and checks in with Data Hub every 60 seconds. Runs appear in the web app as the watcher reports them, and their files follow as they upload.

What you get once it’s running

  • Raw files upload to cloud storage
  • The instrument’s runs and files appear in the web app
  • The watcher service starts again whenever the PC restarts
  • The watcher’s activity, health, and settings appear on the instrument’s Watcher page, and the instrument’s badge shows whether new files can arrive
  • People who subscribe to the instrument can get notifications about new runs in the app and in Slack

On this page