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

Creating a File Directory with Functions in /config.R #321

Open
2 tasks done
crepesAlot opened this issue Oct 17, 2024 · 6 comments · May be fixed by #333
Open
2 tasks done

Creating a File Directory with Functions in /config.R #321

crepesAlot opened this issue Oct 17, 2024 · 6 comments · May be fixed by #333
Assignees

Comments

@crepesAlot
Copy link
Collaborator

crepesAlot commented Oct 17, 2024

Purpose


In issue #230, the folder organization was reorganized to follow this diagram.
As /config.R is intended to be a central focal point for managing and using the notebooks and configuration files.
Therefore a feature that would greatly assist users would be functions within /config.R that create the recommended folder directory.

Process


Create a single function within /config.R that builds the recommended folder organization.
Since not all notebooks require every section of the recommended folder directory, the function will need to read through the config passed as a parameter, so that it only creates the required folders for the sections that are used.

Function Signature:

Description: The function takes conf, a parsed configuration file obtained from the parse_config function.

verbose is a boolean (set TRUE by default) that prints operational messages when TRUE.
When the function is called, it takes the parsed configuration file and creates all the required filepaths used within the config file.
The function calls a helper function create_file_path that checks if the directory already exists, or creates it if the directory does not exist.
create_file_directory(conf, verbose= TRUE)

Task List


  • Have the function get the needed sections of the config files
  • Create the folder directory for each of the sections (if needed)
@crepesAlot crepesAlot self-assigned this Oct 17, 2024
@crepesAlot crepesAlot assigned crepesAlot and unassigned crepesAlot Oct 25, 2024
@crepesAlot
Copy link
Collaborator Author

Considering that there can be multiple project keys for both mailing_list and issue_tracker, I plan to have the functions require the user to specify 2 parameters, the config_file and project_key_index.
For example, when creating a file path:

../../rawdata/project_of_interest/github/issues/owner_repo/

The parameters would be config_file = project_of_interest.yml, project_key_index = 1.

@carlosparadis
Copy link
Member

I think what you want here is a function that reads the config file structure, making some assumptions of it, and create the entire folder structure and sub-folders, rather than a function to create one folder.

@crepesAlot
Copy link
Collaborator Author

Sorry, I meant to say that I would have 1 function that creates the entire issue_tracker directory, where it would perform the steps in the prior comment for each of the subfolders for github and something similar for bugzilla and jira.
Haven't completely thought out the function to create the mailing_list directory, but may do some kind of loop to get each project_key_index to ensure it gets all the mailing lists for pipermail and mod_mbox.

@carlosparadis
Copy link
Member

What I am saying is that this issue should have a single function that the user calls. User should not be calling multiple functions to create folders. The only input to said function is the path to the config file. It has to scan the config file to decide what additional functions to call (e.g. the issue tracker, the mailing list, etc). If the user has to "program folder creation" it will be faster for them to manually create it themselves.

I suggest you update the issue specification accordingly with the function signatures, and some notion of what function calls what for discussion.

@carlosparadis carlosparadis added this to the ics496-fall24-m2 milestone Nov 11, 2024
crepesAlot added a commit that referenced this issue Nov 21, 2024
- Added `create_file_directory` function
- Added `create_file_path` helper function
crepesAlot added a commit that referenced this issue Nov 21, 2024
- Added @export to functions
- Added some more detail to function description
- Added discussion filepath under github issue tracker
@crepesAlot
Copy link
Collaborator Author

crepesAlot commented Nov 21, 2024

@carlosparadis I was able to create the function and have @beydlern test it on his end as well. The directories seem to be created without any problems.
The output looks something like:

> create_file_directory(conf)
Created filepath: ../../rawdata/kaiaulu/git_repo/kaiaulu/.git
No mailing_list found
Created filepath: ../../rawdata/kaiaulu/jira/sailuh/issues/
Created filepath: ../../rawdata/kaiaulu/jira/sailuh/issue_comments/
Created filepath: ../../rawdata/kaiaulu/github/sailuh_kaiaulu/issue_or_pr_comment/
Created filepath: ../../rawdata/kaiaulu/github/sailuh_kaiaulu/issue/
Created filepath: ../../rawdata/kaiaulu/github/sailuh_kaiaulu/issue_search/
Filepath: ../../rawdata/kaiaulu/github/sailuh_kaiaulu/issue_event/ already exists.
Created filepath: ../../rawdata/kaiaulu/github/sailuh_kaiaulu/pull_request/
Filepath: ../../rawdata/kaiaulu/github/sailuh_kaiaulu/commit/ already exists.
Invalid filepath: 
No bugzilla found
dv8 is unused
srcml is unused
pattern4 is unused
Created filepath: ../../rawdata/kaiaulu/git_repo/understand/
Filepath: ../../analysis/kaiaulu/understand/ already exists.

The Invalid filepath: is there because I also added the filepath for discussions to accommodate the discussions endpoint (which isn't yet implemented on this particular branch).

@carlosparadis
Copy link
Member

Thank you for the update!

@crepesAlot crepesAlot linked a pull request Dec 9, 2024 that will close this issue
crepesAlot added a commit that referenced this issue Dec 11, 2024
- Change the method of obtaining filepaths from configuration files.
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

Successfully merging a pull request may close this issue.

3 participants