This commit is contained in:
crawforc3@wp-laptop 2024-12-28 12:31:27 -08:00
commit 2c05a25128
5 changed files with 77 additions and 0 deletions

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# app/Dockerfile
FROM python:3.9-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/streamlit/streamlit-example.git .
RUN pip3 install -r requirements.txt
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["streamlit", "run", "main.py", "--server.port=8501", "--server.address=0.0.0.0"]

37
main.py Normal file
View File

@ -0,0 +1,37 @@
from collections import namedtuple
import altair as alt
import math
import pandas as pd
import streamlit as st
"""
# Welcome to Streamlit!
Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:
If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
forums](https://discuss.streamlit.io).
In the meantime, below is an example of what you can do with just a few lines of code:
"""
with st.echo(code_location='below'):
total_points = st.slider("Number of points in spiral", 1, 5000, 2000)
num_turns = st.slider("Number of turns in spiral", 1, 100, 9)
Point = namedtuple('Point', 'x y')
data = []
points_per_turn = total_points / num_turns
for curr_point_num in range(total_points):
curr_turn, i = divmod(curr_point_num, points_per_turn)
angle = (curr_turn + 1) * 2 * math.pi * i / points_per_turn
radius = curr_point_num / total_points
x = radius * math.cos(angle)
y = radius * math.sin(angle)
data.append(Point(x, y))
st.altair_chart(alt.Chart(pd.DataFrame(data), height=500, width=500)
.mark_circle(color='#0068c9', opacity=0.5)
.encode(x='x:Q', y='y:Q'))

16
readme.md Normal file
View File

@ -0,0 +1,16 @@
## Requirements
Build a simple application using ***existing technologies** (hint: we dont need you to build a shapefile parser from scratch)* that will allow shapefiles to be visualized on a map. Shapefile data does not need to be persisted into a database, this application should be ephemeral and have the potential to be entirely offline.
Youre free to use the framework of your choice. We want to understand how you approach this from a product perspective. Remember, were chasing ease of use!
**Please dont spend more than 1-2 hours on this exercise. Get something working, and we can have a discussion about features that would have followed.**
steps:
- streamlit getting started
- display a shapefile
- add a legend
- add feature to select shape file

0
requirements.txt Normal file
View File

2
streamlit_config.toml Normal file
View File

@ -0,0 +1,2 @@
[browser]
gatherUsageStats = false