who-owns-mass-backend
Django backend for Who Owns Massachusetts Application
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.0%) to scientific vocabulary
Keywords
Repository
Django backend for Who Owns Massachusetts Application
Basic Info
Statistics
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 12
- Releases: 1
Topics
Metadata Files
README.md
Who Owns Massachusetts Backend
Django backend for Who Owns Massachusetts application. It is built to use a PostgreSQL/PostGIS instance. There are two Django apps---the first is who_owns_mass, which stores the results of our property owner deduplication workflow. The second is evictions, which stores data related to summary process filings in Massachusetts. Work on interoperability between these two model sets is ongoing.
DB Schema

REST Endpoints
sites/{id}
Returns GeoJSON-formatted details for a given property (which we call a site). JSON keys largely follow our documenntation here.
metacorps/{id}
Returns details for a given metacorp (or network of companies). Includes the sites property, which is a GeoJSON-formatted list of properties owned by a given metacorp. JSON keys largely follow our documenntation here.
Set Up the Application
Setting Up Database PostgreSQL
The application is built to use a PostgreSQL instance with the PostGIS extension. To create this database, you can either use your preferred GUI (e.g., PGAdmin), or execute the following commands in e.g., psql.
sql
CREATE DATABASE who_owns_mass;
\c who_owns_mass;
CREATE EXTENSION postgis;
Create a Python Virtual Environment
Python offers multiple packages with which to manage virtual environments. venv will probably be just fine, but we have only tested this application in Python 3.10.2 and 3.13.0. If you run into Python version issues, use pyenv-virtualenv.
Simple Setup: venv
First, create your virtual environment. The line below creates the virtual environment in the root folder of the application.
shell
cd 'path/to/application/who-owns-mass-backend'
python3 -m venv ./venv
Active the Environment
Activate the environment by running...
```shell . ./venv/bin/activate
or, more explicitly...
source ./venv/bin/activate ```
Version-Controlled Setup: pyenv-virtualenv
If you want a virtual environment running a particular Python version, configure an env using pyenv-virtualenv. First, install the application.
Once it's installed, create the virtual Python environment like so...
shell
pyenv virtualenv 3.10.2 venv
Activate the Environment
Activate the environment by running...
shell
pyenv activate venv
You can trigger this environment automatically by running the following in the root folder of the application:
shell
echo "venv" >> .python-version
Install Dependencies
Once you've activated the virtual environemnt, Use pip to install all Python dependencies.
shell
pip install -r requirements.txt
Configure Django
Run the application
You should now be able to run the application by executing the following line. By default, the application will be running at localhost:8000.
shell
python ./manage.py runserver
Environment Variables and Settings
The application reads credentials and other environment variables from a .env file stored in config/settings/. For the app to run, the file should contain the following environment variables...
```bash DBNAME='yourdatabasename' DBUSER='yourdatabaseuser' DBPW='yourdatabasepassword' DBHOST='database_hose'
DB_Port should be given as a number.
DB_PORT=0000
Probably 'require' for remote and 'allow' for localhost.
DB_SSL='require' ```
Local Settings
If you have a local development environment that uses a PostgreSQL instance running on localhost, you can create a settings_local.py file to store database credentials, etc. It is listed in .gitignore to ensure you don't accidentally commit your credentials. We provide a sample in settings_local.example.py. Create settings_local.py from this example by running...
shell
cp config/settings/settings_local.example.py config/settings/settings_local.py
The file should contain the following:
```python from .settings import *
DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "NAME": "yourlocaldatabase", "USER": "yourlocaluser", "PASSWORD": "yourlocalpassword", "HOST": "localhost", "PORT": 0000, "OPTIONS": { "sslmode": 'allow' }, } } ```
Migrate Database
Once you've successfully configured your databases, you need to migrate the database using provided migrations. Run the following command to start the migration process:
shell
python ./manage.py migrate
You're Done!
The Django application is now ready to go! As a next step you should use see our documentation of the write_to_django.R process in the who-owns-mass-processing repository. This will write our deduplication results to the tables created by our Django models.
to run Django shell (and make it nice)
./manage.py shell_plus
Visualizing Database Schema
shell
pip install pygraphviz
python manage.py graph_models -a -g -o schema.png
Owner
- Name: Spatial Action Research Group
- Login: mit-spatial-action
- Kind: organization
- Email: ehuntley@mit.edu
- Repositories: 1
- Profile: https://github.com/mit-spatial-action
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Robsky Huntley" given-names: "Eric" orcid: "https://orcid.org/0000-0001-8497-0589" - family-names: "Aizman" given-names: "Asya" orcid: "https://orcid.org/0000-0002-7528-8585" title: "Who Owns Massachusetts Backend" version: 1.0.0 doi: 10.5281/zenodo.15364594 date-released: 2025-06-17 url: "https://github.com/mit-spatial-action/who-owns-mass-backend"
GitHub Events
Total
- Create event: 24
- Release event: 1
- Issues event: 33
- Delete event: 26
- Issue comment event: 22
- Push event: 52
- Pull request event: 48
Last Year
- Create event: 24
- Release event: 1
- Issues event: 33
- Delete event: 26
- Issue comment event: 22
- Push event: 52
- Pull request event: 48
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 27
- Total pull requests: 4
- Average time to close issues: 7 months
- Average time to close pull requests: about 2 months
- Total issue authors: 4
- Total pull request authors: 1
- Average comments per issue: 0.48
- Average comments per pull request: 0.5
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 8
- Pull requests: 0
- Average time to close issues: 5 days
- Average time to close pull requests: N/A
- Issue authors: 3
- Pull request authors: 0
- Average comments per issue: 0.25
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- connie-ly (14)
- ericrobskyhuntley (7)
- mchuttani18 (6)
- anastasia (4)
Pull Request Authors
- dependabot[bot] (30)
- anastasia (4)
- ericrobskyhuntley (1)