Skip to content

tryVital/pair-programming-exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pair programming exercise

Installation guide

Before installation, you must have Python 3.10-3.12 and Poetry already installed in your system.

poetry shell
poetry install

Running the API

poetry run server

Expected standout output:

INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [69443] using WatchFiles
INFO:     Started server process [69448]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

Useful resources

Things FastAPI gives you out-of-the-box:

Project structure

tryvital
├── api
│   └── api_v1
│       ├── endpoints
│       │   └── api.py  # Endpoints are defined here.
│       └── router.py
|── models.py           # Pre-defined Pydantic models
└── main.py

Exercise Goal

There are two deliverables:

  1. Fetching and storing Activity data
  • Prep the database

    • Create an sql table (aiosqlite) by filling out the sql query in the init_db function
    • We're interested in storing steps and calories from the Activity Summary payload
  • Implement the callback endpoint: POST /v1/fitbit/connect/{vital_user_id}

    • It should fetch 7 days worth of (historical) activity daily summary data from Fitbit API.
    • It should then store it in the sql table from the previous point
  1. Querying stored Activity data
  • Implement the query endpoint: GET /v1/activity
    • It should query the activity daily summary data being stored in Deliverable 1.
    • The result must be filtered in accordance to the input date range.

Notes:

Flow Diagram

About

Technical interview boilerplate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages