Sensor Readings

Sensor readings are the raw data points collected from your equipment. IMMUNE processes these readings in real-time to generate predictions and alerts.

The reading model

Each reading represents a single measurement from a sensor at a specific point in time.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the reading.

  • Name
    sensor_id
    Type
    string
    Description

    ID of the sensor that generated this reading.

  • Name
    equipment_id
    Type
    string
    Description

    ID of the equipment being monitored.

  • Name
    value
    Type
    number
    Description

    The measured value from the sensor.

  • Name
    unit
    Type
    string
    Description

    Unit of measurement (°C, Hz, PSI, etc.).

  • Name
    timestamp
    Type
    string
    Description

    When the reading was taken (ISO 8601 format).

  • Name
    quality
    Type
    string
    Description

    Data quality indicator (good, questionable, bad).

Submit readings

Submit a single reading

curl -X POST https://api.immune.dev/v1/readings \
  -H "Authorization: Bearer {token}" \
  -d '{
    "sensor_id": "vib_001",
    "value": 2.47,
    "unit": "mm/s",
    "timestamp": "2024-01-20T15:30:00Z"
  }'

Submit multiple readings

curl -X POST https://api.immune.dev/v1/readings/batch \
  -H "Authorization: Bearer {token}" \
  -d '{
    "readings": [
      {
        "sensor_id": "temp_001",
        "value": 85.6,
        "unit": "°C",
        "timestamp": "2024-01-20T15:30:00Z"
      },
      {
        "sensor_id": "press_001",
        "value": 2.1,
        "unit": "MPa",
        "timestamp": "2024-01-20T15:30:00Z"
      }
    ]
  }'

Query readings

Get recent readings

curl -X GET https://api.immune.dev/v1/readings \
  -H "Authorization: Bearer {token}" \
  -d sensor_id="vib_001" \
  -d start_time="2024-01-20T00:00:00Z" \
  -d end_time="2024-01-20T23:59:59Z"

Stream readings

IMMUNE supports real-time streaming of sensor data:

import { ImmuneClient } from '@immune/api'

const client = new ImmuneClient('your-api-key')

const stream = await client.readings.stream({
  sensors: ['vib_001', 'temp_001'],
  onData: (reading) => {
    console.log('New reading:', reading)
    // Process reading in real-time
  },
  onError: (error) => {
    console.error('Stream error:', error)
  }
})

// Later, when done
stream.close()

Data quality

IMMUNE automatically validates readings and assigns quality indicators:

  • good: Reading is within expected ranges
  • questionable: Reading shows unusual patterns
  • bad: Reading is outside physical limits or sensor error

Statistical analysis

Get statistical summaries of sensor readings:

Get reading statistics

curl -X GET https://api.immune.dev/v1/readings/stats \
  -H "Authorization: Bearer {token}" \
  -d sensor_id="vib_001" \
  -d interval="1hour" \
  -d metrics="min,max,avg,std_dev"

Best practices

  1. Submit readings in real-time when possible
  2. Use batch submissions for historical data
  3. Include accurate timestamps
  4. Monitor data quality metrics
  5. Implement proper error handling
  6. Use appropriate sampling rates

Was this page helpful?