Skip to content

Commit 6716df5

Browse files
committed
clean site
2 parents fb6d4df + 2593569 commit 6716df5

File tree

191 files changed

+781
-54865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+781
-54865
lines changed

R/llm_interpret.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#' - **OpenAI**: Utilises OpenAI's models via `chat_openai()`. Requires setting the `OPENAI_API_KEY` environment variable. Applicable models include:
1515
#' - `"gpt-4.1-nano"`
1616
#' - **Google Gemini**: Utilises Google's Gemini models via `chat_gemini()`. Requires setting the `GOOGLE_API_KEY` environment variable. Applicable models include:
17-
#' - `"claude-sonnet-4-20250514"`
17+
#' - `"gemini-2.5-flash-lite"`
1818
#' - **Anthropic Claude**: Utilises Anthropic's Claude models via `chat_anthropic()`. Requires setting the `CLAUDE_API_KEY` environment variable. Applicable models include:
1919
#' - `"claude-sonnet-4-20250514"`
2020
#'

README.Rmd

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ output:
88
# epiviz <img src="man/figures/logo.png" align="right" height="139" alt="" />
99

1010
<!-- badges: start -->
11-
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
11+
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
1212
[![R-CMD-check](https://github.com/ukhsa-collaboration/epiviz/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ukhsa-collaboration/epiviz/actions/workflows/R-CMD-check.yaml)
1313
<!-- badges: end -->
1414

15-
`epiviz` provides easy-to-use data visualisation functions for R epidemiological data science products. The package includes functions to create a range of static and interactive visualisations. Each visualisation function can produce either a static (ggplot2) or dynamic (plotly/leaflet) output using the same set of parameters, allowing users to easily switch between visualisation types by simply changing the `dynamic` flag.
15+
`epiviz` provides easy-to-use data visualisation functions for R data science products. The package includes functions to create a range of static and interactive visualisations. Each visualisation function can produce either a static (ggplot2) or dynamic (plotly/leaflet) output using the same set of parameters, allowing users to easily switch between visualisation types by simply changing the `dynamic` flag.
1616

1717
## Installation
1818

19-
epiviz can be installed from GitHub using the following code.
19+
epiviz can be installed from GitHub using the following code:
2020
```r
21+
# Install epiviz
2122
remotes::install_github('ukhsa-collaboration/epiviz')
2223

2324
# To install the development version
@@ -28,13 +29,94 @@ remotes::install_github("ukhsa-collaboration/epiviz@dev")
2829

2930
The following visualisation functions are available in the current release of epiviz:
3031

31-
- `line_chart()`: Line chart with options to add dual axes, threshold lines, and confidence limits as ribbons/error bars.
32-
- `col_chart()`: Column chart with options to add dual axes, threshold lines, and confidence limits as ribbons/error bars.
33-
- `point_chart()`: Point chart with support for groups, labels, and optional confidence intervals.
34-
- `epi_curve()`: Epidemic curve with flexible time aggregation, grouped bars, optional rolling averages, and a cumulative line.
35-
- `epi_map()`: Epidemiological map with customisable maps adaptable for multiple administrative levels.
36-
- `age_sex_pyramid()`: Age-sex pyramid with customisable age bands with the option to add error bars.
37-
- `llm_interpret()` (experimental): Generate brief narrative interpretations of data frames or ggplot outputs using configured LLMs.
32+
- `line_chart()`: Creates line charts with options for grouping, dual axes, threshold lines, and confidence limits (as ribbons or error bars).
33+
- `point_chart()`: Creates scatter/point charts with options for grouping, sizing points by values, custom shapes, and confidence intervals.
34+
- `col_chart()`: Creates column charts with options for grouping, dual axes, threshold lines, and confidence limits (as ribbons or error bars).
35+
- `epi_curve()`: Creates epidemic curves with options for different time periods, rolling averages, cumulative sums, and grouping by categories.
36+
- `epi_map()`: Creates choropleth maps with customisable colour scales, labels, and boundaries for different administrative levels.
37+
- `age_sex_pyramid()`: Creates age-sex pyramids with customisable age bands and confidence intervals.
38+
39+
All visualisation functions follow a consistent interface:
40+
41+
```r
42+
function_name(
43+
dynamic = FALSE, # Set to TRUE for interactive plotly/leaflet output
44+
base = NULL, # Optional base plot to add to
45+
params = list( # List of parameters controlling the visualisation
46+
df = data, # Data frame containing the data to visualise
47+
... # Function-specific parameters
48+
),
49+
... # Additional arguments passed to underlying plotting functions
50+
)
51+
```
52+
53+
### Key Features
54+
55+
- **Consistent Interface**: All functions use the same parameter structure, making it easy to learn and use the package.
56+
- **Static/Dynamic Flexibility**: Switch between static (ggplot2) and interactive (plotly/leaflet) visualisations by changing a single parameter.
57+
- **Customisation Options**: Extensive parameters for customising colours, labels, axes, legends, and more.
58+
- **Confidence Intervals**: Support for displaying confidence intervals across different visualisation types.
59+
- **Grouping Support**: Easily create grouped visualisations with appropriate legends.
60+
- **Dual Axes**: Support for secondary y-axes in applicable chart types.
61+
- **Threshold Lines**: Add horizontal reference lines to applicable chart types.
62+
63+
## Experimental Features
64+
65+
### LLM Interpretation
66+
67+
The package includes an experimental function `llm_interpret()` that uses Large Language Models (LLMs) to automatically interpret epidemiological data or visualisations. This function can:
68+
69+
- Generate narrative interpretations of data frames
70+
- Describe and analyse ggplot visualisations
71+
- Provide epidemiologically relevant observations
72+
73+
```r
74+
# Example: Interpret a data frame
75+
interpretation <- llm_interpret(
76+
input = summarised_df,
77+
word_limit = 150
78+
)
79+
80+
# Example: Interpret a ggplot visualisation
81+
plot <- line_chart(
82+
dynamic = FALSE,
83+
params = list(
84+
df = summarised_df,
85+
x = "specimen_date",
86+
y = "count",
87+
group_var = "organism_species_name"
88+
)
89+
)
90+
plot_interpretation <- llm_interpret(plot)
91+
```
92+
93+
#### Supported LLM Providers
94+
95+
The function supports multiple LLM providers:
96+
97+
- **OpenAI**: Models like `gpt-4.1-nano`
98+
- **Google Gemini**: Models like `gemini-2.5-flash-lite`
99+
- **Anthropic Claude**: Models like `claude-sonnet-4-20250514`
100+
101+
#### Environment Variable Setup
102+
103+
To use the `llm_interpret()` function, you need to set up the following environment variables:
104+
105+
```r
106+
# In your .Renviron file or before calling the function:
107+
Sys.setenv(LLM_PROVIDER = "openai") # Choose from: "openai", "gemini", "anthropic"
108+
Sys.setenv(LLM_API_KEY = "your-api-key-here")
109+
Sys.setenv(LLM_MODEL = "gpt-4.1-nano") # Use an appropriate model for your chosen provider
110+
```
111+
112+
You can set these environment variables in your `.Renviron` file for persistent configuration:
113+
114+
```
115+
# .Renviron file
116+
LLM_PROVIDER=openai
117+
LLM_API_KEY=your-api-key-here
118+
LLM_MODEL=gpt-4.1-nano
119+
```
38120

39121
## Package data
40122

@@ -104,4 +186,4 @@ age_sex_pyramid(
104186
colours = c("pink", "blue")
105187
)
106188
)
107-
```
189+
```

README.html

Lines changed: 631 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# epiviz <img src="man/figures/logo.png" align="right" height="139" alt="" />
22

33
<!-- badges: start -->
4-
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
4+
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
55
[![R-CMD-check](https://github.com/ukhsa-collaboration/epiviz/actions/workflows/R-CMD-check.yaml/badge.svg?branch=main)](https://github.com/ukhsa-collaboration/epiviz/actions/workflows/R-CMD-check.yaml)
66
<!-- badges: end -->
77

@@ -87,19 +87,19 @@ plot_interpretation <- llm_interpret(plot)
8787

8888
The function supports multiple LLM providers:
8989

90-
- **OpenAI**: Models like `gpt-4o`, `gpt-4o-mini`, `o1-mini`
91-
- **Google Gemini**: Models like `gemini-1.5-flash`
92-
- **Anthropic Claude**: Models like `claude-1`
90+
- **OpenAI**: Models like `gpt-4.1-nano`
91+
- **Google Gemini**: Models like `gemini-2.5-flash-lite`
92+
- **Anthropic Claude**: Models like `claude-sonnet-4-20250514`
9393

9494
#### Environment Variable Setup
9595

9696
To use the `llm_interpret()` function, you need to set up the following environment variables:
9797

9898
```r
9999
# In your .Renviron file or before calling the function:
100-
Sys.setenv(LLM_PROVIDER = "openai") # Choose from: "openai", "gemini", "claude"
100+
Sys.setenv(LLM_PROVIDER = "openai") # Choose from: "openai", "gemini", "anthropic"
101101
Sys.setenv(LLM_API_KEY = "your-api-key-here")
102-
Sys.setenv(LLM_MODEL = "gpt-4o") # Use an appropriate model for your chosen provider
102+
Sys.setenv(LLM_MODEL = "gpt-4.1-nano") # Use an appropriate model for your chosen provider
103103
```
104104

105105
You can set these environment variables in your `.Renviron` file for persistent configuration:
@@ -108,7 +108,7 @@ You can set these environment variables in your `.Renviron` file for persistent
108108
# .Renviron file
109109
LLM_PROVIDER=openai
110110
LLM_API_KEY=your-api-key-here
111-
LLM_MODEL=gpt-4o
111+
LLM_MODEL=gpt-4.1-nano
112112
```
113113

114114
## Package data

_pkgdown.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ template:
55
home:
66
links:
77
- text: Source code
8-
href: https://github.com/harshanal/epiviz
8+
href: https://github.com/ukhsa-collaboration/epiviz
99

1010
reference:
1111
- title: "Visualisation functions"
@@ -16,7 +16,7 @@ reference:
1616
- epi_map
1717
- line_chart
1818
- point_chart
19-
- title: "LLM interpretability"
19+
- title: "LLM-assisted epidemiologic narrative"
2020
contents:
2121
- llm_interpret
2222
- title: "Data"

docs/404.html

Lines changed: 0 additions & 93 deletions
This file was deleted.

docs/LICENSE-text.html

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)