components/TestCoreTempCard.ts

Purpose

TestCoreTempCard is a lightweight developer/testing component used to manually validate the core temperature inference pipeline.

The component provides a deterministic test harness around runCoreTempInference by:

  • Supplying a fixed set of known inputs

  • Running inference on demand

  • Displaying the resulting:

    • predicted core temperature,
    • physiological state,
    • model source

This component is intended for:

  • debugging,
  • regression testing,
  • model verification,
  • QA validation,
  • and inference pipeline smoke testing.

Unlike production prediction components, this card does not:

  • fetch live activity data,
  • load weather feeds,
  • poll sensors,
  • or read user profile state dynamically.

All inputs are intentionally hardcoded to ensure repeatable and stable outputs.


Invariants

The component maintains the following guarantees:

  • The same hardcoded input dataset is used for every test run unless the source code changes.
  • Pressing “Run Test Case” triggers exactly one inference execution.
  • No automatic polling or background refresh occurs.
  • The component does not write to persistent storage.
  • All displayed outputs originate directly from the most recent successful inference result.
  • Inference failures are surfaced through a React Native Alert.
  • Prior to execution, all result fields render placeholder values ("—").

Fixed Test Inputs

FieldValue
WBGT25.302024
Activity CPM227.55
Gender1 (male)
BMI30.55411248
Age44
Days Active (14d)7

These values act as a stable regression baseline for validating inference behavior.


Variants

Idle State

Initial render before any inference execution.

Characteristics:

  • Output values display "—".
  • No inference has been executed yet.

Running State

Occurs after the user presses “Run Test Case” and inference is executing asynchronously.

Characteristics:

  • The component awaits inference completion.
  • No loading spinner or disabled button state is currently implemented.

Success State

Occurs after successful inference completion.

Characteristics:

  • Displays:

    • predicted core temperature,
    • inferred physiological state,
    • model identifier used during prediction.

Error State

Occurs if runCoreTempInference throws.

Characteristics:

  • Displays a native alert dialog with the error message.
  • Previously rendered successful results remain visible.

Exports

Default Export

TestCoreTempCard

const TestCoreTempCard: React.FC<Props>

Developer-facing test component for executing deterministic core temperature inference runs.

Props

type Props = {
  title?: string;
};
PropTypeDescription
titlestringOptional override for the card title.

Internal Components

Row

const Row: React.FC<{
  label: string;
  value: string;
  bold?: boolean;
}>

Simple internal helper component used to render label/value rows for both input and output sections.

Not exported outside the module.


External Dependencies

Inference

runCoreTempInference(...)

Executes the core temperature prediction model.

React Native APIs

The component uses:

  • View
  • Text
  • Pressable
  • Alert
  • StyleSheet

for layout, interaction, and error presentation.