Skip to content

Core: new feature. Add datasource.drilldown() and datasource.drillup() methods #252

@angiehjort

Description

@angiehjort

suggested but possibly not optimal API, feel free to improve

marker.data.source.drilldown({dim: "geo", entity: "asia"}) // =>{country: ["chn", "ind", "idn" ..... ]}
marker.data.source.drilldown({dim: "geo", entity: "usa"}) // => null
marker.data.source.drilldown({dim: "geo", entity: ["landlocked"]}) // => {country: ["afg", "rwa",  .... ]}
marker.data.source.drilldown({dim: "geo", entity: ["usa", "landlocked"]}) // => {country: ["afg", "rwa",  .... ]} (same)
marker.data.source.drilldown({dim: "geo", entity: ["asia", "landlocked"]}) // => {country:  [chn", "ind", "afg", "rwa",  .... ] } 

// edge case which i'm unsure how it should be: if a complete entity set is requested it means all countries should be included

marker.data.source.drilldown({dim: "geo", entity: ["asia", "africa", "europe", "americas"]}) // => {country: "*"}

// it should be possible to get an empty array too, but i don't think we have an example in our datasets
marker.data.source.drillup({dim: "geo", entity: "usa"}) // => {world_4region: americas, landlocked: coastline, religion: christian ...}

suggested but possibly not optimal solution, feel free to improve

  1. this is not always an essential operation, so don't do it if no component requests is

  2. search entity domains and sets concepts for concept property drill_up. for example: in open-numbers -compatible datasets we have country.drill_up = "[""world_6region"", ""income_groups"", ""landlocked"", ""g77_and_oecd_countries"", ""main_religion_2008"", ""world_4region"", ""unicef_region"", ""un_sdg_ldc"", ""un_sdg_region""]"

  3. build drillup and drilldown maps for each dim in parent.space which is an entity domain or set, in our case it will be just "geo" or "country". inside each dim a map for each entity, inside each entity a set of drilldowns

  4. request and cache entity data that would allow filling the drillup and drilldown maps

  5. Use JS maps to avoid searching in loops, probably use JS set to avoid duplicates in the output like in drilldowns for ["asia", "landlocked"]

  6. ASYNC: the result depends on concept readiness and possibly also on conceptCatalog to assess if a random set of entities is a complete entity set. then it needs to do its own entity request probably, so it is also async. is it possible to connect it somehow with the existing entity request? should it wrap the result in a promise? or should it have an own readiness observable flag?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions