nastasiasnk commited on
Commit
fc47506
1 Parent(s): b3ce4c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -13
app.py CHANGED
@@ -7,15 +7,6 @@ from collections import OrderedDict
7
 
8
 
9
  from notion_client import Client as client_notion
10
-
11
- """
12
- # app.py
13
- import config # This imports your configuration settings and runs any setup code
14
-
15
- from RECODE_speckle_utils import speckle_utils # Importing from the modified sys.path
16
- """
17
-
18
-
19
  import os
20
 
21
  # Accessing the secret variable
@@ -29,14 +20,28 @@ else:
29
 
30
  from config import landuseDatabaseId , subdomainAttributesDatabaseId
31
  from imports_utils import fetch_all_database_pages
32
-
33
-
34
- #notion = client_notion(auth=userdata.get(notionToken))
35
  from imports_utils import notion
36
 
37
  landuse_attributes = fetch_all_database_pages(notion, landuseDatabaseId)
38
  livability_attributes = fetch_all_database_pages(notion, subdomainAttributesDatabaseId)
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
 
42
 
@@ -239,7 +244,8 @@ def test(input_json):
239
  output = {
240
  "subdomainsAccessibility_dictionary": subdomainsAccessibility_dictionary,
241
  "livability_dictionary": livability_dictionary,
242
- "subdomainsWeights_dictionary": LivabilitySubdomainsInputs_dictionary
 
243
  }
244
 
245
 
 
7
 
8
 
9
  from notion_client import Client as client_notion
 
 
 
 
 
 
 
 
 
10
  import os
11
 
12
  # Accessing the secret variable
 
20
 
21
  from config import landuseDatabaseId , subdomainAttributesDatabaseId
22
  from imports_utils import fetch_all_database_pages
23
+ from imports_utils import get_property_value
 
 
24
  from imports_utils import notion
25
 
26
  landuse_attributes = fetch_all_database_pages(notion, landuseDatabaseId)
27
  livability_attributes = fetch_all_database_pages(notion, subdomainAttributesDatabaseId)
28
 
29
+ # fetch the dcitionary 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
+
45
 
46
 
47
 
 
244
  output = {
245
  "subdomainsAccessibility_dictionary": subdomainsAccessibility_dictionary,
246
  "livability_dictionary": livability_dictionary,
247
+ "subdomainsWeights_dictionary": LivabilitySubdomainsInputs_dictionary,
248
+ "luDomainMapper" = lu_domain_mapper
249
  }
250
 
251