sailuh / kaiaulu

An R package for mining software repositories
http://itm0.shidler.hawaii.edu/kaiaulu
Mozilla Public License 2.0
20 stars 13 forks source link

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

Open crepesAlot opened 1 month ago

crepesAlot commented 1 month ago

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


crepesAlot commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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.

crepesAlot commented 5 days ago

@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 commented 2 days ago

Thank you for the update!