Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To learn how to define a data hierarchy go to Creating a data hierarchy Data Collection Hierarchies

In this example we need the following hierarchy:

...

Aggregation config

Example aggregation (as found on S4DA CapDev measures) config for data collection named “consultants“. We want all consultants in a Province or district on a topo map:

...

Group Stage

Code Block
languagejson
{
  

...

"$group": {
    

...

"_id": 

...

"###hierarchy###

...

",
    

...

"count": {
      

...

"$sum": 1
    

...

},
    

...

"capdev": {
      

...

"$first": 

...

"$$ROOT"
    }

...


  

...

}

...

},

Project Stage

Code Block
languagejson
{
  

...

"$project": {
    

...

"_id": 0,
    "name": "$_id.answers.name",
    "value": 

...

"$capdev.###hierarchyProjectionPath.iso###

...

",
    

...

"result": 

...

"$count

...

"
  

...

}

...


}

Explanations

Parameters:

  • code: hierarchy”:

  • code: hierarchySelector“:

...