Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
79b6783
1
Parent(s):
4c13533
Update app.py
Browse files
app.py
CHANGED
@@ -26,21 +26,45 @@ from imports_utils import notion
|
|
26 |
landuse_attributes = fetch_all_database_pages(notion, landuseDatabaseId)
|
27 |
livability_attributes = fetch_all_database_pages(notion, subdomainAttributesDatabaseId)
|
28 |
|
29 |
-
# fetch the
|
30 |
lu_domain_mapper ={}
|
31 |
subdomains_unique = []
|
32 |
|
33 |
for page in landuse_attributes:
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
#subdomains_unique = list(set(subdomains_unique))
|
42 |
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
|
46 |
|
@@ -245,7 +269,8 @@ def test(input_json):
|
|
245 |
"subdomainsAccessibility_dictionary": subdomainsAccessibility_dictionary,
|
246 |
"livability_dictionary": livability_dictionary,
|
247 |
"subdomainsWeights_dictionary": LivabilitySubdomainsInputs_dictionary,
|
248 |
-
"luDomainMapper": lu_domain_mapper
|
|
|
249 |
}
|
250 |
|
251 |
|
|
|
26 |
landuse_attributes = fetch_all_database_pages(notion, landuseDatabaseId)
|
27 |
livability_attributes = fetch_all_database_pages(notion, subdomainAttributesDatabaseId)
|
28 |
|
29 |
+
# fetch the dictionary with landuse - domain pairs
|
30 |
lu_domain_mapper ={}
|
31 |
subdomains_unique = []
|
32 |
|
33 |
for page in landuse_attributes:
|
34 |
+
value_landuse = get_property_value(page, "LANDUSE")
|
35 |
+
value_subdomain = get_property_value(page, "SUBDOMAIN_LIVEABILITY")
|
36 |
+
if value_subdomain and value_landuse:
|
37 |
+
lu_domain_mapper[value_landuse] = value_subdomain
|
38 |
+
if value_subdomain != "":
|
39 |
+
subdomains_unique.append(value_subdomain)
|
40 |
|
41 |
#subdomains_unique = list(set(subdomains_unique))
|
42 |
|
43 |
|
44 |
+
# fetch the dictionary with subdomain attribute data
|
45 |
+
|
46 |
+
attribute_mapper ={}
|
47 |
+
domains_unique = []
|
48 |
+
|
49 |
+
for page in livability_attributes:
|
50 |
+
subdomain = get_property_value(page, "SUBDOMAIN_UNIQUE")
|
51 |
+
sqm_per_employee = get_property_value(page, "SQM PER EMPL")
|
52 |
+
thresholds = get_property_value(page, "MANHATTAN THRESHOLD")
|
53 |
+
max_points = get_property_value(page, "LIVABILITY MAX POINT")
|
54 |
+
domain = get_property_value(page, "DOMAIN")
|
55 |
+
if thresholds:
|
56 |
+
attribute_mapper[subdomain] = {
|
57 |
+
'sqmPerEmpl': [sqm_per_employee if sqm_per_employee != "" else 0],
|
58 |
+
'thresholds': thresholds,
|
59 |
+
'max_points': max_points,
|
60 |
+
'domain': [domain if domain != "" else 0]
|
61 |
+
}
|
62 |
+
if domain != "":
|
63 |
+
domains_unique.append(domain)
|
64 |
+
|
65 |
+
#domains_unique = list(set(domains_unique))
|
66 |
+
|
67 |
+
|
68 |
|
69 |
|
70 |
|
|
|
269 |
"subdomainsAccessibility_dictionary": subdomainsAccessibility_dictionary,
|
270 |
"livability_dictionary": livability_dictionary,
|
271 |
"subdomainsWeights_dictionary": LivabilitySubdomainsInputs_dictionary,
|
272 |
+
"luDomainMapper": lu_domain_mapper,
|
273 |
+
"attributeMapper": attribute_mapper
|
274 |
}
|
275 |
|
276 |
|