Data and Document Analysis with Python, SQL, and AI

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

Overview

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.


Table of Contents

  1. Note on Integrating AI Tools Into the Workshop Series
  2. Note on the Workshop Coding Environment
  3. Workshop Series Data and Learning Resources
  4. Intro to Python Part 1: Variables, Lists, Loops, Conditionals
  5. Intro to Python Part 2: Pandas and Graphing
  6. Intro to SQL
  7. Intro to Python and SQL Part 1
  8. Intro to Python and SQL Part 2
  9. Analyzing Covid Testing Data with Python and SQL
  10. Python and Web APIs: Working with Dictionaries and JSON
  11. Image, Audio, and Video to Text Transcription with Python
  12. Image Annotation and Object Detection
  13. Python Background for Text Analysis and Natural Language Processing
  14. Predicting COVID Test Outcome with Scikit-Learn
  15. Document Classification with Scikit-Learn
  16. Document Topic Modeling with Python
  17. Classification, Sentiment Analysis, and Topic Modeling Using Pre-Trained APIs
  18. Sharing, Versioning, and Collaborating with Git and GitHub
  19. Cloud-Based SQL Database and AI Integrations
  20. Citation
  21. Instructor
  22. Upcoming Sessions

Note on Integrating AI tools into the workshop series

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.

Local GenAI (Ollama)

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.


Note on the Workshop Coding Environment

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.


Intro to Python Part 1: Variables, Lists, Loops, Conditionals

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.

Key Topics:

Resources:

Recordings:


Intro to Python Part 2: Pandas and Graphing

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.

Key Topics:

Resources:

Recordings:


Intro to SQL

Online Tutorial Resources:

The Intro to SQL workshop at the UCSF Library follows the “Data Management with SQL for Ecologists” workshop from Data Carpentry:

Recordings:


Intro to Python and SQL Part 1

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.

Key Topics:

Resources:

Data Sources:

Recordings:


Intro to Python and SQL Part 2

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.

Key Topics:

Resources:

Recordings:


Analyzing Covid Testing Data with Python and SQL

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.

Resources:

Recordings:


Python and Web APIs: Working with Dictionaries and JSON

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.

Key Topics:

Resources:

Recordings:

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.

2026 Update Recordings:

2026 Update Resources:


Image, Audio, and Video to Text Transcription with Python

Focuses on converting multimedia content to text using optical character recognition (OCR) and audio transcription tools.

Key Topics:

Resources:

Recordings:


Image Annotation and Object Detection

Introduction to annotating images and detecting objects using TensorFlow and cloud APIs.

Key Topics:

Resources:


Python Background for Text Analysis and Natural Language Processing

Covers foundational NLP techniques such as cleaning text, tokenization, stop word removal, stemming, and lemmatization. Applicable to single documents or collections.

Key Topics:

Resources:

Workshop Repository:

Sample dataset:

Recordings:


Predicting COVID Test Outcome with Scikit-Learn

Introduction to supervised machine learning for classification problems using COVID symptom data. Emphasizes practical model building with scikit-learn.

Resources:

Recordings:


Document Classification with Scikit-Learn

Explores text classification techniques including bag-of-words, random forest classifiers, and building machine learning pipelines.

Key Topics:

Resources:

Workshop Repository:

Recordings:


Document Topic Modeling with Python

Unsupervised learning for discovering latent topics in text collections using K-Means Clustering.

Resources:

Workshop Repository:

Tutorials and Code Samples:

Recordings:


Classification, Sentiment Analysis, and Topic Modeling Using Pre-Trained APIs

Using external APIs and libraries like Google Cloud NLP, VADER, and zero-shot HuggingFace transformers for classification and sentiment analysis.

Resources:

Workbooks:

Recordings:


Sharing, Versioning, and Collaborating with Git and GitHub

Introduces version control and collaborative workflows using Git and GitHub, including sample projects and workshop materials.

Resources:

Recordings:


Cloud-Based SQL Database and AI Integrations

Working with cloud SQL services such as the Google BigQuery sandbox to query large public datasets without requiring paid accounts.


Citation

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}
}

Instructor

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.


Upcoming Sessions

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.