It's a utility to perform analytics on csv data. Specifically, NYC Buildings and Registration datasets. pandas is excellent for moderate workloads like these and as such has been integrated into the backend. To make it easier for end-user to upload and export data directly from the browser, a lightweight frontend is provided using the Flask framework. All the IO as been abstracted away with a basic rpc endpoint at /process, allowing you - as a stellar developer - to simply add a form with input name="fuction", value="python-function-name" and watch the magic unfold ✨🧝✨
-
Add the backend rpc function under
api/process.py@register def count_distinct_values(): file = request.files.get('exotic-csv') download_name = request.form.get('download_name') df = pd.read_csv(file) df = num_distinct_column_values(df) return export(df, download_name)
-
Add the corresponding form in
templates/main.html<form action="/process" method="post" enctype="multipart/form-data"> <div class="header">Count distinct column values</div> <input type="hidden" name="function" value="count_distinct_values" /> {{ forms.file(name='exotic-csv', label='Choose a file...') }} <input type="text" name="download_name" value="counting-foreva" /> <input type="submit" value="Process" /> </form>
-
Run the server using
python main.pyand head over to http://localhost:8000/ to blast away your exotic csv! 🚀 🥙
Try to avoid saving and reading files from server storage. As of now, the primary hosting environment of this project is public on replit - making it an easy target for exploit - especially when we're dealing with the excel format. If you absolutely must do server-side file IO, thoroughly sanitize both the local and remote input to your rpc function.
All-Buildings-Subject-to-HPD-Jurisdiction
Registration-Contacts-For-COOP-or-CONDO
Note that column names are in small caps
