https://github.com/metriport/metriport Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} metriport / metriport Public * Notifications * Fork 1 * Star 58 Metriport is an open source and universal API for healthcare data. metriport.com/ License View license 58 stars 1 fork Star Notifications * Code * Issues 0 * Pull requests 2 * Discussions * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Security * Insights metriport/metriport This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 4 branches 1 tag Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/m] Use Git or checkout with SVN using the web URL. [gh repo clone metrip] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit Dima Goncharov and Dima Goncharov add missing files ... 7687aeb Dec 21, 2022 add missing files 7687aeb Git stats * 21 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time api init Dec 21, 2022 assets update readme Dec 21, 2022 connect-widget/app init Dec 21, 2022 docs test doc update Dec 21, 2022 infra update readme Dec 21, 2022 pkgs update readme Dec 21, 2022 .gitignore add missing files Dec 21, 2022 .prettierrc.yaml add missing files Dec 21, 2022 LICENSE init Dec 21, 2022 README.md update readme Dec 21, 2022 deploy.sh init Dec 21, 2022 package.json init Dec 21, 2022 View code [ ] Support us on Product Hunt and Launch YC Overview Security and Privacy Health Devices API Medical API (Coming Soon) Getting Started Quickstart Guide Developer Dashboard npm package Repo Rundown API Server Connect Widget Infrastructure as Code Docs Prerequisites Local Development API Server Optional usage report Finalizing setting up the API Server Database Migrations Additional stuff Connect Widget Self-Hosted Deployments Environment Setup Deployment Steps License README.md Logo Metriport helps digital health companies access and manage health and medical data, through a single open source API. Learn more >> Docs * NPM * Developer Dashboard * Website * Demo App Uptime Github Stars License Commits-per-month [6874747073] LinkedIn YC Support us on Product Hunt and Launch YC Metriport - Health Devices API - Open-source Plaid for healthcare data | Product Hunt Launch YC: Metriport - Universal API for Healthcare Data Overview wearables Security and Privacy Metriport is SOC 2 and HIPAA compliant. Click here to learn more about our security practices. [soc2] [hipaa] [soc2-vanta] [hipaa-vanta] Health Devices API Our Health Devices API, allows you to gain access to your users' health data from various wearables, RPM devices, and mHealth sources through a single standardized API. Out of the box, our Health Devices API supports the following integrations: * Fitbit * Oura * Whoop * Withings * Cronometer ...with many more integrations on the way! If there's an integration you need that's not currently on here, feel free to shoot us an email and let us know so we can build it, or feel free to fork our code and add the integration yourself. wearables Medical API (Coming Soon) Open-source with native FHIR support. More info on our Medical API here: https://metriport.com/medical Getting Started Check out the links below to get started with Metriport in minutes! Quickstart Guide Developer Dashboard npm package Repo Rundown API Server Backend for the Metriport API. * Dir: /api * URL: https://api.metriport.com/ * Sandbox URL: https://api.sandbox.metriport.com/ Connect Widget Pre-built app that you can embed your own app! Use it to allow your users to authenticate with various data sources, allowing you to pull their health data from those sources. connect widget * Dir: /connect-widget * URL: https://connect.metriport.com/ Infrastructure as Code We use AWS CDK as IaC. * Dir: /infra Docs Our beautiful developer documentation, powered by mintlify [?]. * Dir: /docs * URL: https://docs.metriport.com/ --------------------------------------------------------------------- Prerequisites Before getting started with the deployment or any development, ensure you have done the following: 1. Install the prerequisite programs: + The latest LTS Node.js version. + Docker Desktop. + (Optional) VS Code - recommended IDE. + (Optional) DBeaver - recommended universal DB tool. 2. Create an AWS account. 3. Create an AWS IAM admin user. 4. Setup AWS Route 53 to handle the DNS for your domain, and create a hosted zone. 5. Follow modules 1 & 2 of this guide for Typescript to bootstrap the AWS CDK on your local machine. 6. Local Development API Server First, create a local environment file, to define your developer keys: $ touch api/app/.env $ echo "CRONOMETER_CLIENT_ID=" > api/app/.env $ echo "CRONOMETER_CLIENT_SECRET=" > api/app/.env $ echo "FITBIT_CLIENT_ID=" > api/app/.env $ echo "FITBIT_CLIENT_SECRET=" > api/app/.env $ echo "GARMIN_CONSUMER_KEY=" > api/app/.env $ echo "GARMIN_CONSUMER_SECRET=" > api/app/.env $ echo "OURA_CLINET_ID=" > api/app/.env $ echo "OURA_CLIENT_SECRET=" > api/app/.env $ echo "WHOOP_CLIENT_ID=" > api/app/.env $ echo "WHOOP_CLIENT_SECRET=" > api/app/.env $ echo "WITHINGS_CLIENT_ID=" > api/app/.env $ echo "WITHINGS_CLIENT_SECRET=" > api/app/.env Optional usage report The API server reports endpoint usage to an external service. This is optional. A reachable service that accepts a POST request to the informed URL with the payload below is required: { "cxId": "", "cxUserId": "" } If you want to set it up, add this to the .env file: $ echo "USAGE_URL=" > api/app/.env Finalizing setting up the API Server Then to run the full back-end stack, use docker-compose to lauch a Postgres container, local instance of DynamoDB, and the Node server itself: $ cd api/app $ npm install # only needs to be run once $ docker-compose -f docker-compose.dev.yml up --build Now, the backend services will be available at: * API Server: 0.0.0/0:8080 * Postgres: localhost:5432 * DynamoDB: localhost:8000 Database Migrations The API Server uses Sequelize as an ORM, and its migration component to update the DB with changes as the application evolves. It also uses Umzug for programatic migration execution and typing. When the application runs it automatically executes all migrations located under src/sequelize/migrations (in ascending order) before the code is atually executed. If you need to undo/revert a migration manually, you can use the CLI, which is a wrapper to Umzug's CLI (still under heavy development at the time of this writing). It requires DB credentials on the environment variable DB_CREDS (values from docker-compose.dev.yml, update as needed): $ export DB_CREDS='{"username":"admin","password":"admin","dbname":"db","engine":"postgres","host":"localhost","port":5432}' Run the CLI with: $ npm i -g ts-node # only needs to be run once $ cd api/app $ ts-node src/sequelize/cli Umzug's CLI is still in development at the time of this writing, so that's how one uses it: * it will print the commands being sent to the DB * followed by the result of the command * it won't exit by default, you need to ctrl+c * the command up executes all outstanding migrations * the command down reverts one migration at a time To create new migrations: 1. Duplicate a migration file on ./api/app/src/sequelize/migrations 2. Rename the new file so the timestamp is close to the current time - it must be unique, migrations are executed in sorting order 3. Edit the migration file to perform the changes you want + up add changes to the DB (takes it to the new version) + down rolls back changes from the DB (goes back to the previous version) Additional stuff To do basic UI admin operations on the DynamoDB instance, you can do the following: $ npm install npm install -g dynamodb-admin # only needs to be run once $ DYNAMO_ENDPOINT=http://localhost:8000 dynamodb-admin # admin console will be available at http://localhost:8001/ To kill and clean-up the back-end, hit CTRL + C a few times, and run the following from the api/app directory: $ docker-compose -f docker-compose.dev.yml down To debug the backend, you can attach a debugger to the running Docker container by launching the Docker: Attach to Node configuration in VS Code. Note that this will support hot reloads ! Connect Widget To run the Connect Widget: $ cd connect-widget/app $ npm install # only needs to be run once $ npm run start --------------------------------------------------------------------- Self-Hosted Deployments Environment Setup First, you'll need to create and configure a deployment config file: /infra/config/standalone.ts. You can see example.ts in the same directory for a sample of what the end result should look like. Then, proceed with the deployment steps below. Deployment Steps 1. First, deploy the secrets stack. This will setup the secret keys required to run the server using AWS Secrets Manager. To deploy it, run the following commands (with replaced with what you've set in your config file): $ ./deploy.sh -e "standalone" -s "" 2. After the previous steps are done, define all of the required keys in the AWS console by navigating to the Secrets Manager. 3. Then, to deploy the back-end execute the following command: $ ./deploy.sh -e "standalone" -s "" After deployment, the API will be available at the configured subdomain + domain. 4. Finally, to self-host the Connect widget, run the following: $ ./deploy.sh -e "standalone" -s "" Note: if you need help with the deploy.sh script at any time, you can run: $ ./deploy.sh -h License Distributed under the AGPLv3 License. See LICENSE for more information. Copyright (c) Metriport 2022 About Metriport is an open source and universal API for healthcare data. metriport.com/ Topics api open-source typescript healthcare wearables soc2 self-hostable devices-api Resources Readme License View license Stars 58 stars Watchers 2 watching Forks 1 fork Releases 1 0.1.0 Latest Dec 21, 2022 Packages 0 No packages published Languages * TypeScript 95.3% * JavaScript 2.8% * Other 1.9% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.