This Shiny application allows users to upload and parse C-CDA and FHIR text files. It extracts relevant elements and presents them in a tabular format for easy viewing and download.
- Upload C-CDA and FHIR text files (up to 30MB)
- Parse and display the contents of C-CDA and FHIR files
- Download the parsed data as a CSV file
Make sure you have R and RStudio installed on your system. You will also need the devtools
package to install the app from GitHub.
- Install R: Download R
- Install RStudio: Download RStudio
Open RStudio and run the following commands to install the necessary packages:
install.packages(c("shiny", "xml2", "jsonlite", "dplyr", "tidyr", "DT", "devtools"))
Open a terminal or command prompt and navigate to the directory where you want to clone the repository. Then, run the following command:
git clone https://github.com/BoyceLab/CDAtransformer.git
Use the devtools
package to install the app from GitHub:
devtools::install_github("BoyceLab/CDAtransformer", force = TRUE)
-
Set the Working Directory:
Open RStudio and set the working directory to where your
app.R
file is located:setwd("path/to/CDAtransformer")
Replace
"path/to/CDAtransformer"
with the actual path to the cloned repository. -
Run the App:
Load the required packages and run the Shiny app:
library(shiny) runApp(".")
-
Upload a File:
- Click the "Choose CDA or FHIR Text File" button to upload your text file.
- Select the file type (CDA or FHIR).
- Click the "Parse Document" button to parse and display the contents.
-
Download Parsed Data:
- Click the "Download CSV" button to download the parsed data as a CSV file.
The UI is defined in the ui
function and includes a title panel, file input, radio buttons for file type selection, a parse button, and a download button. The parsed data is displayed in a datatable.
The server logic is defined in the server
function and includes:
- File Parsing: Functions to parse CDA and FHIR files.
- Data Display: Render the parsed data in a datatable.
- Data Download: Allow users to download the parsed data as a CSV file.
parse_cda(file)
: Parses a CDA file and extracts relevant elements.flatten_list(x, name)
: Recursively flattens a list.parse_fhir(file)
: Parses multiple FHIR resources and flattens them.transpose_data(data)
: Transposes a data frame.
Contributions are welcome! Please open an issue or submit a pull request for any changes.
This project is licensed under the MIT License - see the LICENSE file for details.