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

Should dataobjects be read in using different functions? #90

Open
mariev opened this issue Apr 28, 2021 · 0 comments
Open

Should dataobjects be read in using different functions? #90

mariev opened this issue Apr 28, 2021 · 0 comments

Comments

@mariev
Copy link
Contributor

mariev commented Apr 28, 2021

In the scenario where multiple scripts are listed in datapackage.yml there are two options for accessing objects created via scripts earlier in the list:

  1. datapackager_object_read, which is for accessing objects that were run in the same build i.e. both Rmd files are toggled as enabled: yes
  2. project_data_path, which allows loading an .rda file created in a previous iteration of package_build()

This creates a relationship between the two scripts that requires manual updates when rebuilding package. Assuming the case of two processing scripts, preprocess_A and preprocess_B which generate A.rda and B.rda, respectively. preprocess_B uses the output from preprocess_A,

In the following build scenario, we would use datapackager_object_read:

# Case 1
files:
  preprocess_A.Rmd:
    enabled: yes
  preprocess_B.Rmd:
    enabled: yes

In a subsequent build that is of type 2, we have to update preprocess_B to use project_data_path:

# Case 2
files:
  preprocess_A.Rmd:
    enabled: no
  preprocess_B.Rmd:
    enabled: yes

There is a certain logic to this update, because it is a change of state in preprocess_B, to no longer be coupled with preprocess_A.

However, if preprocess_A needs to be rerun for some reason, we have to take the following action:

  • update datapackager.yml to enable both files
  • switch preprocess_B.Rmd to use datapackager_object_read again (not especially intuitive)

Wondering if its possible that data objects are always read from the /data/ location, but after any previous scripts have written to that folder? This would enforce that the latest data is always used, while maximizing code portability.

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