Docs menu

PHARMA FACTORY - FULL

Full Track: Author It All

You chose to build every part. Start from first principles.

This track assumes nothing: no legacy systems, no inherited constraints. You design the connection architecture, build the surface hierarchy, and author every warm query.

What you will build

ComponentScope
ConnectionsA multi-zone sensor network
SurfacesCleanroom, QA, mixing, batch
Warm queriesA compliance query library
TeamAccess for operations, QA and engineering
MCPAny AI client reading the library

Phase 1: Design the connection architecture

Step 1.1: Map your data sources

ZoneData sourcesHow it reaches OpenX
CleanroomTemperature, humidity, pressureA connection
MixingBatch sensors, valve statesA connection
QATest results, approvalsAn API Source polling your LIMS, or a CosmosDB container a warm query reads
UtilitiesHVAC, waterA Simulator until the meters are wired

Step 1.2: Create connections

On the canvas

  1. Drag a Connection node from the Node Bank onto the canvas for each zone.
  2. In each inspector's Settings tab, set the Connection ID. There is no connection string to enter.
  3. Save, then Deploy. Each connection's Connection Info tab then shows the credentials its devices send with.

Or ask Azi

AZI

"Create connections for the cleanroom sensors and the mixing batch data, and an API source for our LIMS." I propose them; accept each one, then Deploy builds them.

Step 1.3: Start with a simulator

If hardware is not connected yet:

  1. Drag a Simulator node from the Node Bank onto the canvas.
  2. In its inspector, add Variables for temperature, pressure and batch data.
  3. In Template, write a JSON message that mirrors your sensors; $.Name pulls in a variable.
  4. Save, then Deploy starts it.

TIP

Shape the simulator like your real sensors, and you can switch to real connections later with the same queries. See the Simulator guide.

Phase 2: Create the surface hierarchy

Surfaces organize your data by function. For pharma, a typical hierarchy:

Pharma-Factory (workspace)
├── Cleanroom-Monitoring
│   └── Environmental sensors
├── Batch-Tracking
│   └── Process data
├── QA-Gating
│   └── Test results
└── Utilities
    └── HVAC, water

Step 2.1: Cleanroom surface

"Create a surface for cleanroom monitoring, fed by the cleanroom sensors connection."

Azi proposes a Cleanroom-Monitoring surface wired to it. Accept it; it is live at once.

Step 2.2: The other surfaces

SurfaceFed byPurpose
Batch-TrackingMixing batch connectionProcess monitoring
QA-GatingA connection that reads the LIMS API sourceQuality control
UtilitiesThe utilities simulatorSupport systems

Phase 3: Build the warm query library

Where your data is

Device data lands in one table, Data (Devices in workspaces whose IoT fabric was set up earlier), with each payload as JSON in RawData. The queries unpack it with todynamic(RawData). The field names (zone, temperature, pressure, batchId) are examples; use your sensors' own. Ask Azi to sample with Data | take 5 first. The queries below are examples to adapt, not tested against your data.

QueryPurposeSurface
temp-complianceHourly temperature complianceCleanroom
batch-historyEvery event for one batchBatch-Tracking
pressure-alertsPressure outside its rangeCleanroom
qa-pendingBatches awaiting QAQA-Gating
trend-analysis7-day trends by parameterAll

Step 3.1: Temperature compliance by hour

"Create a warm query for hourly cleanroom temperature compliance over the last day, flagging any hour outside 18-22°C."

Data
| where EnqueuedTime > ago(24h)
| extend Payload = todynamic(RawData)
| where tostring(Payload.zone) == "Cleanroom"
| summarize MinTemp = min(todouble(Payload.temperature)),
            MaxTemp = max(todouble(Payload.temperature)),
            AvgTemp = avg(todouble(Payload.temperature)),
            Readings = count()
            by Hour = bin(EnqueuedTime, 1h)
| extend Compliant = MinTemp >= 18 and MaxTemp <= 22
| order by Hour asc

Step 3.2: Batch history

"Create a query that shows the complete history of a batch, across every zone."

Step 3.3: Pressure alerts

"Create a query for pressure readings outside 0.5-1.5 bar in the last hour."

AZI

Each query I propose is a starting point. Edit the KQL if you need different thresholds or time ranges, then save.

Phase 4: Give your team access

The owner adds teammates in Workspace -> Team Members: enter their email and click Invite. They are members at once. No AI can invite members, and the role picker in that window is not saved - what a member can change is set by access rights.

TeamWhat they need
Engineering, ITWorkspace.Deploy to build connections; Workspace.Access.Manage to manage access
Process engineers, QAMembership: any member can save and accept queries; some changes need a management right (see Permissions)
OperatorsMembership, to read the surfaces and run the queries

Access rights apply to the whole workspace; there is no per-surface permission. See Permissions.

Phase 5: Connect any AI over MCP

The OpenX MCP Server is at https://openx.fathym.com/ox-api/mcp. Sign in through the browser: in Claude.ai or ChatGPT, add a custom connector and paste the URL; for coding agents, run fai mcp install https://openx.fathym.com/ox-api/mcp --name openx and sign in when the browser opens. Setup for each client is in Bring Any AI.

Then ask:

"What's the compliance status of the cleanroom over the last 24 hours?"

The AI calls your temp-compliance query with call_api and answers from it. If it wants to build something new, it proposes it with manage_proposals, and a person accepts.

What you built

ComponentCount
Data sources2 connections, an API source and a simulator
Surfaces4
Warm queries5
Team accessSet
MCP clients1 or more

What you can show

BeforeAfter
AI experiments in silosEvery AI client reads the same saved queries
Answers nobody can explainThe query behind each answer, there to read
Scattered compliance evidenceOne workspace, organized by surface

What OpenX records about changes, and how it maps to data-integrity requirements, is on the Compliance matrix.

Next steps

If you want to...Go to...
Try the hybrid trackHybrid track
Learn KQLKQL Basics
Connect more AI clientsBring Any AI
See query patternsQuery Patterns
On this page