AI-Assisted Authoring of an Open-Access Portuguese Biostatistics Book in Quarto and R
Watch on YouTubeVideo summary
Professor André Banel from Ceará University presented a project aimed at bridging the gap in open-access educational resources by creating an applied biostatistics book titled "Biostatística Aplicada - Saúde e Nutrição." The primary goal was to develop a personalized, Portuguese-language textbook specifically tailored for health science students who often lack prior programming experience. To achieve this without spending months writing from scratch, Banel utilized AI tools like Cloud Sonnet and the CLI agent Code Copilot within an RStudio environment to draft content based on existing course scripts and presentations. The project successfully integrated real-world data from Brazil's public health system, specifically using records from DataSUS in Maringá, Paraná, to provide students with relevant examples drawn directly from their local healthcare context rather than generic datasets.
The AI played a crucial role in generating boilerplate code for tasks such as plotting and data wrangling while maintaining consistent coding styles across different chapters of the book. It also assisted in structuring the scripts into prose and formatting the final output using Quarto, significantly accelerating the production process. However, human oversight remained essential throughout the workflow; Banel and his team meticulously reviewed all generated code and text to ensure statistical accuracy and appropriate clinical interpretation. This manual verification was particularly important for navigating specific Brazilian healthcare nuances, such as understanding that ICD codes ending in nine indicate non-specified diseases or recognizing when cancer data lacks location certification details, which an AI without local context might misinterpret.
Despite the efficiency gains, the project encountered several technical challenges, including memory failures during CI/CD pipelines and compilation issues due to limited resources on GitHub's free hosting tier. These obstacles required significant manual configuration of tools like Node.js and Git actions before a stable version could be published. Furthermore, while AI excelled at generating structure and syntax, it necessitated extensive human intervention to ensure the logical sequence of topics suited PhD students and that all statistical results were correctly contextualized within Brazilian medicine. The final product is available in Portuguese via GitHub Pages, with plans to add an English translation later, demonstrating a viable model for creating specialized open educational resources in languages other than English.
Ultimately, this initiative highlights a transformative opportunity for non-English speaking research communities to leverage existing teaching materials and open data alongside AI-assisted drafting tools. By combining subject matter expertise with generative AI capabilities, educators can create highly personalized books that address specific domain needs without the prohibitive time cost of traditional publishing methods. Banel concluded by emphasizing that while AI cannot replace deep clinical knowledge or local context understanding, it serves as a powerful accelerator for producing high-quality, accessible educational content in underrepresented languages and domains.
Read the full video transcript
Hello everyone. I'm
Andre Banel. I'm a professor at Ceará
University.
And here to
deliver a talk AI system outcome of open
access biostatistics book in R.
So at the university I teach, I teach a
course in biostatistics and we teach R
for
health science students. So most
students don't have any practical
programming skills, so they need to
learn from scratch.
And we have a gap where students need a
good statistical foundation,
practical programming skills, and
real-world health health data examples,
but we also miss open access resource in
Portuguese.
Uh we also need examples in Brazilian
health data.
And in we also need a personalized book
for the course.
Uh if you would write a book from
scratch, it would take more weeks or
months of full-time work.
And
our objective to see if AI could assist
in that process.
So the book is called Biostatistics
Aplicada - Saúde e Nutrição.
And in
English, Applied Biostatistics in Health
using R. This book teaches
uh from introduction to R and RStudio
until data wrangling in Tidyverse,
exploratory and data visualization,
hypothesis testing, uh regression
models, also teaches systematic analysis
and text mining
using LLMs. So this book was built for
promotion at promotion in the problem at
the Cesumar University.
Uh so, what we used to
write this book? We used
scripts from
used at the course. So, the scripts were
already
made and classroom presentations. So,
the PDFs on
the lesson.
And we all wrote the data sets also that
were used.
And our workflow we used existing R
scripts with the PDFs. We had a similar
AI tool
called code.
We didn't talk the book.
The AI uh drafted the book
and the we authors corrected and
reviewed all both the code and the text
in the book.
To make it
more interesting
to use the health uh
care examples using real data from the
Brazilian public health system.
In Brazil, we have a
a data source called DataSUS. It's from
the Brazilian Ministry of Health
and the open
health records platform.
Uh one of the
resource service uh you can download in
this
uh from DataSUS is called SIH.
It's a hospital information system. So,
it's admission and patient records from
Tariff Brazil.
And we use from
uh the city where our university's
located is in Maringá, Paraná, Brazil
from the year
2024.
All this data was downloaded with the
microdata source R package. It's is that
was made
uh make it easier to download data.
So, all AI
uh architectures that used to
uh
assisting authoring
used Cloud Sonnet
uh for 0.5
uh 0.6.
It's not the best model, but it also
worked very, very good.
Cloud Code is a CLI uh
agent called do.
For our IDE is Positron.
I teach we use RStudio, but for coding
the repository.
And for our free hosting website is
GitHub Pages.
So, Cloud Code accelerated the products
uh code examples. It also used Quarto
for the book structure. So, it formatted
the all the code and scripts uh using
Quarto.
And our workflow consisted I defined the
objectives for the book.
Cloud Code written the uh scripts and
PDFs. Drafted the code and the prose for
uh the book.
I reviewed the and drafted the code.
Tested with real world data, and this
was many directions until the book was
publication ready.
Ready.
So, where AI helped the most?
They have a lot in part chunk of
information options.
Uh
boilerplate code, for example, is a plot
or some other R packages
like for data wrangling using tidyverse.
It can also help to maintain consistent
code styles across chapters.
The structure of the scripts also into
prose was
uh very good using
uh AI.
And for the Portuguese person there.
So, it
made my teaching materials and I can
allow to improve and create the book.
But also, there's a lot of
domain expertise was needed. For
example, statistical interpretation. You
need to verify
uh what the AI
would make of some statistical results.
The clinical context.
For example, a lot of observations in
Brazil,
there's ICD code
finishing
>> [clears throat]
>> uh the last digit is nine. So, there's a
non-specified
disease.
It's a characteristic of our health care
system.
So, if you don't know this, you don't
have this context, it makes
interpretation hard. For example,
analyze some cancer.
And
all the cancer was not certified for
example for
location on the body.
Also, what was needed is
sequence, a logical sequence for the PhD
student so they could
know what they could learn first.
But there was there a lot of challenges
along the way.
For example, the CI/CB
pipeline
had a lot of memory failures and caused
some
Like exactly one
uh
they had some problems compiling all of
the code.
Uh there's isn't enough memory in GitHub
for using our free hosting
book.
Also needed a lot of manual
configuration of the system and a lot of
workflows
iterations before I could
reach a stable version.
We also needed acting expertise.
So, to configure the CLI tool, we need
to install Node.js,
the same party scripts, the stand on the
Git and GitHub actions.
And now also a lot of the content
required significant manual revisions.
So,
even because the book is is drafted, we
need to correctly review
all the
the code and the text.
Here's a QR code, so
our viewers can see the book. It's in
Portuguese. I plan to add English
translation.
And here I propose a robotics model.
So, this is very important for
non-English speaking research
communities.
Uh
so, for example, an individual who has
subject matter
expertise,
it can use it existing teaching
materials, open data and required tools,
and AI assisted drafting, for example,
our code of subject matter tool, and
create open educational resources in
languages. That's a very very
interesting
uh opportunity we have now.
Some languages don't have a lot of
content,
and you can make it
uh books that are specific to our
domains and are very
uh personalized for our course.
That's what I wanted to share. I love
our medicine thousand thousand
uh six, and thank you for this
opportunity.