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

Feature Request: code generation feature #107

Open
rammprasad opened this issue Nov 20, 2024 · 3 comments · May be fixed by #108
Open

Feature Request: code generation feature #107

rammprasad opened this issue Nov 20, 2024 · 3 comments · May be fixed by #108
Assignees
Labels
enhancement New feature or request

Comments

@rammprasad
Copy link
Collaborator

rammprasad commented Nov 20, 2024

Feature Idea

The specification format for OAK is almost ready. Can we try the code generation feature?

The feature will accept the spec in a csv format and domain name as parameters and it will generate the R code required. We may have to make some changes to the spec as we develop this feature. It may be beneficial to add the associated topic variable for each qualifier. We can brainstorm these requirements.

Also, we can think about a JSON format as input for the specification.

Relevant Input

CM domain:
Spec - https://github.com/pharmaverse/rinpharma-2024-SDTM-workshop/blob/main/specs/cm_cdash/cm_sdtm_oak_spec_cdash.csv

VS DOmain -
Spec - https://github.com/pharmaverse/rinpharma-2024-SDTM-workshop/blob/main/specs/vs/vs_sdtm_oak_spec.csv

Relevant Output

CM domain Program - https://github.com/pharmaverse/rinpharma-2024-SDTM-workshop/blob/main/exercises/create_cm_cdash.R

VS Domain Program - Program - https://github.com/pharmaverse/rinpharma-2024-SDTM-workshop/blob/main/exercises/create_vs.R

Reproducible Example/Pseudo Code

sdtm.oak::generate_code(spec = "cm_cdash/cm_sdtm_oak_spec_cdash.csv" domain = 'cm')

@rammprasad rammprasad added the enhancement New feature or request label Nov 20, 2024
@github-project-automation github-project-automation bot moved this to Product Backlog in sdtm.oak R package Nov 20, 2024
@edgar-manukyan edgar-manukyan self-assigned this Nov 20, 2024
@edgar-manukyan
Copy link
Collaborator

Thanks Ram, I will give it a try.

edgar-manukyan added a commit that referenced this issue Nov 25, 2024
edgar-manukyan added a commit that referenced this issue Nov 27, 2024
edgar-manukyan added a commit that referenced this issue Nov 28, 2024
edgar-manukyan added a commit that referenced this issue Dec 1, 2024
edgar-manukyan added a commit that referenced this issue Dec 1, 2024
edgar-manukyan added a commit that referenced this issue Dec 1, 2024
edgar-manukyan added a commit that referenced this issue Dec 2, 2024
edgar-manukyan added a commit that referenced this issue Dec 2, 2024
edgar-manukyan added a commit that referenced this issue Dec 2, 2024
@edgar-manukyan edgar-manukyan linked a pull request Dec 2, 2024 that will close this issue
14 tasks
edgar-manukyan added a commit that referenced this issue Dec 2, 2024
edgar-manukyan added a commit that referenced this issue Dec 2, 2024
edgar-manukyan added a commit that referenced this issue Dec 2, 2024
@edgar-manukyan
Copy link
Collaborator

edgar-manukyan commented Dec 2, 2024

The POC for one topic CM code generation (full domain 💯 ) is ready for discussion at #108
Please consider slightly modified specs:
cm_sdtm_oak_spec_cdash.csv

The code to run:

  • download the specs into project dir
  • run the following:
spec <- read_spec("cm_sdtm_oak_spec_cdash.csv")

spec <- spec |>
  dplyr::filter(
    !is.na(target_sdtm_variable),
    !is.na(mapping_algorithm),
    !target_sdtm_variable %in% c("DOMAIN")
  )

domain <- "cm"
generate_code(spec, domain)
  • If you want a nicer code, though a bit longer then change width:
# One can use option width to control the width of the code
# Twenty will almost always place every parameter on a separate line
old_width <- options(width = 20)
generate_code(spec, domain)
# Restore original width
options(width = old_width$width)

Generated code

Generated cm

edgar-manukyan added a commit that referenced this issue Dec 2, 2024
edgar-manukyan added a commit that referenced this issue Dec 4, 2024
edgar-manukyan added a commit that referenced this issue Dec 7, 2024
edgar-manukyan added a commit that referenced this issue Dec 8, 2024
edgar-manukyan added a commit that referenced this issue Dec 8, 2024
edgar-manukyan added a commit that referenced this issue Dec 8, 2024
edgar-manukyan added a commit that referenced this issue Dec 8, 2024
edgar-manukyan added a commit that referenced this issue Dec 9, 2024
edgar-manukyan added a commit that referenced this issue Dec 9, 2024
edgar-manukyan added a commit that referenced this issue Dec 9, 2024
edgar-manukyan added a commit that referenced this issue Dec 11, 2024
edgar-manukyan added a commit that referenced this issue Dec 11, 2024
edgar-manukyan added a commit that referenced this issue Dec 11, 2024
edgar-manukyan added a commit that referenced this issue Dec 11, 2024
edgar-manukyan added a commit that referenced this issue Dec 11, 2024
edgar-manukyan added a commit that referenced this issue Dec 11, 2024
@edgar-manukyan
Copy link
Collaborator

edgar-manukyan commented Dec 11, 2024

Multi-topic VS poc

Spec

Generated code

Resultant vs

Also, please consider the updated cm spec

edgar-manukyan added a commit that referenced this issue Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Product Backlog
Development

Successfully merging a pull request may close this issue.

2 participants