Skip to content

giulianoojeda/Geospatial-Device-Count-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Propin Tech Challenge - Geospatial Device Count API

Overview

This repository contains the implementation for the Geospatial Device Count API. The API provides the count of unique devices based on geospatial coordinates, leveraging the power of H3 geospatial indexing and AWS Lambda.

Features

  • Fetch count of unique devices for specific geospatial coordinates.
  • Built using AWS Lambda for serverless execution.
  • Utilizes H3 for geospatial indexing.
  • Securely fetches database credentials using AWS Secrets Manager.

Prerequisites

  • AWS CLI
  • AWS SAM CLI
  • Python 3.8

Local Development

Running the API locally

  1. Navigate to the propin-api directory of the project.
  2. Build the SAM application:
    sam build
    
  3. Start the local API server:
    sam local start-api
    

Running Unit Tests

  1. Navigate to the propin-api/tests directory.
  2. Run the unit tests using pytest:
    pytest unit/
    

Deployment

  1. Navigate to the propin-api directory.
  2. Build the SAM application:
    sam build
    
  3. Deploy the SAM application:
    sam deploy --guided
    

Follow the prompts in the deploy process to specify the stack name, AWS region, and any other parameters. Once deployed, the API Gateway URL will be displayed in the output.

API Usage

Endpoint: /location/device-query

  • Method: GET
  • Query Parameters:
    • latitude: Latitude of the location.
    • longitude: Longitude of the location.

Example Request:

GET /location/device-query?latitude=4.62142480&longitude=-74.10983950

Example Response:

{
    "statusCode": 200,
    "headers": {
        "Content-Type": "application/json"
    },
    "body": {
        "level_6": 1234,
        "level_9": 5678
    }
}

About

A serverless API 🛰️ that provides unique device counts for a given geographic location. Built with Python on AWS Lambda, it uses Uber's H3 geospatial indexing for efficient querying. The application is deployed using the AWS SAM CLI and securely manages credentials with AWS Secrets Manager.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages