-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (20 loc) · 1.11 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from sqlalchemy import create_engine
from spacerat.core import SpaceRAT
from spacerat.helpers import print_records
from spacerat.model import RegionSet
if __name__ == "__main__":
# initializing without args will use an in-memory sql db to hold the model,and will load the model
# from files found in ./model relative to the current working directory (not necessarily this file)
rat = SpaceRAT(engine=create_engine("sqlite:///spacerat.db"))
question = rat.get_question("fair-market-assessed-value")
neighborhoods = rat.get_geog("neighborhood")
shadyside = neighborhoods.get_region("shadyside")
bloomfield = neighborhoods.get_region("bloomfield")
print(question.name)
print_records(rat.answer_question(question, bloomfield))
print_records(rat.answer_question(question, shadyside))
print_records(rat.answer_question(question, shadyside, variant="residential"))
# arbitrary region sets
region_set = RegionSet([shadyside, bloomfield])
print_records(rat.answer_question(question, region_set))
print_records(rat.answer_question(question, region_set, variant="residential"))