Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

VPTDetection #169

Description

@charlieforward9

A VPTDetection is an object that will be aggregated and served into all Assessment-relevant AI models that VisualPT trains. This RFC is to discuss the shape of this object.

The set of features in a sample collected will continue to grow. It is the responsibility of all parties to maintain a clear interface to manage efficiency and growth.

Currently, the sample payload is saved in a format provided here

Current Schema

// Converted into an Assessment specific object 
// (we want to avoid assessment specific objects for the data interface, because there are hundreds/thousands of assessments, need something more generic...)
class CTSIBData {
  //Image Data
  final num imageHeight;
  final num imageWidth;
  final num ratio;
  //Inference Data
  final int classIndex;
  final int conditionNumber;
  final int trialNumber;
  final PoseDetectionOutput output;
  const CTSIBData(
    this.imageHeight,
    this.imageWidth,
    this.ratio,
    this.classIndex,
    this.conditionNumber,
    this.trialNumber,
    this.output,
  );

  toCSV() {
    final lines = output.output.map((line) => line.join(",")).join("\n");
    final metadata = [
      imageHeight,
      imageWidth,
      ratio,
      classIndex,
      conditionNumber,
      trialNumber
    ].join(",");
    return '$metadata\n$lines';
  }
}

Current Proposals

Proposed Schema

class ClinicalMeta {
  final String dateOfBirth;
  final Gender gender;
  final FallHistory fallHistory;
  final AssessmentType assessment;
  final bool obtrustion;
  final bool instability;
  final int condition;
  final int trial;

  const ClinicalMeta(
    this.dateOfBirth,
    this.gender,
    this.fallHistory,
    this.assessment,
    this.obtrustion,
    this.instability,
    this.condition,
    this.trial,
  );

  String csv() {
    return "$dateOfBirth,${gender.name},${fallHistory.name},${assessment.name},$obtrustion,$instability,$condition,$trial";
  }
}

class DeviceMeta {
  final num deviceAcceleroX;
  final num deviceAcceleroY;
  final num deviceAcceleroZ;
  final num deviceGyroX;
  final num deviceGyroY;
  final num deviceGyroZ;

  const DeviceMeta(
    this.deviceAcceleroX,
    this.deviceAcceleroY,
    this.deviceAcceleroZ,
    this.deviceGyroX,
    this.deviceGyroY,
    this.deviceGyroZ,
  );

  String csv() {
    return "$deviceAcceleroX,$deviceAcceleroY,$deviceAcceleroZ,$deviceGyroX,$deviceGyroY,$deviceGyroZ";
  }
}

class VPTDetection {
  final int version;
  //Image Meta
  final int imageHeight;
  final int imageWidth;
  //Clinical Meta
  final ClinicalMeta clinicalMeta;
  //Detection Meta
  final DeviceMeta deviceMeta;
  final String inferredClassification;
  //Detection Data
  final PoseDetectionOutput output;

  const VPTDetection(
    this.version,
    this.imageHeight,
    this.imageWidth,
    this.clinicalMeta,
    this.deviceMeta,
    this.inferredClassification,
    this.output,
  );

  // Formats the object into a string
  //
  // ==================
  // <Version>\n
  // <Image Meta>\n
  // <Clinical Meta>\n
  // <Detection Meta>\n
  // <Detection Data>
  // ==================
  String toCSV() {
    return "$version\n"
        "$imageHeight,$imageWidth\n"
        "${clinicalMeta.csv()}\n"
        "${deviceMeta.csv()},$inferredClassification\n"
        "${output.output.map((keypoint) => keypoint.join(",")).join("\n")}";
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions