Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
angiehjort opened this issue Jun 15, 2022 · 1 comment

Comments

@angiehjort
Copy link
Member

angiehjort commented Jun 15, 2022

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?

dab2000 added a commit to vizabi/core that referenced this issue Jun 20, 2022
@angiehjort
Copy link
Member Author

change of specs for more uniform results:
.drilldown({dim: "geo", entity: "usa"}) // =>{country: ["usa"]}

(entity is a drilldown of itself if it is on the bottom level)

vizabi/core@7e8ee65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant