Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.example

This file was deleted.

30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# DataMade Code Challenge: React Map

Check failure on line 1 in README.md

View workflow job for this annotation

GitHub Actions / Prettier

README.md#L1

There are issues with this file's formatting, please run Prettier to fix the errors

---
![2026 DataMade Code Challenge](https://github.com/datamade/code-challenge-v2/blob/main/map/static/images/2026-datamade-code-challenge.jpg)

Welcome to the DataMade code challenge! 👋

https://github.com/user-attachments/assets/39702bb2-0a72-45a0-91bf-2d48d990fbce
Welcome to the 2026 DataMade code challenge! 👋

## Overview

Expand All @@ -16,18 +14,6 @@

We’ll be evaluating whether the code works, as well as its quality. Before submitting, make sure that your code does what you expect it to do, that it’s clean and neat enough to meet your standards, and that you’ve provided us some instructions on how to run it.

_Note: If you would prefer to keep your code challenge private, please share access with the following members of DataMade on GitHub:_

| Member | GitHub Account |
| --------- | -------------------------------- |
| Hannah | https://github.com/hancush |
| Derek | https://github.com/derekeder |
| Monkruman | https://github.com/antidipyramid |
| Xavier | https://github.com/xmedr |
| Hayley | https://github.com/haowens |

Keep in mind that you cannot create a private fork of a public repository on GitHub, so you’ll need to [follow these instructions](https://gist.github.com/0xjac/85097472043b697ab57ba1b1c7530274) to create a private copy of the repo.

## Installation

Development requires a local installation of [Docker](https://docs.docker.com/get-started/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/). These are the only two system-level dependencies you should need.
Expand Down Expand Up @@ -82,3 +68,15 @@
### Step 5: Submit your work

To submit your work, create a feature branch for your code, commit your changes, push your commits up to your fork, and open up a pull request against main. Finally, drop a link to your pull request in your application.

_Note: If you would prefer to keep your code challenge private, please share access with the following members of DataMade on GitHub:_

| Member | GitHub Account |
| --------- | -------------------------------- |
| Hannah | https://github.com/hancush |
| Derek | https://github.com/derekeder |
| Monkruman | https://github.com/antidipyramid |
| Xavier | https://github.com/xmedr |
| Hayley | https://github.com/haowens |

Keep in mind that you cannot create a private fork of a public repository on GitHub, so you’ll need to [follow these instructions](https://gist.github.com/0xjac/85097472043b697ab57ba1b1c7530274) to create a private copy of the repo.
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ services:
DJANGO_MANAGEPY_MIGRATE: "on"
DJANGO_DEBUG: "True"
PGPASSWORD: postgres
env_file:
- .env
entrypoint: /app/docker-entrypoint.sh
command: python manage.py runserver 0.0.0.0:8000

Expand All @@ -55,7 +53,7 @@ services:
volumes:
- map-db-data:/var/lib/postgresql
ports:
- 32001:5432
- 5432:5432
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

site would not successfully come up before changing this


volumes:
map-db-data:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 21 additions & 5 deletions map/static/js/RestaurantPermitMap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react"

Check failure on line 1 in map/static/js/RestaurantPermitMap.js

View workflow job for this annotation

GitHub Actions / Prettier

map/static/js/RestaurantPermitMap.js#L1

There are issues with this file's formatting, please run Prettier to fix the errors

import { MapContainer, TileLayer, GeoJSON } from "react-leaflet"

Expand Down Expand Up @@ -37,6 +37,8 @@
}

export default function RestaurantPermitMap() {
const colors = ["#eff3ff", "#bdd7e7", "#6baed6", "#2171b5"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imported these from https://colorbrewer2.org/. may be worth keeping in


const [currentYearData, setCurrentYearData] = useState([])
const [year, setYear] = useState(2026)

Expand All @@ -59,17 +61,32 @@
.then((data) => setCurrentYearData(data))
}, [currentUrl])

function getColor(pcntPermits) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be a function we stub out but ask them to implement

if (pcntPermits > .5)
return colors[3]

Check warning on line 66 in map/static/js/RestaurantPermitMap.js

View workflow job for this annotation

GitHub Actions / ESLint

map/static/js/RestaurantPermitMap.js#L66

Expected { after 'if' condition (curly)
else if (pcntPermits > .2)
return colors [2]

Check warning on line 68 in map/static/js/RestaurantPermitMap.js

View workflow job for this annotation

GitHub Actions / ESLint

map/static/js/RestaurantPermitMap.js#L68

Expected { after 'if' condition (curly)
else if (pcntPermits >= .01)
return colors [1]

Check warning on line 70 in map/static/js/RestaurantPermitMap.js

View workflow job for this annotation

GitHub Actions / ESLint

map/static/js/RestaurantPermitMap.js#L70

Expected { after 'if' condition (curly)
else
return colors[0]

Check warning on line 72 in map/static/js/RestaurantPermitMap.js

View workflow job for this annotation

GitHub Actions / ESLint

map/static/js/RestaurantPermitMap.js#L72

Expected { after 'else' (curly)
}

function setAreaInteraction(feature, layer) {
const thisAreaData = communityAreaDict[feature.properties.community],
numPermits = thisAreaData.num_permits,
pcntPermits = numPermits / maxNumPermits
layer.setStyle({
fillOpacity: pcntPermits,
color: "#000000",
weight: 1,
fillOpacity: 0.7,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these default styles can be kept in

fillColor: getColor(pcntPermits)
})
layer.on("mouseover", () => {
layer.bindPopup(`
<h3>${feature.properties.community}</h3>
<p>Restaurant permits issued during ${year}: ${thisAreaData.num_permits}</p>
<strong>${feature.properties.community}</strong><br />
Year: ${year}<br />
Restaurant permits: ${thisAreaData.num_permits}
`)
layer.openPopup()
})
Expand All @@ -89,11 +106,10 @@
id="restaurant-map"
center={[41.88, -87.62]}
zoom={10}
scrollWheelZoom={false}
>
<TileLayer
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
url="https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}@2x.png"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

positron base map

/>
{currentYearData.length > 0 ? (
<GeoJSON
Expand Down
88 changes: 18 additions & 70 deletions map/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,35 @@
/>

<title>
Home | DataMade Code Challenge
Home | 2026 DataMade Code Challenge
</title>

<meta content="TK" name="description" />
<meta content="A map that displays Chicago's community areas, shaded depending on how many new restaurant permits were issued in a given year" name="description" />
<meta
content="DataMade Code Challenge"
content="2026 DataMade Code Challenge"
name="author"
/>
<meta property="og:site_name" content="DataMade Code Challenge" />
<meta property="og:site_name" content="2026 DataMade Code Challenge" />

<!-- Facebook metadata -->
<meta property="og:type" content="website" />
<meta
property="og:title"
content="Home | DataMade Code Challenge"
content="2026 DataMade Code Challenge"
/>
<meta property="og:description" content="TK" />
<meta property="og:description" content="A map that displays Chicago's community areas, shaded depending on how many new restaurant permits were issued in a given year" />
<meta property="og:url" content="TK" />

<!-- Twitter metadata -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="DataMade Code Challenge" />
<meta name="twitter:creator" content="TK" />
<meta name="twitter:site" content="2-26 DataMade Code Challenge" />
<meta name="twitter:creator" content="DataMade" />
<meta
name="twitter:title"
content="Home | DataMade Code Challenge"
content="2026 DataMade Code Challenge"
/>
<meta name="twitter:url" content="TK" />
<meta name="twitter:description" content="TK" />

<meta property="og:image" content="{% static 'images/' %}" />
<meta name="twitter:image" content="{% static 'images/' %}" />
<meta name="twitter:description" content="A map that displays Chicago's community areas, shaded depending on how many new restaurant permits were issued in a given year" />

<!-- Override this block to add extra meta tags -->
{% block extra_meta %}{% endblock %}
Expand Down Expand Up @@ -75,70 +72,21 @@
class="navbar navbar-expand-lg bg-light"
>
<div class="container-fluid">
<a class="navbar-brand" href="/"
>DataMade Code Challenge</a
>

<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav">
{% include 'map/partials/nav.html' %}
</ul>
</div>
<a class="navbar-brand" href="/" >2026 DataMade Code Challenge</a>
</div>
</nav>

<main>{% block body %}{% endblock %}</main>

<footer class="bg-dark text-light">
<div class="container-fluid py-4">
<div class="row">
<!-- Site Name -->
<div class="col-md">
<p class="h4">
DataMade Code Challenge
</p>
</div>
</div>

<hr class="py-2" style="border-color: gray" />

<div class="row">
<div class="col">
<p>
Built by
<a href="https://datamade.us" target="_blank" class="text-light"
>DataMade</a
>
</p>
</div>
</div>
</div>
</footer>

<!-- Load external scripts -->
<script src="{% static 'js/lib/fontawesome.min.js' %}"></script>

<!-- Load Bootstrap styles and JavaScript -->
{% load render_bundle from webpack_loader %}
{% render_bundle 'bootstrap' js %}

<!-- Load extra external scripts -->
{% block extra_js %}{% endblock %}

<!-- Load external scripts -->
<script src="{% static 'js/lib/fontawesome.min.js' %}"></script>

<!-- Load Bootstrap styles and JavaScript -->
{% load render_bundle from webpack_loader %}
{% render_bundle 'bootstrap' js %}

<!-- Load extra external scripts -->
{% block extra_js %}{% endblock %}

</body>
</html>
5 changes: 0 additions & 5 deletions map/templates/map/home_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

{% block body %}
<div class="container-fluid">
<div class="row">
<div class="col-sm-10 offset-sm-1">
<h1>DataMade Code Challenge</h1>
</div>
</div>
<div class="row">
<div class="col-sm-10 offset-sm-1">
<div id="map"></div>
Expand Down
Loading