Skip to content

Instantly share code, notes, and snippets.

Density Fullstack Take-home Assignment

Goal

Your goal is to build a web application that displays the latest "heartbeat" from a number of sensors.

Assignment

Your task is to accomplish the following:

  • Use Django, Express (or some similar Python / JS web framework) to build a web application
  • Generate a database that includes sensors and heartbeats
  • A sensor is a device in the field. It generally includes a serial number and other metadata
import requests
TAG_NAME = 'meeting-room'
WASTED_PERCENT = 15
# get meeting rooms
url = f'https://api.density.io/v2/tags/{TAG_NAME}'
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer REPLACE_ME'}
requests.get(url, headers=headers)
response = requests.get(url, headers=headers)
import requests
# get capacity
url = 'https://api.density.io/v2/spaces/:space_id'
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer REPLACE_ME'}
response = requests.get(url, headers=headers)
json_data = response.json()
capacity = json_data['capacity']
# get space counts and max occupancy
import requests
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer REPLACE_ME'}
url = 'https://api.density.io/v2/spaces'
response = requests.get(url, headers=headers)
json_data = response.json()
for result in json_data['results']:
print('{name}: {current_count}\n').format(name=result['name'], current_count=result['current_count'])

Keybase proof

I hereby claim:

  • I am beweinreich on github.
  • I am beweinreich (https://keybase.io/beweinreich) on keybase.
  • I have a public key whose fingerprint is 5301 41B7 F30F 87DB CC11 CA79 5086 178A D857 6C67

To claim this, I am signing this object:

from plaid import Client
from plaid import errors as plaid_errors
# import DRF, env vars, etc.
Client.config({'url': settings.PLAID_CONFIG_URL})
plaid_client = Client(client_id=settings.PLAID_CLIENT_ID, secret=settings.PLAID_SECRET)
public_token = "test,chase,connected"
account_id = "someaccountid"
try:
response = plaid_client.exchange_token(public_token, account_id)
@beweinreich
beweinreich / facebook_fanpage_parser.php
Created January 8, 2013 21:30
A Facebook fanpage feed parser built in PHP.
<?php
// Facebook Fanpage Parser
// Author: Brian Weinreich
// Company: Rounded
// Website: http://roundedco.com
// Make sure you read through this documentation before implementing!
// Head to https://developers.facebook.com/apps and create a new app
// Log in under Rounded Developments Facebook account (Ask Brian for creds if you don't know them)
@beweinreich
beweinreich / binstagram.php
Created January 3, 2013 18:27
Wordpress Plugin that allows for easy Instagram integration
<?php
/*
Plugin Name: Instagram Integration
Plugin URI: http://roundedco.com
Description: Allows admin to manage instagram integration
Author: Brian Weinreich
Version: 1.0
Author URI: http://www.roundedco.com
*/
@beweinreich
beweinreich / Twitter PHP Parser
Created August 1, 2012 17:16
Twitter Parser
<?
$username = "roundedco";
$limit = 5;
$feed = 'http://twitter.com/statuses/user_timeline.rss?screen_name='.$username.'&count='.$limit;
$tweets = file_get_contents($feed);
$tweet = explode("<item>", $tweets);
$tcount = count($tweet) - 1;
for ($i = 1; $i <= $tcount; $i++) {
$endtweet = explode("</item>", $tweet[$i]);
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php