Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ru refresh predict #152

Open
wants to merge 320 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
320 commits
Select commit Hold shift + click to select a range
367ceb2
add acs tract wide table
jfeser Aug 16, 2024
9ea31f2
adding file to load from bucket to db
naiimic Aug 16, 2024
889d8ce
filter tracts in wide table using city boundary
jfeser Aug 16, 2024
ed6c7e6
convert all geometry to standardized srid
jfeser Aug 19, 2024
b26754c
include all zip codes that intersect the city boundary
jfeser Aug 19, 2024
8159ba1
include all zip codes that intersect the city boundary
jfeser Aug 19, 2024
8c96c52
convert all geometry to standardized srid
jfeser Aug 19, 2024
98437a0
add downtown, university, and transit lines
jfeser Aug 19, 2024
bc1217d
add missing primary keys to allow for qgis viz
jfeser Aug 19, 2024
b177443
add high frequency transit stops model
jfeser Aug 19, 2024
778a445
Merge branch 'db-parcels' of github.com:BasisResearch/cities into db-…
jfeser Aug 19, 2024
190cbeb
remove version 1
jfeser Aug 19, 2024
f7a270d
slim scripts in progress
rfl-urbaniak Aug 19, 2024
5134435
retrained with pyro 1.9.1
rfl-urbaniak Aug 20, 2024
4f1748c
training and prediction for deployment test ready
rfl-urbaniak Aug 20, 2024
6fb6354
format lint
rfl-urbaniak Aug 20, 2024
028368f
add dependencies to setup.py
jfeser Aug 20, 2024
2f517dc
Merge branch 'db-api' into db-parcels
jfeser Aug 20, 2024
8e7ebf8
format
jfeser Aug 20, 2024
d2cfa81
ensure postgis is loaded
jfeser Aug 20, 2024
6870b93
unconditionally load all data
jfeser Aug 20, 2024
a72f6f0
null out missing data in residential_permits
jfeser Aug 20, 2024
d33588e
ensure table drop succeeds
jfeser Aug 20, 2024
6c3b575
start adding tables to be used by the model
jfeser Aug 20, 2024
a820807
fix misnamed field
jfeser Aug 20, 2024
9590725
remove last references to old raw schema
jfeser Aug 21, 2024
42847e5
add new loader for acs data
jfeser Aug 21, 2024
686ee09
correctly refer to seed
jfeser Aug 21, 2024
30323c4
more work on tables for model
jfeser Aug 21, 2024
5800b5d
more work on tables for model
jfeser Aug 21, 2024
13952dc
cleanup
jfeser Aug 21, 2024
92f6285
finish adding columns to census_tracts_wide
jfeser Aug 21, 2024
2526c31
remove unused line in clean.sh
jfeser Aug 21, 2024
8da0487
switch api to use public schema
jfeser Aug 22, 2024
9319009
distance to transit should include lines and stops
jfeser Aug 22, 2024
d353167
correct year range for parcels
jfeser Aug 22, 2024
24af31a
add census_tract field
jfeser Aug 22, 2024
5a00c7f
add acs fields to census_tract_wide
jfeser Aug 22, 2024
3ab57e7
readd field name
jfeser Aug 23, 2024
353bcfe
add whiteness and income demographic variables to census_tracts_wide
jfeser Aug 23, 2024
a5b311f
correctly handle the downtown parking limit elimination
jfeser Aug 23, 2024
ea007ac
add mean_limit to the wide table
jfeser Aug 23, 2024
95973f6
correctly load hispanic_or_latino acs data
jfeser Aug 26, 2024
8605652
filter census tracts to city boundary when computing segregation indexes
jfeser Aug 26, 2024
f69a868
unify approach to year replacement for demographic data
jfeser Aug 26, 2024
b776310
fix up acs_tract_wide
jfeser Aug 27, 2024
465bbfe
add type casts
jfeser Aug 27, 2024
be166d2
extract demographics table
jfeser Aug 27, 2024
4cd4b36
switch api over to demographics wide table
jfeser Aug 27, 2024
5ca1ba8
add census_tracts api endpoint
jfeser Aug 27, 2024
ef1fb5b
use filtered census tracts in api endpoint
jfeser Aug 28, 2024
2912c19
add dbt to dev depends
jfeser Aug 28, 2024
027085e
add numeric encoding of census tracts
jfeser Aug 28, 2024
8a00c91
use original column names in census_tracts_wide
jfeser Aug 28, 2024
0ede914
add standardize functions for categorical variables
jfeser Aug 28, 2024
bdf65a1
switch train_model and predict over to database source
jfeser Aug 28, 2024
ca3f8e7
census tracts need to be in 4269 for the api
jfeser Aug 29, 2024
eccbd84
reorganize dbt models to support census tract model
jfeser Aug 29, 2024
1fdbf2b
refactor
jfeser Aug 29, 2024
cfa9713
move tract filters to shared view
jfeser Aug 29, 2024
d602f9c
filter out data before 2011, because we don't have demographics
jfeser Aug 29, 2024
08cc805
reorganize api and add high frequency transit
jfeser Aug 30, 2024
68de90b
replace 2020 census tract geometry with 2019
jfeser Aug 30, 2024
e2b666a
use db to perform interventions
jfeser Aug 29, 2024
9da6843
fix srid for api
jfeser Aug 30, 2024
2de2b05
type conversion
jfeser Sep 3, 2024
ab5a48f
refactor
jfeser Sep 3, 2024
3cc1bf4
add .env file with db info
jfeser Sep 3, 2024
a76480a
add missing files
jfeser Sep 3, 2024
affab56
simplify acs models
jfeser Sep 3, 2024
cea3777
simplify zip_codes
jfeser Sep 3, 2024
80e1fb2
document acs data
jfeser Sep 3, 2024
1b48785
document and reorganize zip code models
jfeser Sep 3, 2024
489cbaa
document and reorganize residential permit model
jfeser Sep 3, 2024
d263aae
reorganize and document commercial permits
jfeser Sep 3, 2024
f5ae90c
reorganize fair market rents
jfeser Sep 3, 2024
9a84d87
document high frequency transit lines
jfeser Sep 3, 2024
ab2eb43
reorganize parcels
jfeser Sep 3, 2024
0bda2c7
finish reorganization
jfeser Sep 3, 2024
fd89ca4
reorganize fair market rents data
jfeser Sep 4, 2024
4d3cf74
add mapping table for translating from zip codes to zctas
jfeser Sep 4, 2024
6639fa0
add new api code
jfeser Sep 4, 2024
7b818b9
continue refactoring zip codes to zctas
jfeser Sep 4, 2024
f3c2fc1
refactor load_server to no longer require the password as an env var
jfeser Sep 4, 2024
76fa4a7
handle one to many mapping problem
jfeser Sep 4, 2024
85d8325
add more documentation
jfeser Sep 4, 2024
e52b637
materialize for performance
jfeser Sep 4, 2024
744d8b6
add .env
jfeser Sep 4, 2024
e9bd649
fix causal_insight_slim.py so that app will load
jfeser Sep 4, 2024
2227b1c
work on getting predict ready to connect to api
jfeser Sep 4, 2024
6095236
data setup WIP
rfl-urbaniak Sep 5, 2024
6dcb1c7
added pg dataset, cursory EDA
rfl-urbaniak Sep 5, 2024
266d24f
add mean and median parcel areas per tract
jfeser Sep 5, 2024
f4a5af4
forgot to standardize new columns
jfeser Sep 5, 2024
65b38d5
testing sqm
rfl-urbaniak Sep 5, 2024
9c52b0b
more api work
jfeser Sep 5, 2024
238d1b3
Merge branch 'ru-tracts-minimal-deployment' of github.com:BasisResear…
jfeser Sep 5, 2024
1babc51
add temp high frequency transit lines endpoint
jfeser Sep 5, 2024
6e6ec3b
added all sqm columns to torch data loader
rfl-urbaniak Sep 6, 2024
801b7a7
add more documentation to tracts model tables
jfeser Sep 6, 2024
85eac69
remove spurious points from transit lines data
jfeser Sep 6, 2024
f512ec0
fix dropped model
jfeser Sep 6, 2024
3d5ccd1
remove unused config
jfeser Sep 6, 2024
ec72e2c
drop api from pr
jfeser Sep 6, 2024
8a76e97
select correct geometries
jfeser Sep 6, 2024
d37849a
update .gitignore from ru-tracts-model
rfl-urbaniak Sep 9, 2024
c958a71
Merge branch 'staging-zoning' of https://github.com/BasisResearch/cit…
rfl-urbaniak Sep 9, 2024
6e2a361
new format lint
rfl-urbaniak Sep 9, 2024
5cf1ca5
pin pyro to pass inference test
rfl-urbaniak Sep 9, 2024
e79617c
getting inference test to work
rfl-urbaniak Sep 9, 2024
348bc00
add seaborn to setup to pass notebook tests
rfl-urbaniak Sep 9, 2024
207fd82
Merge pull request #144 from BasisResearch/db-parcels
rfl-urbaniak Sep 9, 2024
591753b
scripts and mechanisms
jfeser Sep 9, 2024
9ed393c
added model compontents
rfl-urbaniak Aug 5, 2024
9bb6982
test get_n
rfl-urbaniak Aug 5, 2024
9f56a9e
tests for linear component
rfl-urbaniak Aug 5, 2024
b94be7f
test logistic component
rfl-urbaniak Aug 5, 2024
c1d8180
test ratio component
rfl-urbaniak Aug 5, 2024
592fa34
black upgraded
rfl-urbaniak Aug 5, 2024
4eed575
remove worktrees
rfl-urbaniak Aug 7, 2024
d2e11f1
small revision to clean
rfl-urbaniak Aug 7, 2024
418a888
clean up experimental notebooks structure
rfl-urbaniak Aug 7, 2024
f5e75aa
moved cleaning scripts, test model WIP
rfl-urbaniak Aug 7, 2024
b345066
tracts model test added
rfl-urbaniak Aug 7, 2024
5ef5295
added clean path script
rfl-urbaniak Aug 7, 2024
087d509
renaming model file
rfl-urbaniak Aug 7, 2024
3490733
add evaluation, format lint
rfl-urbaniak Aug 7, 2024
8b04614
add eval to model test
rfl-urbaniak Aug 7, 2024
61b0fc2
add trained guide and params
rfl-urbaniak Aug 7, 2024
b053058
modeling notebook
rfl-urbaniak Aug 7, 2024
062c7c6
clean notebook
rfl-urbaniak Aug 7, 2024
4e72837
slim scripts in progress
rfl-urbaniak Aug 19, 2024
bc1a657
retrained with pyro 1.9.1
rfl-urbaniak Aug 20, 2024
71aacf3
training and prediction for deployment test ready
rfl-urbaniak Aug 20, 2024
45d86f6
format lint
rfl-urbaniak Aug 20, 2024
2aea5aa
switch train_model and predict over to database source
jfeser Aug 28, 2024
68591de
use db to perform interventions
jfeser Aug 29, 2024
053a882
refactor
jfeser Sep 3, 2024
24b9be8
add missing files
jfeser Sep 3, 2024
c0eac8f
fix causal_insight_slim.py so that app will load
jfeser Sep 4, 2024
bfdf970
work on getting predict ready to connect to api
jfeser Sep 4, 2024
ece310a
more api work
jfeser Sep 5, 2024
e8ffc03
data setup WIP
rfl-urbaniak Sep 5, 2024
31fa638
added pg dataset, cursory EDA
rfl-urbaniak Sep 5, 2024
042f648
testing sqm
rfl-urbaniak Sep 5, 2024
f92766f
fix up paths
jfeser Sep 5, 2024
703ace2
take intervention as parameters
jfeser Sep 6, 2024
84ec622
copy postgrest api over from db-parcels
jfeser Sep 6, 2024
897870e
work on api
jfeser Sep 9, 2024
e818adb
update model components
rfl-urbaniak Sep 9, 2024
09cb711
gitignore
rfl-urbaniak Sep 9, 2024
6c15638
build api container
jfeser Sep 9, 2024
db7924a
refactor WIP
rfl-urbaniak Sep 10, 2024
5369744
refactor WIP
rfl-urbaniak Sep 10, 2024
1be1133
tests
rfl-urbaniak Sep 10, 2024
5c1bfb9
tests
rfl-urbaniak Sep 10, 2024
0b73b9e
adding test
rfl-urbaniak Sep 10, 2024
1099156
tests
rfl-urbaniak Sep 10, 2024
23cf535
added shape testing
rfl-urbaniak Sep 10, 2024
f22ca14
lint, delete error return value from model
rfl-urbaniak Sep 10, 2024
d54b6e2
more work on api deployment
jfeser Sep 10, 2024
0eaf79c
perf improvements
jfeser Sep 10, 2024
05e80e6
fix connection pool exhaustion
jfeser Sep 10, 2024
5fb80c3
fix shape bug in categorical, lint, tests, cleanup
rfl-urbaniak Sep 11, 2024
afc2517
fix bug in categorical component, cleanup, format, lint
rfl-urbaniak Sep 11, 2024
9c20daf
Merge branch 'staging-zoning' of https://github.com/BasisResearch/cit…
rfl-urbaniak Sep 11, 2024
f952e9a
resolve conflicts
rfl-urbaniak Sep 11, 2024
5481c16
none safety
jfeser Sep 11, 2024
a82b3ad
adding tests to test_all
rfl-urbaniak Sep 11, 2024
2bb8eaa
include all demographics and census tracts in frontend
jfeser Sep 11, 2024
be2fc5d
allow caching api responses
jfeser Sep 11, 2024
df5390f
add api runner
jfeser Sep 11, 2024
4a76369
return proper geojson features
jfeser Sep 11, 2024
20ef5ad
ensure geometry is in the right srid
jfeser Sep 11, 2024
cbeea8a
return featurecollections
jfeser Sep 11, 2024
256a9b1
Merge branch 'ru-tracts-minimal-deployment' of github.com:BasisResear…
jfeser Sep 11, 2024
a3c67e7
allow all origins in dev
jfeser Sep 11, 2024
b2b817d
use db_username to avoid shell issue
naiimic Sep 11, 2024
d7e9aa9
Merge branch 'ru-tracts-minimal-deployment' of https://github.com/Bas…
naiimic Sep 11, 2024
8e4e54d
remove redundant conditioning from model components
rfl-urbaniak Sep 11, 2024
ecb01a1
further shape generalization
rfl-urbaniak Sep 11, 2024
fa17f65
Merge pull request #141 from BasisResearch/ru-nonexp-tracts-model-eva…
azane Sep 11, 2024
6554bc4
add load_dotenv to train_model
rfl-urbaniak Sep 12, 2024
1c64747
Merge branch 'staging-zoning' of https://github.com/BasisResearch/cit…
rfl-urbaniak Sep 12, 2024
d2e3d7b
pull orign from staging, format, lint
rfl-urbaniak Sep 12, 2024
72307dc
user-facing overview WIP
rfl-urbaniak Sep 12, 2024
b0c2e81
note to self in overview
rfl-urbaniak Sep 12, 2024
4ea4694
format
jfeser Sep 12, 2024
b1c9863
Merge branch 'ru-tracts-minimal-deployment' of github.com:BasisResear…
jfeser Sep 12, 2024
51728f5
Merge branch 'ru-tracts-minimal-deployment' of https://github.com/Bas…
rfl-urbaniak Sep 12, 2024
a723c64
added overview draft
rfl-urbaniak Sep 12, 2024
9835a69
switch predict endpoint to produce cumulative estimates
jfeser Sep 12, 2024
4c49ea9
scripts to grab private local env from home
rfl-urbaniak Sep 12, 2024
502ea83
clean makefile reference to grab
rfl-urbaniak Sep 12, 2024
3a5a78f
fixing param saving and passing pipeline
rfl-urbaniak Sep 12, 2024
e76b15b
up n_steps back to 2000
rfl-urbaniak Sep 12, 2024
e24ffe4
swap models, fix train->predict generate loader pipeline
rfl-urbaniak Sep 12, 2024
d9c7d3e
up n_steps to 2k again
rfl-urbaniak Sep 12, 2024
459b39d
minor changes
jfeser Sep 12, 2024
96e3842
Merge branch 'ru-tracts-minimal-deployment' of github.com:BasisResear…
jfeser Sep 12, 2024
94fb197
add missing params warning to predict
rfl-urbaniak Sep 12, 2024
5c039d5
Merge branch 'ru-tracts-minimal-deployment' of https://github.com/Bas…
rfl-urbaniak Sep 12, 2024
5772ca8
fixing duplicates in setup
rfl-urbaniak Sep 12, 2024
05905aa
fixing duplicates in setup
rfl-urbaniak Sep 12, 2024
6f60eb0
update gitignore
rfl-urbaniak Sep 12, 2024
6a67a15
remove unused predictor function
jfeser Sep 12, 2024
4c2a98f
improve use of multi-world counterfactual
jfeser Sep 12, 2024
c8ce72a
use different radii for yellow zone lines and stops
jfeser Sep 12, 2024
707db45
Merge branch 'ru-tracts-minimal-deployment' of github.com:BasisResear…
jfeser Sep 12, 2024
39e8eed
fix use of yellow zone radius
jfeser Sep 16, 2024
17a41d3
fix bug in demographics table construction
jfeser Sep 16, 2024
15524d3
use search_path to switch between dev and prod tables
jfeser Sep 16, 2024
b3f6405
format, lint
rfl-urbaniak Sep 30, 2024
246d0c4
simplify private env grabbing
rfl-urbaniak Sep 30, 2024
42f2c50
uncomment
jfeser Sep 30, 2024
52d03e2
Merge branch 'ru-tracts-minimal-deployment' of github.com:BasisResear…
jfeser Sep 30, 2024
052a39e
update .gitignore
jfeser Sep 30, 2024
17e6814
add new region fields to census tract data
jfeser Oct 1, 2024
d357a9d
frontend pipeline on linux
rfl-urbaniak Oct 1, 2024
1e27a1c
Merge branch 'ru-tracts-minimal-deployment' of https://github.com/Bas…
rfl-urbaniak Oct 1, 2024
be72dbf
preds to gitignore
rfl-urbaniak Oct 8, 2024
dbddefd
decrease predict iters to 5
rfl-urbaniak Oct 8, 2024
6a8d85f
format, lint
rfl-urbaniak Oct 8, 2024
582e7c1
adding year as variable
naiimic Oct 9, 2024
91bf11e
add population and population density
jfeser Oct 10, 2024
868f5c7
compute parking limits entirely in predict.py
jfeser Oct 11, 2024
299f3a2
fix bug in test
jfeser Oct 11, 2024
b790504
update model components & tests
rfl-urbaniak Oct 16, 2024
e0bed8e
model tests upgrade wip
rfl-urbaniak Oct 16, 2024
f9a89ef
tests update wip
rfl-urbaniak Oct 16, 2024
1c43f2c
udate gitignore
rfl-urbaniak Oct 16, 2024
c5687ac
train model works
rfl-urbaniak Oct 16, 2024
2ac1b2c
port predict, rename the current one
rfl-urbaniak Oct 16, 2024
16c1878
predictor wip
rfl-urbaniak Oct 16, 2024
8794222
test, format, lint
rfl-urbaniak Oct 16, 2024
d4d3017
datase pipeline now uses the predictor class
rfl-urbaniak Oct 16, 2024
35add30
format, lint
rfl-urbaniak Oct 16, 2024
d00e5b1
clean up predict and train
rfl-urbaniak Oct 16, 2024
247902c
format, lint
rfl-urbaniak Oct 16, 2024
0c41d25
ported and trained ts model
rfl-urbaniak Nov 15, 2024
76e2330
new predictor
rfl-urbaniak Nov 15, 2024
5858259
moved predictor notebook
rfl-urbaniak Nov 15, 2024
a34a3cf
Merge pull request #145 from BasisResearch/ru-tracts-minimal-deployment
rfl-urbaniak Nov 15, 2024
ce0bcdd
turn off dev mode in predict
rfl-urbaniak Nov 15, 2024
f205ac2
format, lint
rfl-urbaniak Nov 15, 2024
eeb3b6b
guide update revised
rfl-urbaniak Nov 15, 2024
e26b5fb
format, lint
rfl-urbaniak Nov 15, 2024
eb91b8b
update the api
rfl-urbaniak Nov 15, 2024
55f80a2
addition to zoning_tracts_ts_predictor
rfl-urbaniak Nov 18, 2024
b9d1930
updating predict.py and adding summarize_time_series function in anot…
naiimic Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
GOOGLE_CLOUD_PROJECT=cities-429602
GOOGLE_CLOUD_BUCKET=minneapolis-basis

ENV=dev
INSTANCE_CONNECTION_NAME=cities-429602:us-central1:cities-devel
DB_SEARCH_PATH=dev,public
HOST=34.123.100.76
SCHEMA=minneapolis
DATABASE=cities
DB_USERNAME=postgres
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source venv/bin/activate
dotenv
export PASSWORD=VA.TlSR#Z%mu**Q9
26 changes: 25 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ cities.egg-info/*
cities.egg-info/
*/__pycache__
*.pyc
**/*.pyc
**/*.pyc
tests/__pycache__/
.mypy_cache/

**/*.Rproj.user/
**/*.Rproj/
**/*.Rhistory
**/*.Rdata
**/*.RData

build/

.vscode/settings.json
tests/.coverage
tests/pytest_report/
Expand All @@ -23,3 +31,19 @@ tests/.coverage
.vscode/launch.json
data/sql/counties_database.db
data/sql/msa_database.db

# data
data/minneapolis/processed/values_long.csv
data/minneapolis/processed/values_with_parking.csv
data/minneapolis/sourced/demographic/**
data/minneapolis/preds/**
data/minneapolis/sourced/parcel_to_census_tract_mappings/**
data/minneapolis/sourced/parcel_to_parking_info_mappings/**
cities/deployment/tracts_minneapolis/tracts_model_guide.pkl
cities/deployment/tracts_minneapolis/tracts_model_params.pth
/build/
docs/experimental_notebooks/zoning/interactions_preds.dill
docs/experimental_notebooks/zoning/population_preds.dill
docs/experimental_notebooks/zoning/waic_dict_7.pkl
docs/experimental_notebooks/zoning/waic_dict_13.pkl
docs/experimental_notebooks/zoning/waic_dict_14.pkl
37 changes: 29 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
format: FORCE
./scripts/clean.sh


path ?= .

format_path: FORCE
./scripts/clean_path.sh $(path)

lint: FORCE
./scripts/lint.sh
./scripts/lint.sh

test: FORCE
test: FORCE
./scripts/test.sh

test_all: FORCE
./scripts/clean.sh
./scripts/lint.sh
./scripts/test.sh
./scripts/test_notebooks.sh

test_notebooks: FORCE
./scripts/test_notebooks.sh

done: FORCE
./scripts/clean.sh
./scripts/lint.sh
./scripts/test.sh
./scripts/test_notebooks.sh
api/requirements.txt: FORCE
pip-compile --extra api --output-file api/requirements.txt

api-container-build: FORCE
mkdir -p build
cp -r cities build
cp -r api/* build
cp .env build
cd build && docker build --platform linux/amd64 -t cities-api .

api-container-push:
docker tag cities-api us-east1-docker.pkg.dev/cities-429602/cities/cities-api
docker push us-east1-docker.pkg.dev/cities-429602/cities/cities-api

run-api-local:
docker run --rm -it -e PORT=8081 -e PASSWORD -p 3001:8081 cities-api

FORCE:
FORCE:
64 changes: 55 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,52 @@
</p>


## Evaluating Policy Transfer via Similarity Analysis and Causal Inference
# Evaluating Policy Transfer via Similarity Analysis and Causal Inference


## Getting started


Welcome to the repository for [polis](http://polis.basis.ai/), developed by [Basis Research Institute](https://www.basis.ai/) for [The Opportunity Project (TOP)](https://opportunity.census.gov/) 2023 in collaboration with the U.S. Department of Commerce. The primary goal of this project is to enhance access to data for local policymakers, facilitating more informed decision-making.

This is the backend repository for more advanced users. For a more pleasant frontend experience and more information, please use the [app](http://polis.basis.ai/).


Installation
------------

**Basic Setup:**

```sh

git clone git@github.com:BasisResearch/cities.git
cd cities
git checkout main
pip install .
```
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .
cd tests && python -m pytest

The above will install the minimal version that's ported to [polis.basis.ai](http://polis.basis.ai)

**Dev Setup:**

To install dev dependencies, needed to run models, train models and run all the tests, run the following command:

```sh
pip install -e .[dev]
```

Details of which packages are available in which see `setup.py`.

Welcome to the repository for [polis](http://polis.basis.ai/), developed by the [Basis Research Institute](https://www.basis.ai/) for [The Opportunity Project (TOP)](https://opportunity.census.gov/) 2023 in collaboration with the U.S. Department of Commerce. The primary goal of this project is to enhance access to data for local policymakers, facilitating more informed decision-making.

This is the backend repository for more advanced users. For a more pleasant frontend experience and more information, please use the [app](http://polis.basis.ai/).
** Contributing: **

Before submitting a pull request, please autoformat code and ensure that unit tests pass locally

```sh
make lint # linting
make format # runs black and isort, including on notebooks in the docs/ folder
make tests # linting, unit and notebook tests
```


### The repository is structured as follows:
Expand All @@ -36,11 +69,24 @@ This is the backend repository for more advanced users. For a more pleasant fron
└── tests
```

**WARNING: during the beta testing, the most recent version lives on the `staging-county-data` git branch, and so do the most recent versions of the notebooks. Please switch to this branch before inspecting the notebooks.

If you're interested in downloading the data or exploring advanced features beyond the frontend, check out the `guides` folder in the `docs` directory. There, you'll find:
- `data_sources.ipynb` for information on data sources,
- `similarity-conceptual.ipynb` for a conceptual account of how similarity comparison works.
- `counterfactual-explained.ipynb` contains a rough explanation of how our causal model works.
- `similarity_demo.ipynb` demonstrating the use of the `DataGrabber` class for easy data acces, and of our `FipsQuery` class, which is the key tool in the similarity-focused part of the project,
- `causal_insights_demo.ipynb` for an overview of how the `CausalInsight` class can be used to explore the influence of a range of intervention variables thanks to causal inference tools we employed. [WIP]

Feel free to dive into these resources to gain deeper insights into the capabilities of the Polis project, or to reach out if you have any comments or suggestions.
## Interested? We'd love to hear from you.

[polis](http://polis.basis.ai/) is a research tool under very active development, and we are eager to hear feedback from users in the policymaking and public administration spaces to accelerate its benefit.

If you have feature requests, recommendations for new data sources, tips for how to resolve missing data issues, find bugs in the tool (they certainly exist!), or anything else, please do not hesitate to contact us at polis@basis.ai.

To stay up to date on our latest features, you can subscribe to our [mailing list](https://dashboard.mailerlite.com/forms/102625/110535550672308121/share). In the near-term, we will send out a notice about our upcoming batch of improvements (including performance speedups, support for mobile, and more comprehensive tutorials), as well as an interest form for users who would like to work closely with us on case studies to make the tool most useful in their work.

Lastly, we emphasize that this website is still in beta testing, and hence all predictions should be taken with a grain of salt.

Acknowledgments: polis was built by Basis, a non-profit AI research organization dedicated to creating automated reasoning technology that helps solve society's most intractable problems. To learn more about us, visit https://basis.ai.

10 changes: 10 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.12

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "main.py" ]
Loading