CartoDB / crankshaft

CARTO Spatial Analysis extension for PostgreSQL
BSD 3-Clause "New" or "Revised" License
54 stars 20 forks source link

Enable categorization in Moran & Markov analyses #168

Closed AbelVM closed 6 years ago

AbelVM commented 7 years ago

What:

Add a field to categorize the analysis, so the user can run it N times at once if there are N parameters under study at each point, and you want to analyze them independently.

Like the centroid one:

selection_001

Why:

Real life example: air quality monitoring stations. Each of them measures several parameters (let's call them categories) like NO, NO2, CO, CO2, PM25, PM10, etc. If you run Moran or Markov as is, it will mess with all the values and drive crazy because you have several values at the same point (and time). So you need to create N nodes first, filtering by category, and then apply Moran/Markov N times, once per node.

cc @stuartlynn @saleiva

andy-esch commented 7 years ago

Hey @AbelVM, that'd be awesome to have that ability! This seems more of a camshaft / UI thing than something that's in crankshaft, because the query that would need to be run could easily be generated in camshaft:

SELECT 
  p.*,
  m1.quads as quads_no2, 
  m1.significance as sig_no2, 
  m2.quads as quads_pm25, 
  m2.significance as sig_pm25, 
  ...
FROM 
  pollution_data As p
JOIN
  cdb_crankshaft.cdb_areasofinterestlocal('select * from pollution_data', 'no2') As m1
ON m1.rowid = p.cartodb_id
JOIN
  cdb_crankshaft.cdb_areasofinterestlocal('select * from pollution_data', 'pm25') As m2
ON m2.rowid = p.cartodb_id

I've seen discussion about having other analyses return multiple measures (like the data observatory). While that is different, it seems that we could offer a more generic framework for analyses working off of multiple columns instead of laboriously adding new nodes each time.

AbelVM commented 7 years ago

Feel free to move the conversation there! :grin:

cc @rochoa , just in case

andy-esch commented 6 years ago

Closing as it's a camshaft thing -> CartoDB/camshaft#252