A free website that keeps the people informed about housing and evictions.

Overview

Eviction Tracker

Currently helping verify detainer warrant data for middle Tennessee - via Middle TN DSA - Red Door Collective

Features

  • Presents data visualizations for community awareness
  • Organizer Portal
    • Create direct action campaigns
    • Schedule events for campaigns
    • Record relevant information for phonebanking sessions
  • Admin Portal
    • Create and update detainer warrants

Development

Setup

You'll need to set a few secret environment variables before booting the app.

You can copy-paste the following lines into your terminal if you're using bash.

echo 'export TWILIO_ACCOUNT_SID=fake' >> ~/.bash_profile
echo 'export TWILIO_AUTH_TOKEN=fake' >> ~/.bash_profile

Then, you can either run source ~/.bash_profile or open a new terminal tab and proceed to the next step.

If you're wondering what the above code does: it defines two environment variables with the value "fake" and ensures they are available in all future (bash) shell sessions. TODO: make this process less painful.

Nix

Nix is a tool we use to ensure reproducable builds and deployments. Python's default build and deployment system is notoriously tricky. We've elected to use Nix instead to ease setup. Nix can be used for installing and deploying multiple languages, which may end up being useful for this project.

Install Nix

Please follow the instructions to install Nix on their website.

(Please ignore instructions regarding NixOS - that's a whole new operating system).

Using Nix

To work with the same python version as everyone else working on this project, you'll need to make sure you're in the nix-shell first.

  1. Check that you're in the same directory as shell.nix
  2. Type nix-shell and hit enter
  3. Wait for necessary dependencies to install from the internet to your machine

You'll get a new prompt that looks like:

[nix-shell:~/some/path/eviction-tracker]$ 

Now you're ready to run python and ipython! You can escape the nix-shell at any time by holding ctrl pressing the D key or typing exit and pressing enter.

Database

We use PostgreSQL for both development and production so that we can be assured working with the data locally will work exactly the same in production. Unfortunately, this requires a bit more manual setup for developers who don't already use Postgres.

First-time postgres

Install postgres with the most convenient installer for your OS.

The app doesn't care how you set up your postgres connection, so feel free to set up your postgres service in whatever method is convenient for you. By default, the SQLALCHEMY_DATABASE_URL is set to postgresql+psycopg2://[email protected]/eviction_tracker, which assumes that you've created a database called eviction_tracker, a user called eviction_tracker (without a password), and that you are using the default host and port of a postgres service running on the same host as the app.

Feel free to override this environment variable like SQLALCHEMY_DATABASE_URL="..." flask shell or create the same setup locally. If you're running your database on another host like a Docker container, you'll need to change localhost and possibly add a :port to your override.

Some postgres instructions on setting up for the default flow:

psql -U postgres # or, the superuser you've set up. -U postgres is default for modern installs

The above command will place you in this postgres shell:

postgres=# CREATE DATABASE eviction_tracker;
postgres=# CREATE USER eviction_tracker;
postgres=# GRANT ALL ON eviction_tracker to eviction_tracker;

These commands create the database, user, and assign all privileges for the user to the development database;

Migrations

Make sure to run flask db upgrade after setting up your database, or whenever a new migration is added to the migrations/ folder.

Google Spreadsheets

You'll need authentication to make requests to the online spreadsheet with the most current data.

Please install Keybase, a secure messaging platform. I will send any contributor who requests the authentication secrets the necessary file. When I send the file over Keybase, you'll need to download it, and move it somewhere you won't lose it.

By default, our scripts expect the file to be at the following path: ~/.config/gspread/service_account.json. In plain english: it should be in your home directory, under a hidden folder named .config and finally inside another folder called gspread. The file should be named service_account.json. If these are all true, you're good to go! If you'd like to save the file elsewhere or rename it, just run the script with your custom path under the optional argument: --service_account_key=/path/to/your/file.json.

Using a REPL

REPL (Read Eval Print Loop) is a concept implemented in many programming languages. If you've never written python before, we recommend spending an afternoon on these basics. You'll interact with a REPL in those courses.

While in a Nix Shell, launch the IPython shell like so:

ipython

And now, you can write python code with any of our libraries!

Running commands

While in a Nix Shell, run flask .

Bootstrap

You'll want to set up a small set of users and roles for development.

Run flask bootstrap to provision users and roles.

Afterwards, you'll be able to login to several demo users with varying roles.

  1. Superuser - [email protected]:123456
  2. Admin - [email protected]:123456
  3. Organizer - [email protected]:123456
  4. Defendant - [email protected]:123456

Sync database

To sync the data from our org's Google Spreadsheet, run flask sync .

If you want just a bit of data to work with locally, pass the --limit argument.

Example: flask sync --sheet-name 'detainer-warrants_15-02-2020' --limit 10 will populate the database with 10 detainer warrants from the spreadsheet titled detainer-warrants_15-02-2020.

Run app

To run the website locally, use flask run --no-reload within the nix-shell.

You'll be able to visit it at http://127.0.0.1:5000/

You can browse api endpoints like detainer warrants at http://127.0.0.1:5000/api/v1/detainer-warrants

Comments
  • Save a mock twilio response to the database

    Save a mock twilio response to the database

    Context

    Before we verify any phone numbers, we need to make sure we can save the verification data so we never lose what we've paid for. We are building a database of information: detainer warrants, attorneys, defendants, etc. There will also be a table for phone_number_verifications. We will then always be able to look up our data from Twilio in that database.

    Description

    This should serve as a test that our code will do the right thing when eventually validating a phone number.

    We should make sure that the JSON response documented by Twilio is able to be saved to the database.

    Example JSON response

    {
      "caller_name": {
        "caller_name": "Delicious Cheese Cake",
        "caller_type": "CONSUMER",
        "error_code": null
      },
      "carrier": null,
      "country_code": "US",
      "national_format": "(510) 867-5310",
      "phone_number": "+15108675310",
      "add_ons": null,
      "url": "https://lookups.twilio.com/v1/PhoneNumbers/+15108675310"
    }
    

    Modeling

    We need to build a database table to properly model this data before inserting it.

    I suggest:

    class PhoneNumberVerification(Base):
        __tablename__ = 'phone_number_verifications'
        id = Column(Integer, foreign_key=True)
        caller_name = Column(String)
        caller_type = Column(Integer) # smaller column than String
        error_code = Column(Integer)
        carrier = Column(String)
        country_code = Column(String)
        national_format = Column(String)
        phone_number = Column(String)
    

    This is actively under construction. Follow progress in #6.

    Inserting

    Please follow SQLAlchemy docs for how to insert this kind of data to the database

    Testing

    We don't yet have a test suite, i'll comment on this issue when we do. When that is set up, we can write a test to close out this issue:

    1. Create mock JSON data
    2. Test that the JSON can be inserted into the phone_number_verifications table
    opened by gregziegan 3
  • Test Twilio Phone Verfication Database Insertion

    Test Twilio Phone Verfication Database Insertion

    This creates a test to ensure a mock JSON Twilio response can be saved as a valid PhoneNumberVerification entry. A second test was added that checks the input of the mock Twilio response to what is saved in the database.

    opened by donald-mate 1
  • Set up SQLite database

    Set up SQLite database

    Binary files are bloated and terrible way to manage data over time. Let's use a simple database like SQLite for the time being.

    Checklist

    • [x] Set up SQLite for local development
    • [x] Create tables for detainer warrants and associated data
    • [ ] Create table for phone number verifications
    • [ ] Automate spreadsheet insertion into detainer warrant table
    opened by gregziegan 1
  • Separate Judgments from Hearings

    Separate Judgments from Hearings

    Context

    The site uses the concept of a Judgment to refer to both a hearing (scheduled court date) and its outcome. This is OK, but makes matching Judgment to hearings difficult as the only method of matching judgments to hearings is via court and file date. The judgment document is filed sometime after the court date. We can use this knowledge to guess which judgment corresponds to which hearing. This code was quite messy to work with when there were not two separate tables.

    Description

    Hearings and Judgments

    This PR introduces another table for hearings, where web scraping of the CircuitClerk will always be the sole author of that data. Users will not be able to edit hearing details. Judgment data is now connected to hearings via automatic PDF scraping, with an ability for users to fix details of the scraping.

    UI changes

    The detainer warrant is now merely a landing page for hearings and judgments. You must edit a judgement on a judgment page. There is now a Judgments table UI to help expedite auditing of judgments.

    Database changes

    I tried to get the migration scripts working for the data transition but got stuck on certain SQL transactions. After messing with it for a few hours i decided this was not worth the time since we always have a data backup since mid-November via google sheets and database dumps on the production server. I'll instead be executing sqlalchemy queries through the flask shell to fix data.

    opened by gregziegan 0
  • Convert to Paack-ui; remove extraneous fields; expand Judgement

    Convert to Paack-ui; remove extraneous fields; expand Judgement

    1. convert to paack-ui
    2. remove presiding judge from warrant
    3. move court date and court room to "judgements"
    4. switch to posix for all date and datetime columns
    opened by gregziegan 0
  • An organizer can record info from their phonebank into a form on the website

    An organizer can record info from their phonebank into a form on the website

    Phone Bank Script

    Let's add some text fields to capture notes.

    There's a lot of "If" statements in the script that would be great to automate. Say, click a button and another piece of the form shows up.

    opened by gregziegan 0
Releases(v314)
Got-book-6 - LSTM trained on the first five ASOIAF/GOT books

GOT Book 6 Generator Are you tired of waiting for the next GOT book to come out? I know that I am, which is why I decided to train a RNN on the first

Zack Thoutt 974 Oct 27, 2022
Python implementation of the Lox language from Robert Nystrom's Crafting Interpreters

pylox Python implementation of the Lox language from Robert Nystrom's Crafting Interpreters. https://craftinginterpreters.com. This only implements th

David Beazley 37 Dec 28, 2022
Exercise to teach a newcomer to the CLSP grid to set up their environment and run jobs

Exercise to teach a newcomer to the CLSP grid to set up their environment and run jobs

Alexandra 2 May 18, 2022
Python based scripts for obtaining system information from Linux.

sysinfo Python based scripts for obtaining system information from Linux. Python2 and Python3 compatible Output in JSON format Simple scripts and exte

Petr Vavrin 70 Dec 20, 2022
An Android app that runs Elm in a webview. And a Python script to build the app or install it on the device.

Requirements You need to have installed: the Android SDK Elm Python git Starting a project Clone this repo and cd into it: $ git clone https://github.

Benjamin Le Forestier 11 Mar 17, 2022
Scientific Programming: A Crash Course

Scientific Programming: A Crash Course Welcome to the Scientific Programming course. My name is Jon Carr and I am a postdoc in Davide Crepaldi's lab.

Jon Carr 1 Feb 17, 2022
A utility control surface for Ableton Live that makes the initialization of a Mixdown quick

Automate Mixdown initialization A script that transfers all the VSTs on your MIDI tracks to a new track so you can freeze your MIDI tracks and then co

Aarnav 0 Feb 23, 2022
A community based economy bot with python works only with python 3.7.8 as web3 requires cytoolz

A community based economy bot with python works only with python 3.7.8 as web3 requires cytoolz has some issues building with python 3.10

4 Jan 01, 2022
Suite of tools for retrieving USGS NWIS observations and evaluating National Water Model (NWM) data.

Documentation OWPHydroTools GitHub pages documentation Motivation We developed OWPHydroTools with data scientists in mind. We attempted to ensure the

36 Dec 11, 2022
A Python Based Utility for Processing GST-Return JSON Files to Multiple Formats

GSTR 1/2A Utility by Shan.tk Open Source GSTR 1/GSTR 2A JSON to Excel utility based on Python. Useful for Auditors in Verifying GSTR 1 Return Invoices

Sudharshan TK 1 Oct 08, 2022
A scuffed remake of Kahoot... Made by Y9 and Y10 SHSB

A scuffed remake of Kahoot... Made by Y9 and Y10 SHSB

Tobiloba Kujore 3 Oct 28, 2022
Localization and multifractal properties of the long-range Kitaev chain in the presence of an Aubry-André-Harper modulation

This repository contains the code for the paper Localization and multifractal properties of the long-range Kitaev chain in the presence of an Aubry-André-Harper modulation.

Joana Fraxanet 2 Apr 17, 2022
Python Multilingual Ucrel Semantic Analysis System

PymUSAS Python Multilingual Ucrel Semantic Analysis System, it currently is a rule based token level semantic tagger which can be added to any spaCy p

UCREL 13 Nov 18, 2022
Fix Eitaa Messenger's Font Problem on Linux

Fix Eitaa Messenger's Font Problem on Linux

6 Oct 15, 2022
A python script for combining multiple native SU2 format meshes into one mesh file for multi-zone simulations.

A python script for combining multiple native SU2 format meshes into one mesh file for multi-zone simulations.

MKursatUzuner 1 Jan 20, 2022
适用于HoshinoBot下的人生重来模拟器插件

LifeRestart for HoshinoBot 原作地址 python版原地址 本项目地址 安装方法 这是一个HoshinoBot的人生重来模拟器插件 这个项目使用的HoshinoBot的消息触发器,如果你了解其他机器人框架的api(比如nonebot)可以只修改消息触发器就将本项目移植到其他

黛笙笙 16 Sep 03, 2022
This is the improvised version of Dobot Magician which can be implemented for Dobot M1

pydobotM1 This is the edited driver for Dobot M1 version of the original pydobot library intended for use with the Dobot Magician. Here's what you nee

Shaik Abdullah 2 Jul 11, 2022
propuestas electorales de los candidatos a constituyentes, Chile 2021

textos-constituyentes propuestas electorales de los candidatos a constituyentes, Chile 2021 Programas descargados desde https://elecciones2021.servel.

Sergio Lucero 6 Nov 19, 2021
A lightweight Python module to interact with the Mitre Att&ck Enterprise dataset.

enterpriseattack - Mitre's Enterprise Att&ck A lightweight Python module to interact with the Mitre Att&ck Enterprise dataset. Built to be used in pro

xakepnz 7 Jan 01, 2023
GEGVL: Google Earth Based Geoscience Video Library

Google Earth Based Geoscience Video Library is transforming to Server Based. The

3 Feb 11, 2022