nastasiasnk commited on
Commit
68472bb
1 Parent(s): 0fdf9da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -10
app.py CHANGED
@@ -171,7 +171,7 @@ def test(input_json):
171
  # Apply the filtered mask
172
  df_landuses_filtered = df_landuses.loc[valid_indexes]
173
 
174
-
175
  # find a set of unique domains, to which subdomains are aggregated
176
  temp = []
177
  for key, values in livabilityMapperDict.items():
@@ -188,16 +188,20 @@ def test(input_json):
188
 
189
  domainsUnique = list(set(temp))
190
 
191
-
192
  # find a list of unique subdomains, to which land uses are aggregated
193
  temp = []
194
  for key, values in landuseMapperDict.items():
195
- subdomain = str(landuseMapperDict[key])
196
  if subdomain != 0:
197
  temp.append(subdomain)
198
 
199
  subdomainsUnique = list(set(temp))
 
 
200
 
 
 
201
 
202
  from imports_utils import landusesToSubdomains
203
  from imports_utils import FindWorkplacesNumber
@@ -216,7 +220,7 @@ def test(input_json):
216
 
217
  # prepare an input weights dataframe for the parameter LivabilitySubdomainsInputs
218
  LivabilitySubdomainsInputs =pd.concat([LivabilitySubdomainsWeights, WorkplacesNumber], axis=1)
219
- """
220
  subdomainsAccessibility = computeAccessibility(df_dm,LivabilitySubdomainsInputs,alpha,threshold)
221
  artAccessibility = computeAccessibility_pointOfInterest(df_art_matrix,'ART',alpha,threshold)
222
  gmtAccessibility = computeAccessibility_pointOfInterest(df_gmt_matrix,'GMT+HSR',alpha,threshold)
@@ -236,17 +240,17 @@ def test(input_json):
236
  artmatrix = df_art_matrix.to_dict('index')
237
 
238
  LivabilitySubdomainsWeights_dictionary = LivabilitySubdomainsWeights.to_dict('index')
239
- """
240
 
241
  # Prepare the output
242
  output = {
243
- # "subdomainsAccessibility_dictionary": subdomainsAccessibility_dictionary,
244
- # "livability_dictionary": livability_dictionary,
245
  "subdomainsWeights_dictionary": LivabilitySubdomainsInputs_dictionary,
246
  "luDomainMapper": landuseMapperDict,
247
- "attributeMapper": livabilityMapperDict
248
- # "fetchDm": dm_dictionary,
249
- # "landuses":df_lu_filtered_dict
250
  }
251
 
252
 
 
171
  # Apply the filtered mask
172
  df_landuses_filtered = df_landuses.loc[valid_indexes]
173
 
174
+ """
175
  # find a set of unique domains, to which subdomains are aggregated
176
  temp = []
177
  for key, values in livabilityMapperDict.items():
 
188
 
189
  domainsUnique = list(set(temp))
190
 
191
+
192
  # find a list of unique subdomains, to which land uses are aggregated
193
  temp = []
194
  for key, values in landuseMapperDict.items():
195
+ subdomain = str(landuseMapperDict[key]["subdomain livability"])
196
  if subdomain != 0:
197
  temp.append(subdomain)
198
 
199
  subdomainsUnique = list(set(temp))
200
+
201
+ """
202
 
203
+ domainsUnique = findUniqueDomains(livabilityMapperDict)
204
+ subdomainsUnique = findUniqueSubdomains(landuseMapperDict)
205
 
206
  from imports_utils import landusesToSubdomains
207
  from imports_utils import FindWorkplacesNumber
 
220
 
221
  # prepare an input weights dataframe for the parameter LivabilitySubdomainsInputs
222
  LivabilitySubdomainsInputs =pd.concat([LivabilitySubdomainsWeights, WorkplacesNumber], axis=1)
223
+
224
  subdomainsAccessibility = computeAccessibility(df_dm,LivabilitySubdomainsInputs,alpha,threshold)
225
  artAccessibility = computeAccessibility_pointOfInterest(df_art_matrix,'ART',alpha,threshold)
226
  gmtAccessibility = computeAccessibility_pointOfInterest(df_gmt_matrix,'GMT+HSR',alpha,threshold)
 
240
  artmatrix = df_art_matrix.to_dict('index')
241
 
242
  LivabilitySubdomainsWeights_dictionary = LivabilitySubdomainsWeights.to_dict('index')
243
+
244
 
245
  # Prepare the output
246
  output = {
247
+ "subdomainsAccessibility_dictionary": subdomainsAccessibility_dictionary,
248
+ "livability_dictionary": livability_dictionary,
249
  "subdomainsWeights_dictionary": LivabilitySubdomainsInputs_dictionary,
250
  "luDomainMapper": landuseMapperDict,
251
+ "attributeMapper": livabilityMapperDict,
252
+ "fetchDm": dm_dictionary,
253
+ "landuses":df_lu_filtered_dict
254
  }
255
 
256