Skip to content

Commit

Permalink
sdtm.oak SDTM spec, Algorithms Documentation and template r code for …
Browse files Browse the repository at this point in the history
…cm domain (#30)

* All about metadata Vignette

* CM domain pseudocode

* Update Description file

* Algorithms Article

* styler updates

* styler updates

* review comments & pipeline failures

* description file update

* pipeline failures

* address pipeline failure

* lint errors.

* Fix lintr link error

* Updates

* add cm test data

* Styler update

* lint issue

* #17 fix typo, add info, add cm SDTM example

* Automatic renv profile update.

* Automatic renv profile update.

---------

Co-authored-by: Adam Foryś <[email protected]>
Co-authored-by: edgar-manukyan <[email protected]>
Co-authored-by: edgar-manukyan <[email protected]>
  • Loading branch information
4 people authored Jan 31, 2024
1 parent eccb9eb commit e6e8d7d
Show file tree
Hide file tree
Showing 17 changed files with 955 additions and 150 deletions.
138 changes: 7 additions & 131 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,146 +1,22 @@
# Contribution to {sdtm.oak}

This outlines how to propose a change to the {sdtm.oak} package. For more detailed info
about contributing to {sdtm.oak}, and other [pharmaverse
packages](https://pharmaverse.org/), please see the [development process
guide](https://pharmaverse.github.io/sdtm.oak/CONTRIBUTING.html)
as well as other Developer Guides in the Articles section of the [{admiral}
website](https://pharmaverse.github.io/admiral/index.html)
This outlines how to propose a change to the sdtm.oak package. For more detailed info about contributing to {sdtm.oak}, and other [pharmaverse packages](https://pharmaverse.org/), please see the [Contribution Guide](https://pharmaverse.github.io/admiral/CONTRIBUTING.html) as well as other Developer Guides in the Articles section of the [{admiraldev} website](https://pharmaverse.github.io/admiraldev/).

Please note that we try to align to best practices used in other R packages' development processes - so veteran developers should be familiar with our processes. However, we do deviate slightly from some best practices and we advise all new contributors to review our package documentation accordingly.


# Basics
* For each new contribution, the user creates an issue on the issue tab on [GitHub](https://github.com/pharmaverse/oak/issues) to put it in our backlog.
* For each new contribution, the user creates an issue on the issue tab on [GitHub](https://github.com/pharmaverse/sdtm.oak/issues) to put it in our backlog.
The issues can range from bug identification and/or fixes, enhancements to
functions, documentation, tests or new features.

* We advise you to contact us when an
[issue](https://github.com/pharmaverse/oak/issues) is created via
[issue](https://github.com/pharmaverse/sdtm.oak/issues) is created via
[Slack](https://oakgarden.slack.com) (If you don't have access, use this
[link](https://join.slack.com/t/oakgarden/shared_invite/zt-204sf8w5c-Vxl71cI~WAYhsMLbHGxeMw)
to join). We can discuss details or align expectations if you are not familiar
with the `{sdtm.oak}` philosophy and programming strategy. The team will try to
review the issues within the next backlog meeting and give some initial
feedback. Since we are not a 100% fully resourced software development team it
might be that some issues will take longer to respond to depending on the amount
of overall issues.

* Familiarize yourself with our [programming strategy](https://pharmaverse.github.io/admiraldev/articles/programming_strategy.html), guidance for [GitHub usage](https://pharmaverse.github.io/admiraldev/articles/git_usage.html) and [unit testing](https://pharmaverse.github.io/admiraldev/articles/unit_test_guidance.html).

* All newly [created issues](https://github.com/pharmaverse/oak/issues) will be
reviewed within the next backlog meeting and the creator will receive an
initial feedback via a comment. Someone from the core development team will
then triage new issues by assigning the appropriate labels (such as “user
request” so we can easily identify new requests).

* Issues are meant to be taken on by users from the Pharma programming
community.

# Contribution Model


## Type 1 Contribution with Code:

* First, the user creates an issue or comments on an existing issue to notify
that they’d like to contribute code.
* Follow our development process step-by-step guide.
* We advise to contact an `{sdtm.oak}` core development team directly via [Slack](https://app.slack.com/client/T028PB489D3/C02M8KN8269) before submitting code for complex functionality.


## Type 2 Contribution without Code:

* User creates an issue and ideally contacts an `{sdtm.oak}` team member via [Slack](https://oakgarden.slack.com).
* The `{sdtm.oak}` core development team will contact the issue creator as soon
as possible to discuss further details.


See [Contribution to {admiral}](https://pharmaverse.github.io/admiral/articles/contribution_model.html) for additional details.

# Containers guideline

This guideline will walk you through the process of setting up and using the Oak image in both GitHub Codespaces and Visual Studio Code's devcontainer functionality.

## Use GitHub Codespaces

1. **Prerequisites** :

* Have a GitHub account.
* The repository you want to open in Codespaces must be under your account or you must have appropriate permissions.

2. **Open the Repository** :

* Navigate to the desired GitHub repository on GitHub's website.

3. **Start Codespaces** :

* Click on the "Code" button (it has a green color most of the times).
* In the dropdown, you'll find an option named "Open with Codespaces". Click on it.

4. **Choose or Create a Codespace** :

* If you've already created a Codespace for this repository, you'll see it listed. You can click on it to open.
* If not, click on the "+ New codespace" button.

5. **Configure the Environment (If needed)** :

* Depending on the repository, you might have a `.devcontainer` folder which will define the environment. GitHub Codespaces will use the settings defined here to set up the environment.
* If you need to customize or install additional tools, you can do so once the Codespace is launched.

6. **Use Codespaces** :

* Once your environment is set up, you'll have an instance of Visual Studio Code running in your browser, connected to the repository.
* You can now edit, run, and debug your code just like you would in a local environment.

7. **Close the Codespace** :

* When you're done, you can close the browser tab/window.
* Remember, you'll be billed (if you're on a paid plan) for the time your Codespace is running, so it's a good idea to stop or delete it if you're not using it. You can do this from the Codespaces tab in your GitHub repository.

## Use Visual Code devcontainer

1. **Prerequisites** :

* Have a Docker and VS Code installed
* linux/arm64 is supported only for R 4.3

2. **Install devcontainer extension** :

* In the left sidebar, click on the extensions icon (it looks like square blocks or a Lego piece).
* In the search bar, type "Dev Containers" to search for the extension.
* From the search results, locate the "Dev Containers" extension provided by Microsoft and click the 'Install' button.

3. **Open in Container** :

* In VS Code, use the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on macOS) and run the "Dev Containers: Rebuild and Reopen in Container" command. VS Code will then set up the devcontainer using the Oak image.

4. **Using the Devcontainer** :

* Once the environment is set up, you can start coding in VS Code as if you were in a local environment, but with the capabilities and tools provided by the Oak image.

## Use docker run

1. **Prerequisites** :

* Have a docker installed

2. **Example command** :

```
docker run --rm -d \
--name oak-dev \
-p 127.0.0.1:8888:8787 \
-e ROOT=true -e DISABLE_AUTH=true \
-v "$(pwd):/home/rstudio/oak" \
ghcr.io/pharmaverse/sdtm.oak-4.3:latest
```

This command is used to start a new container from a Docker image. Here's a breakdown of the parameters used:

* docker run: This is the basic command to start a new container from a Docker image.
* --rm: This option ensures that the container is removed automatically when it's stopped. This is useful if you don’t want to keep the container around once you're done with it, helping to save storage space.
* -d: This option runs the container in detached mode, which means the container runs in the background and doesn't attach to your command line session.
* --name oak-dev: This assigns the name oak-dev to the container. Naming your containers makes them easier to identify and manage.
* -p 127.0.0.1:8888:8787: This maps port 8787 inside the container to port 8888 on the host machine, and binds it to the localhost IP (127.0.0.1). The format is -p <host_ip>:<host_port>:<container_port>. This means any traffic directed at port 8888 on your host machine will be forwarded to port 8787 in the container.
* -e ROOT=true -e DISABLE_AUTH=true: These are environment variables being passed into the container. -e denotes that an environment variable is being set. In this case, two environment variables are being set:
* ROOT=true: This likely grants root permissions inside the container.
* DISABLE_AUTH=true: This likely disables authentication when opening RStudio.
* -v "$(pwd):/home/rstudio/oak": This maps a volume (essentially a directory) from the host machine into the container. The $(pwd) is a command that returns the current directory you're in on the host machine. This current directory is then mapped to /home/rstudio/oak inside the container. This is useful for sharing files between your host machine and the container.
* ghcr.io/pharmaverse/sdtm.oak-4.3:latest: This is the name of the Docker image that the container will be created from. It's pulled from the GitHub Container Registry (ghcr.io) and the image belongs to the pharmaverse repository. The image name is sdtm.oak-4.3 and the tag being used is latest. There are image for three versions available.
of overall issues.
22 changes: 14 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ Type: Package
Title: SDTM Data Transformation Engine
Version: 0.0.0.9001
Authors@R: c(
person("Omar", "Garcia", email = "[email protected]", role = c("aut", "cre")),
person("Rammprasad", "Ganapathy", role = "aut"),
person("Rammprasad", "Ganapathy", role = c("aut", "cre"),
email = "[email protected]"),
person("Adam", "Forys", role = "aut"),
person("Edgar", "Manukyan", role = "aut"),
person("Rosemary", "Li", role = "aut"),
person("Preetesh", "Parikh", role = "aut"),
person("Lisa", "Houterloot", role = "aut"),
person("Yogesh", "Gupta", role = "aut"),
person("Omar", "Garcia", email = "[email protected]", role = "aut"),
person("Ramiro", "Magno", email = "[email protected]",
role = "aut", comment = c(ORCID = "0000-0001-5226-3441")),
person("Pattern Institute", role = c("cph", "fnd")),
person("F. Hoffmann-La Roche AG", role = c("cph", "fnd")),
person("Pfizer Inc", role = c("cph", "fnd"))
)
Description: An EDC and Data Standard agnostic SDTM data transformation engine
that automates the transformation of raw clinical data in ODM format to SDTM
based on standard mapping algorithms.
Maintainer: Rammprasad Ganapathy <[email protected]>
Description: An EDC and Data Standard-agnostic SDTM data transformation engine designed for SDTM programming in R. Powered by metadata sdtm.oak can automate the conversion of raw clinical data to SDTM through standardized mapping algorithms. SDTM is one of the required standards for data submission to FDA (U.S.) and PMDA (Japan). SDTM standards are implemented in accordance with the SDTM Implemetation guide as defined by CDISC <https://www.cdisc.org/standards/foundational/sdtmig>
Language: en-US
License: Apache License (>= 2)
BugReports: https://github.com/pharmaverse/sdtm.oak/issues
Expand All @@ -26,9 +32,9 @@ Depends: R (>= 4.2)
Imports:
admiraldev,
dplyr (>= 1.0.0),
purrr (>= 1.0.0),
rlang (>= 1.0.0),
stringr,
purrr (>= 0.3.3),
rlang (>= 0.4.4),
stringr (>= 1.4.0),
tibble
Suggests:
knitr,
Expand Down
6 changes: 5 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
url: ~
url: https://pharmaverse.github.io/sdtm.oak

template:
bootstrap: 5
bootswatch: flatly

navbar:
title: "sdtm.oak"
15 changes: 15 additions & 0 deletions inst/cm_domain/cm_raw_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PATNUM,SUBJSTAT,SITENM,INSTANCE,INSTRN,FOLDER,FOLDERL,FOLDERSQ,FORM,FORML,DATAPGID,PGREPNUM,RECORDDT,RECORDID,RECPOS,RECSTAT,MDNUM,MDNUM_RAW,MDREC,MDRAW,MDIND,MDBDR,MDBDTU,MDBTM,MDBTMU,MDPRIOR,MDEDR,MDEDT,MDETM,MDETMU,MDONG,DOS,DOSU,DOSUV,MDFORM,MDRTE,MDFRQ,MDPROPH,TERMID,SRCLN,RAVRFID,CMMODIFY,CMDRG,CMDRGCD,CMDECOD,CMPNCD,SPLIT,OMIT,ACTTYP,ACTTEXT,CMDICT,CMCLAS,CMCLASCD,CMATC4,CMATC4CD,CMATC3,CMATC3CD,CMATC2,CMATC2CD,CMATC1,CMATC1CD,CLASSNUM
375,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,56379253,0,,111885785,1,N,1,1,No,BABY ASPIRIN,,,1,,1,1,,,,0,1,10,mg,MG,Tablet,PO (Oral),QD (Every Day),0,109576058,20,5652739,BABY ASPIRIN,BABY ASPIRIN,2701701,ACETYLSALICYLIC ACID,2701001,,,,,"WHODRUG GLOBAL B3 MARCH 1, 2021",OTHER AGENTS FOR LOCAL ORAL TREATMENT,A01AD,OTHER AGENTS FOR LOCAL ORAL TREATMENT,A01AD,STOMATOLOGICAL PREPARATIONS,A01A,STOMATOLOGICAL PREPARATIONS,A01,ALIMENTARY TRACT AND METABOLISM,A,1
375,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,56379253,0,,111969387,2,N,2,2,No,CORTISPORIN,NAUSEA,15-Sep-20,0,,1,0,,,,0,1,50,g,G,Pill,PO (Oral),,0,105820348,28,5533807,CORTISPORIN (UNITED STATES),CORTICOSTEROIDS AND ANTIINFECTIVES IN COMBINATION,90104001001,CORTICOSTEROIDS AND ANTIINFECTIVES IN COMBINATION,90104001001,,,COUNTRY,APPLY SITE COUNTRY TO TERM,"WHODRUG GLOBAL B3 MARCH 1, 2021",CORTICOSTEROIDS AND ANTIINFECTIVES IN COMBINATION,S03CA,CORTICOSTEROIDS AND ANTIINFECTIVES IN COMBINATION,S03CA,CORTICOSTEROIDS AND ANTIINFECTIVES IN COMBINATION,S03C,OPHTHALMOLOGICAL AND OTOLOGICAL PREPARATIONS,S03,SENSORY ORGANS,S,1
376,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,56407664,0,,111939965,1,N,1,1,No,ASPIRIN,ANEMIA,17-Feb-21,0,8:00,0,0,17-Feb-21,2/17/21,,0,0,,,,,,,0,80619660,8,4297014,ASPIRIN,ASPIRIN [ACETYLSALICYLIC ACID],2701004,ACETYLSALICYLIC ACID,2701001,,,,,"WHODRUG GLOBAL B3 MARCH 1, 2021",OTHER AGENTS FOR LOCAL ORAL TREATMENT,A01AD,OTHER AGENTS FOR LOCAL ORAL TREATMENT,A01AD,STOMATOLOGICAL PREPARATIONS,A01A,STOMATOLOGICAL PREPARATIONS,A01,ALIMENTARY TRACT AND METABOLISM,A,1
377,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,56408736,0,,111942855,1,N,1,1,No,DIPHENHYDRAMINE HCL,NAUSEA,4-Oct-20,0,9:00,0,0,,,,0,1,50,mg,MG,Capsule,PO (Oral),BID (Twice a Day),0,79751919,3,4240092,DIPHENHYDRAMINE HCL,DIPHENHYDRAMINE HCL,402246,DIPHENHYDRAMINE HYDROCHLORIDE,402001,,,,,"WHODRUG GLOBAL B3 MARCH 1, 2021",AMINOALKYL ETHERS,R06AA,AMINOALKYL ETHERS,R06AA,ANTIHISTAMINES FOR SYSTEMIC USE,R06A,ANTIHISTAMINES FOR SYSTEMIC USE,R06,RESPIRATORY SYSTEM,R,1
377,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,56408736,0,,129972536,2,N,2,2,No,PARCETEMOL,PYREXIA,20-Jan-20,0,10:00,0,0,20-Jan-20,1/20/20,10:00,0,0,,mg,MG,Capsule,PO (Oral),BID (Twice a Day),1,129972536,2,,,,,,,,,,,,,,,,,,,,,,
377,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,56408736,0,,129972541,3,N,3,3,No,VOMIKIND,VOMITINGS,UN UNK 2019,1,,1,0,UN UNK 2019,6/15/19,,1,0,,Tablet,TABLET,,PO (Oral),PRN (As Needed),1,129972541,3,,,,,,,,,,,,,,,,,,,,,,
377,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,56408736,0,,129972568,4,N,5,5,No,ZENFLOX OZ,DIARHHEA,20 UNK 2019,0,10:00,0,0,20 UNK 2019,6/15/19,,1,0,,mL,ML,Injection,IM (Intramuscular),PRN (As Needed),1,129972568,4,,,,,,,,,,,,,,,,,,,,,,
378,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,63059916,0,,126472439,4,N,4,4,No,AMITRYPTYLINE,COLD,UN UNK 2020,0,,1,1,UN UNK 2020,6/15/20,,1,0,12,g,G,Inhalant,IA (Intra-arterial),QD (Every Day),0,81845879,6,4382628,AMITRIPTYLINE,AMITRIPTYLINE,2201001,AMITRIPTYLINE,2201001,,,SPELLING UPDATE,AMITRIPTYLINE,"WHODRUG GLOBAL B3 MARCH 1, 2021",DRUGS FOR URINARY FREQUENCY AND INCONTINENCE,G04BD,DRUGS FOR URINARY FREQUENCY AND INCONTINENCE,G04BD,UROLOGICALS,G04B,UROLOGICALS,G04,GENITO URINARY SYSTEM AND SEX HORMONES,G,1
378,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,63059916,0,,126472436,1,N,1,1,No,BENADRYL,FEVER,26-Jan-20,0,9:00,0,0,26-Jan-20,1/26/20,7:00,0,0,100,mg,MG,Capsule,PO (Oral),BID (Twice a Day),1,95547017,4,5211852,BENADRYL (UNITED STATES),BENADRYL [DIPHENHYDRAMINE HYDROCHLORIDE],402002,DIPHENHYDRAMINE HYDROCHLORIDE,402001,,,COUNTRY,APPLY SITE COUNTRY TO TERM,"WHODRUG GLOBAL B3 MARCH 1, 2021",AMINOALKYL ETHERS,R06AA,AMINOALKYL ETHERS,R06AA,ANTIHISTAMINES FOR SYSTEMIC USE,R06A,ANTIHISTAMINES FOR SYSTEMIC USE,R06,RESPIRATORY SYSTEM,R,1
378,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,63059916,0,,126472437,2,N,2,2,Yes,DIPHENHYDRAMINE HYDROCHLORIDE,LEG PAIN,28-Jan-20,1,,1,1,1-Feb-20,2/1/20,,1,1,100,Capsule,CAPSULE,Capsule,Unknown,QD (Every Day),0,94095723,13,5084095,DIPHENHYDRAMINE HYDROCHLORIDE,DIPHENHYDRAMINE HYDROCHLORIDE,402001,DIPHENHYDRAMINE HYDROCHLORIDE,402001,,,,,"WHODRUG GLOBAL B3 MARCH 1, 2021",AMINOALKYL ETHERS,R06AA,AMINOALKYL ETHERS,R06AA,ANTIHISTAMINES FOR SYSTEMIC USE,R06A,ANTIHISTAMINES FOR SYSTEMIC USE,R06,RESPIRATORY SYSTEM,R,1
378,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,63059916,0,,126472438,3,N,3,3,Yes,TETRACYCLINE,FEVER,12-Feb-20,0,12:12,0,1,18-Feb-20,2/18/20,,0,0,10,mg,MG,Capsule,DE (Transdermal),BID (Twice a Day),1,84246445,6,4537684,TETRACYCLINE,TETRACYCLINE,1701001,TETRACYCLINE,1701001,,,,,"WHODRUG GLOBAL B3 MARCH 1, 2021",ANTIBIOTICS,S01AA,ANTIBIOTICS,S01AA,ANTIINFECTIVES,S01A,OPHTHALMOLOGICALS,S01,SENSORY ORGANS,S,1
379,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,63059986,0,,126472565,3,N,1,1,No,BENADRYL,COLD,10 UNK 2020,0,,0,0,20 UNK 2020,6/15/20,,0,0,12,IU,IU,Lotion,IJ (Intra-articular), , ,84734661,12,4567194,BENADRYL (UNITED STATES),BENADRYL [DIPHENHYDRAMINE HYDROCHLORIDE],402002,DIPHENHYDRAMINE HYDROCHLORIDE,402001,,,COUNTRY,APPLY SITE COUNTRY TO TERM,"WHODRUG GLOBAL B3 MARCH 1, 2021",AMINOALKYL ETHERS,R06AA,AMINOALKYL ETHERS,R06AA,ANTIHISTAMINES FOR SYSTEMIC USE,R06A,ANTIHISTAMINES FOR SYSTEMIC USE,R06,RESPIRATORY SYSTEM,R,1
379,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,63059986,0,,126472563,1,N,2,2,No,SOMINEX,COLD,,1,,1,0,,,,1,1,,mL,ML,Liquid,EP (Epidural),PRN (As Needed),0,82746644,5,4580551,SOMINEX (UNITED STATES),SOMINEX [DIPHENHYDRAMINE HYDROCHLORIDE],402060,DIPHENHYDRAMINE HYDROCHLORIDE,402001,,,COUNTRY,APPLY SITE COUNTRY TO TERM,"WHODRUG GLOBAL B3 MARCH 1, 2021",AMINOALKYL ETHERS,R06AA,AMINOALKYL ETHERS,R06AA,ANTIHISTAMINES FOR SYSTEMIC USE,R06A,ANTIHISTAMINES FOR SYSTEMIC USE,R06,RESPIRATORY SYSTEM,R,1
379,Randomized,TEST SITE,Concomitant Medications,0,MD,Concomitant Medications,15,MD1,Concomitant Medications,63059986,0,,126472564,2,N,3,3,No,ZQUILL,PAIN,,1,,1,0,17-Feb-20,2/17/20,,1,0,5,%,%,Aerosol,OP (Ophthalmic),Q2H (Every 2 Hours),0,99707553,22,5330876,ZZZQUIL,ZZZQUIL,402326,DIPHENHYDRAMINE HYDROCHLORIDE,402001,,,SPELLING UPDATE,ZZZQUIL,"WHODRUG GLOBAL B3 MARCH 1, 2021",AMINOALKYL ETHERS,R06AA,AMINOALKYL ETHERS,R06AA,ANTIHISTAMINES FOR SYSTEMIC USE,R06A,ANTIHISTAMINES FOR SYSTEMIC USE,R06,RESPIRATORY SYSTEM,R,1
Loading

0 comments on commit e6e8d7d

Please sign in to comment.