---
title: "reviewStudy"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{reviewStudy}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup}
library(OmopStudyBuilder)
```

## Overview

When you receive a study package (or before you ship one), it is useful to quickly inspect:

- What files are included (R scripts, JSON, CSV, Excel)
- Whether `renv.lock` exists, and what it contains
- Whether any dependencies look surprising for the study type

`OmopStudyBuilder` provides two helpers:

- `reviewStudyCode()` summarises the contents of a directory
- `reviewStudyDependencies()` summarises dependencies based on `renv.lock`

## Review files in a study folder

Point `reviewStudyCode()` at the folder you want to inspect (often `studyCode/` or `diagnosticsCode/`).

The simplest pattern is to run these commands from within the project you want to review (for example, open `studyCode.Rproj` or `diagnosticsCode.Rproj`).

```{r reviewStudyCode-example, eval=FALSE}
reviewStudyCode(".")
```

## Review dependencies

`reviewStudyDependencies()` expects a `renv.lock` file in the directory.
Use `type = "analysis"` for analysis code, or `type = "reporting"` for reporting code.

```{r reviewStudyDependencies-example, eval=FALSE}
reviewStudyDependencies(
  dir = ".",
  type = "analysis"
)
```

