Health reference design

In this section, you will find a health reference design that describes an end-to-end machine learning workflow for building a wearable health product using Edge Impulse.

We will utilize a publicly available dataset of PPG and accelerometer data that was collected from 15 subjects performing various activities, and emulate a clinical study to train a machine learning model that can classify activities.

Overview

The dataset selected to use in this example is the PPG-DaLiA dataset, which includes 15 subjects performing 9 activities, resulting in a total of 15 recordings. See the CSV file summary here, and read more about it in the publishers website here,

This dataset covers an activity study where data is recorded from a wearable end device (PPG + accelerometer), along with labels such as Stairs, Soccer, Cycling, Driving, Lunch, Walking, Working, Clean Baseline, and No Activity. The data is collected and validated, then written to a clinical dataset in an Edge Impulse organization, and finally imported into an Edge Impulse project where we train a classifier.

The health reference design builds transformation blocks that sync clinical data, validate the dataset, query the dataset, and transform the data to process raw data files into a unified dataset.

Data Pipeline

The design culminates in a data pipeline that handles data coming from multiple sources, data alignment, and a multi-stage pipeline before the data is imported into an Edge Impulse project.

We won't cover in detail all the code snippets, it should be straightforward to follow through, if issues are encountered our solution engineers can help you set this end-to-end ML workflow.

Health Reference Design Sections

This health reference design section helps you understand how to create a full clinical data pipeline by:

Bringing it all together

After you have completed the health reference design, you can go further by combining the individual transformation steps into a data pipeline.

Refer to the following guide to learn how to build data pipelines:

The Health Reference Design pipeline consists of the following steps:

Repository containing the blocks used in this health reference design:

https://github.com/edgeimpulse/health-reference-design-public-data

Data Pipeline Workflow

The data pipeline workflow for the Health Reference Design is as follows:

Data Pipeline - workflow

Creating and Running the Pipeline in Edge Impulse

Now that all transformation blocks are pushed to Edge Impulse, you can create a pipeline to chain them together.

Steps:

  1. Access Pipelines:

  • In Edge Impulse Studio, navigate to your organization.

  • Go to Data > Pipelines.

  1. Add a New Pipeline:

  • Click on + Add a new pipeline.

  • Name: PPG-DaLiA Data Processing Pipeline

  • Description: Processes PPG-DaLiA data from raw files to a combined dataset.

  1. Configure Pipeline Steps:

  • Paste the following JSON configuration into the pipeline steps:

[
  {
   "name": "Process Subject Data",
   "filter": "name LIKE '%S%_E4%'",
   "uploadType": "dataset",
   "inputDatasetId": "raw-dataset",
   "outputDatasetId": "processed-dataset",
   "transformationBlockId": 1234, // Replace 1234 with your DataProcessor block ID
   "transformationParallel": 3,
   "parameters": {
    "in-directory": "."
   }
  },
  {
   "name": "Generate Metadata",
   "filter": "name LIKE '%S%_E4%'",
   "uploadType": "dataset",
   "inputDatasetId": "processed-dataset",
   "outputDatasetId": "processed-dataset",
   "transformationBlockId": 5678, // Replace 5678 with your MetadataGenerator block ID
   "transformationParallel": 3,
   "parameters": {
    "in-directory": "."
   }
  },
  {
   "name": "Combine Processed Data",
   "filter": "name LIKE '%'",
   "uploadType": "dataset",
   "inputDatasetId": "processed-dataset",
   "outputDatasetId": "combined-dataset",
   "transformationBlockId": 9101, // Replace 9101 with your DataCombiner block ID
   "transformationParallel": 1,
   "parameters": {
    "dataset-name": "ppg_dalia_combined.parquet"
   }
  }
]

Replace the transformationBlockId values with the actual IDs of your transformation blocks.

  1. Save the Pipeline.

  2. Run the Pipeline:

  • Click on the ⋮ (ellipsis) next to your pipeline.

  • Select Run pipeline now.

  1. Monitor Execution:

  • Check the pipeline logs to ensure each step runs successfully.

  • Address any errors that may occur.

  1. Verify Output:

  • After completion, verify that the datasets (processed-dataset and combined-dataset) have been created and populated.

Next Steps

After the pipeline has successfully run, you can import the combined dataset into an Edge Impulse project to train a machine learning model.

If you didn't complete the pipeline, don't worry, this is just a demonstration. However, you can still import the processed dataset from our HRV Analysis tutorial to train a model.

Refer to the following guides to learn how to import datasets into Edge Impulse:

Conclusion

The Health Reference Design provides a comprehensive overview of building a wearable health product using Edge Impulse. By following the steps outlined in this guide, you will gain a practical understanding of a real-world machine learning workflow for processing and analyzing clinical data.

If you have any questions or need assistance with implementing the Health Reference Design, feel free to reach out to our sales team for product development, or share your work on our forum.

Last updated

Was this helpful?