commit 2c05a251288cf25e926b102349813bd85efb8d6d Author: crawforc3@wp-laptop Date: Sat Dec 28 12:31:27 2024 -0800 Init diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d1df1d0 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/main.py b/main.py new file mode 100644 index 0000000..826ef07 --- /dev/null +++ b/main.py @@ -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')) diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..2dca9e8 --- /dev/null +++ b/readme.md @@ -0,0 +1,16 @@ +## Requirements + +Build a simple application using ***existing technologies** (hint: we don’t 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. + +You’re free to use the framework of your choice. We want to understand how you approach this from a product perspective. Remember, we’re chasing ease of use! + +**Please don’t 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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/streamlit_config.toml b/streamlit_config.toml new file mode 100644 index 0000000..21f1540 --- /dev/null +++ b/streamlit_config.toml @@ -0,0 +1,2 @@ +[browser] + gatherUsageStats = false