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

Facilitate reuse of SuSo questionnaire metadata by consumer commands #14

Open
arthur-shaw opened this issue Jan 4, 2024 · 3 comments
Open

Comments

@arthur-shaw
Copy link
Contributor

arthur-shaw commented Jan 4, 2024

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:

  • Returning a global macro containing the path to the SuSo questionnaire metadata (and that getter commands will use, by default, as the path to the metadata)
  • Or creating a data frame containing the SuSo questionnaire metadata

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 arthur-shaw changed the title Set path or load frame of SuSo metadata as a global Facilitate reuse of SuSo questionnaire metadata by consumer commands Jan 4, 2024
@arthur-shaw
Copy link
Contributor Author

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

@kbjarkefur
Copy link
Collaborator

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
Copy link
Contributor Author

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.

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

2 participants