lsms-worldbank / labeller

Spot and fix common problems with variable and value labels🏷
https://lsms-worldbank.github.io/labeller/
0 stars 0 forks source link

Facilitate reuse of SuSo questionnaire metadata by consumer commands #14

Open arthur-shaw opened 11 months ago

arthur-shaw commented 11 months ago

Problem

For every command that fetches components of SuSo questionnaire metadata, the user needs to point to the metadata file either as a path (globally) or as a data frame. The alternative is for users to specify this path or provide the frame for each getter command. While doable, this is inconvenient.

Solution

Create a "dirty" function that changes the state of the Stata session in order to make the process of using getter commands simpler--specifically, either:

In either case, getter commands, which consume SuSo metadata, will take the output of this setting command as its default value. In this way, the data setter command "silently" creates an input that getter commands "silently" consume. Of course, the user could specify the path/frame in getter commands. But, imporantly, they don't have to.

arthur-shaw commented 11 months ago

@kbjarkefur , would this be possible? Do you see this design being problematic?

kbjarkefur commented 11 months ago

I am not sure I follow.

First, this seems to be a selector and not a labeller issue, right? If it is for labeller I am not sure I follow.

Assuming it is for selector. Should any command other than sel_add_metadata fetch the meta data from file? My intention was always that that command fetches the meta data and stores it in chars in the data set. Then all other commands in this package reads the data from chars and not from the file.

Let me know if there is something I do not understand.

arthur-shaw commented 11 months ago

This is an issue for labeller but is also relevant for selector.

For labeller, the use case is #4 -- for example, extracting the question_text for a particular variable.

For selector, the main use case is to set a path to the metadata in sel_add_metadata--in effect, avoid having to specify using in the command call.

If the path to the metadata is set as global and if labeller/selector functions look for that global path, then users can set the path once in a stand-alone command and relevant labeller/selector commands can consume that path without it being specified (if that's possible in Stata).

Let's discuss more.