8000 GitHub - evekhm/gcp_cloud_function: Utilities for working with gcp
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

evekhm/gcp_cloud_function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Connected Data Cloud

This project is designed to simplify deployment and scaling of Connected Datacloud Devices.

Following GCP services are used:

  • Pub/Sub
  • Cloud Storage
  • Compute Engine
  • App Engine
  • Cloud Functions
  • DialogFlow
  • IAM

The demo will deploy dexcom cloud function to connect with Dexcom API and stream data into the BigQuery using DataFlow.

Overview

  • This demo uses Dexcom API to pull data from the sandbox every 15 minutes using Cloud Scheduler and CLoud Function.
  • Cloud Function uses egvs endpoint and ingests data via Pub/Sub into the BigQuery datacloud dataset, dexcom table.
  • Retrieved data contains user's estimated glucose value (EGV), including trend and status information.

STEPS

Prepare Project

1. Create a project with a Billing account

Created GCP project and assign Billing Account. Note down the Project_ID.

2. Authorize Access

Authorize gcloud to access the Cloud Platform with Google user credentials.

gcloud auth login

3. Set env variables

Set Project ID

export PROJECT_ID=<your_project_id>

4. Deploy Dexcom CloudFunction Demo Flow

git clone https://github.com/evekhm/gcp_cloud_function.git demo
demo/bin/doit

5. Query BigTable

Check its working. If all steps completed sucessfully, data will begin appearing in BigQuery and could be queried:

bin/query

Sample Output:

Alternatively, following Query could be run from the Cloud Console:

  • Navigate to the Cloud Console and search for Big Query.
  • Find dataset called datacloud and table called dexcom. This is data retrieved from the dexcom device using API with glucose monitoring activiting. Alt text
  • Run following Query
    • Replace <PROJECT_ID> with your Project ID
SELECT SELECT userId, JSON_EXTRACT(message,  '$.systemTime' ) AS date,
  JSON_EXTRACT(message,  '$.value' ) AS value,
  JSON_EXTRACT(message,  '$.trend' ) AS trend,
  JSON_EXTRACT(message,  '$.trendRate' ) AS trend_rate  
FROM `<PROJECT_ID>.datacloud.dexcom`
ORDER BY date

Alt text

Cleaning Up

Following command will delete previously created resources. Project itself will not be deleted.

./bin/clean

About

Utilities for working with gcp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0