Curriculum for the Python/SQL Document Analysis with AI workshop series at the UCSF Library
View the Project on GitHub UCSF-DSOS/UCSF-DSOS-Python-SQL-Workshops
This repository provides a structured curriculum for computational text analysis and data management, with an emphasis on machine learning and generative AI. The series progresses from core programming principles to advanced text classification, sentiment analysis, and archival research.
Through hands-on coding exercises, participants work with diverse data formats, including numerical records, health data, and text collections—drawing heavily upon primary source materials from the UCSF Industry Document Library. Sessions emphasize applied practice, integrating conceptual frameworks directly with technical execution.
The focus of the series is to help participants build practical skills through hands-on work. Sessions emphasize applied coding, with lectures and theory used to support the exercises.
Compared to past workshops we have offered, this series incorporates AI-assisted programming earlier on while still starting with the basics. Intro to Python Parts 1 and 2 and Intro to SQL will use AI sparingly. As the series progresses, we will dive into topics like web APIs, text analysis, natural language processing, machine learning, regression, document analysis, and AI system interaction, gradually incorporating more AI-driven techniques.
Furthermore, in our previous workshop series, programming progressed from writing code by hand to downloading, reviewing, and modifying prepared code. That process made sense as we shifted to more complex tasks, requiring less manual coding and more adjustments to existing code. Now, the emphasis is on using AI-powered systems to generate code rather than pre-written codebases. While this approach enables new developers to generate code more rapidly, it also highlights the importance of learning to review and test code. We will focus on building these skills alongside our use of AI.
This workshop series also introduces GenAI for text, image, and video analysis using GenAI based local large language models (LLMs). Because it’s important to provide learning opportunities for experimentation in a low-risk environment, this workshop focuses on open source software and avoids commercial GenAI systems that require a paid account or a payment method enabled account. Ollama makes it possible for participants to learn GenAI coding and analysis methods without needing to pay for access or risk unexpected charges from cloud-based APIs. Running models locally also raises useful questions around local computation, data privacy, and reproducibility. We use Python to interact with these models programmatically via an API, applying them to tasks such as text generation, document analysis, image description, and OCR.
This workshop uses a combination of hosted Jupyter notebooks and local installation to balance accessibility with long-term technical independence. Hosted environments help reduce setup barriers so we can focus on core programming, data science, and machine learning concepts, while local development builds the skills needed to manage your own tools, work offline, and maintain control over your computational environment.
For more information, see Workshop_Coding_Environment.md.
This section introduces fundamental Python programming concepts including variables, data types, lists, loops, and conditionals. It follows the Software Carpentry Python Novice Gapminder tutorial to provide hands-on examples and exercises.
variables-functions.ipynb — Focus on variables, assignment, and basic functions.lists-loops-conditionals.ipynb — Covers list manipulation, loops, and conditional statements.Building on the basics, this section introduces pandas DataFrames for data manipulation and matplotlib for basic graphing and visualization. The aim is to help learners work effectively with tabular data.
Lists-Averages.ipynb — Using lists and loops for calculations such as averages.Pandas-Dataframes.ipynb — Loading data into DataFrames and calculating descriptive statistics.Colab-Pandas-Dataframe.ipynb — Running pandas code in Google Colab, including visualization examples.The Intro to SQL workshop at the UCSF Library follows the “Data Management with SQL for Ecologists” workshop from Data Carpentry:
Note: This workshop is an alternative to Intro to Python Part 1 and covers closely related material. However, this workshop introduces SQL based operations on Pandas dataframes early, and places a greater emphasis on SQL than pandas dataframe operations.
Learners explore how to load datasets and analyze them using both Python and SQL. Example datasets include COVID testing data from Carbon Health.
Python_SQL_Day_1.ipynb — Loading COVID testing data and exploring it in Google Colab.Oregon-Sugar-Document.ipynb — Processing tab-delimited text data relevant to archival research.Note: This workshop is an alternative to Intro to Python Part 1 and covers closely related material. However, this workshop introduces SQL based operations on Pandas dataframes early, and places a greater emphasis on SQL than pandas dataframe operations.
This section covers Python lists, loops and conditionals for the first half, then introduces text-based SQL querying through the LIKE function on a text based dataset from the Industry Archives.
Covid_Mock_Data.ipynb — Using generative AI to create synthetic datasets.Covid_Queries.ipynb — Running SQL queries on COVID data in Google Colab.Covid-Queries-Local.ipynb — Local SQL querying via pandasql.Learners explore how to load datasets and analyze them using both Python and SQL. Example datasets include COVID testing data from Carbon Health.
This workshop contains material similar to Intro to Python and SQL Part 1 (above). The main difference is that this workshop uses DuckDB instead of PandaSQL and makes much greater use of GenAI to create code and write SQL queries. The material in the previous two workshops is still helpful, and the SQL statements will be the same regardless of whether you use PandaSQL or DuckDB. However, unless you have a particular legacy reason to use PandaSQL, I’d recommend going with DuckDB for running SQL statements on Pandas dataframes.
This section covers how to work with Python dictionaries and parse JSON data from web APIs. Examples include building caffeine content databases and querying the National Library of Medicine RXNorm API, as well as the UCSF Industry Documents Library API.
Python-Dictionaries.ipynb — Introduction to dictionaries and key/value storage.Caffeine-Dictionary.ipynb — Example project mapping caffeine content in beverages.Web-API-Python.ipynb — Accessing and parsing data from RXNorm API.Industry_Documents_API.ipynb and Industry-Documents-ApiB.ipynb — Using UCSF’s Industry Documents Library API for archival research.NOTE: API as Programming Access to GenAI Methods
APIs have always provided access to both data and functionality. In earlier versions of this workshop series, APIs were primarily introduced in the context of accessing external data sources. More recently, their role has expanded significantly as a primary interface for interacting with AI systems programmatically. I am currently working to incorporate this expanded role of APIs more fully into the workshop series. The 2026 workshop recording reflects this shift in approach. In order to provide a free, open source GenAI system that allows participants to learn without providing a payment method to a cloud based GenAI API (OpenAI, Gemini, etc.), this workshop series will use Ollama, an open source GenAI platform that runs locally on your laptop.
Ollama-Image-Summarization-OCR.py — A workbook showing use of Ollama to describe an image and extract embedded text.Focuses on converting multimedia content to text using optical character recognition (OCR) and audio transcription tools.
Py_Tesseract_OCR.ipynb — Applying OCR to scanned images.Whisper_AI_Transcription.ipynb — Audio/video transcription workflows.Whisper_Diarized_Pipeline.ipynb — Diarization for speaker separation.Introduction to annotating images and detecting objects using TensorFlow and cloud APIs.
Covers foundational NLP techniques such as cleaning text, tokenization, stop word removal, stemming, and lemmatization. Applicable to single documents or collections.
Single-Text-Document.ipynb — Preprocessing a single text document.Multiple-Document.ipynb — Extending techniques to multiple documents.Introduction to supervised machine learning for classification problems using COVID symptom data. Emphasizes practical model building with scikit-learn.
ML-Covid-Data.ipynb — Machine learning code generated with ChatGPT and modified during the May 2026 workshop.Explores text classification techniques including bag-of-words, random forest classifiers, and building machine learning pipelines.
Random_Forest_Simple.ipynb — Simple example using two short movie reviews to illustrate sentiment analysis.Movie_Review_Pipeline.ipynb — Classification example using movie review dataset from NLTK.Document Classification — Expanded workshop material classifying documents using scikit-learn.Unsupervised learning for discovering latent topics in text collections using K-Means Clustering.
Simple-Kmeans.ipynb — Simple example using K-Means Clustering to illustrate unsupervised machine learning.k-means-visualization.pngUsing external APIs and libraries like Google Cloud NLP, VADER, and zero-shot HuggingFace transformers for classification and sentiment analysis.
HuggingFaceClassifier.ipynbHuggingFace_ZeroShot_Classifier.ipynbVader_Movie_Reviews.ipynbVader_Sentiment.ipynbIntroduces version control and collaborative workflows using Git and GitHub, including sample projects and workshop materials.
Working with cloud SQL services such as the Google BigQuery sandbox to query large public datasets without requiring paid accounts.
If you use this curriculum, code, or these workshop materials in your research or teaching, please cite them using CITATION.cff or as follows:
APA:
Boushey, G. (2026). Document Analysis with Python, SQL, Machine Learning, and AI (Version 2.0.0). [Computer software]. UCSF Library. https://github.com/UCSF-DSOS/UCSF-DSOS-Python-SQL-Workshops
BibTeX:
@software{Boushey_Document_Analysis_Python_SQL_AI_2026,
author = {Boushey, Geoffrey},
title = {Document Analysis with Python, SQL, Machine Learning, and AI},
url = {[https://github.com/UCSF-DSOS/UCSF-DSOS-Python-SQL-Workshops](https://github.com/UCSF-DSOS/UCSF-DSOS-Python-SQL-Workshops)},
version = {2.0.0},
year = {2026},
publisher = {UCSF Library}
}
Geoffrey Boushey is a computational and research data science specialist at UCSF and a member of the Library’s Data Science and Open Scholarship team. Geoff teaches courses and provides consultations on foundational programming, data analysis, and AI techniques including Python, SQL, Unix, and Version Control.
To check if this workshop series is being delivered in person within the next three months, see the UCSF Library Data Science And Open Scholarship Calendar. All members of the UCSF community are welcome to register.