Skip to content

Commit ef5ed7d

Browse files
docs: streamline toolkit to tool-only; link schema/workflow/bibliography to teaching
- README Data Structure -> runtime-contract table (matches vis_tool_core.py loader); full schema now canonical in teaching - Add Design Notes (env-config + word-family rationale); Overview links to teaching workflow - References point to teaching bibliography - paper.md: canonical-schema note -> teaching (paper stays self-contained) - Notebook: markdown lean pass (rationale prose -> README Design Notes; empty artifact cells removed); code cells unchanged
1 parent c10205d commit ef5ed7d

3 files changed

Lines changed: 65 additions & 168 deletions

File tree

README.md

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ An easy-to-use toolkit for visualizing patterns in qualitative data, helping res
1919
- [Regular Usage](#regular-usage)
2020
- [Using Your Own Data](#using-your-own-data)
2121
- [Data Structure](#data-structure)
22+
- [Design Notes](#design-notes)
2223
- [Troubleshooting](#troubleshooting)
2324
- [Uninstallation](#uninstallation)
2425
- [Training Resources](#training-resources)
@@ -35,6 +36,8 @@ The CMAP Visualization Toolkit offers a free suite of open-source tools to analy
3536

3637
The CMAP (Cultural Mapping and Pattern Analysis) tool is free, open-source and produced by the [Computational Ethnography Lab](https://github.com/Computational-Ethnography-Lab) at Rice University.
3738

39+
This toolkit implements the visualization step of the lab's end-to-end qualitative workflow — see [Teaching → Workflow Steps](https://github.com/Computational-Ethnography-Lab/teaching#workflow-steps-end-to-end) for the general workflow and data schema.
40+
3841
---
3942

4043
### Notebook Version & Local Installation
@@ -276,58 +279,58 @@ To analyze your own text data:
276279

277280
### Data Structure
278281

279-
For technically minded users, here's the complete schema for data files (See Abramson et al. 2025):
280-
281-
```python
282-
# Updated schema with Python typing
283-
schema = {
284-
"project": str, # List project
285-
"number": str, # Position information
286-
"reference": int, # Position information
287-
"text": str, # Content, critical field: must not be empty
288-
"document": str, # Data source, Critical field: must not be empty
289-
"old_codes": list[str], # Optional: codings, must be a list of strings
290-
"start_position": int, # Position information
291-
"end_position": int, # Position information
292-
"data_group": list[str],# Optional, to differentiate document sets: Must be a list of strings
293-
"text_length": int, # Optional: NLP info
294-
"word_count": int, # Optional: NLP info
295-
"doc_id": str, # Optional: NLP info, unique paragrah level identifier
296-
"codes": list[str] # Critical for analyses with codes, Must be a list of strings
297-
}
298-
```
299-
```python
300-
example (simulated, not actual data):
301-
{
302-
"project": "engineer_interviews",
303-
"number": "675:113" #For reconstructing with QDA software
304-
"reference": 244 #For reconstructing with QDA software
305-
"text": "EG002: So the thing is..." # Actual paragraph level text,
306-
"document": "INTV_EG002_20250801.txt" # name of document, in which text is found
307-
"start_position": 244 #For reconstructing with QDA software
308-
"end_position": 248 #For reconstructing with QDA software
309-
"data_group": ["data_type_cg_interviews","interview"] # For subsetting by data type, or characteristic
310-
"text_length": 441 # nlp
311-
"word_count": 82 # nlp
312-
"doc_id": "EG002_76426", #unique ID for text segment in file, to reconstruct or link to raw data, sequential
313-
"codes": ["narrative_life", "education_perceptions"] # qualitative codes, for concepts, themes, variables
314-
"old_codes": [
315-
"science_belief",
316-
"subject_speech_all"
317-
] # qualitative codes, for concepts, themes, variables; archived to silo and reduce clutter
318-
319-
},//
320-
```
282+
This is the **runtime contract** — the columns the notebook's loader (`function/vis_tool_core.py`) actually reads from your CSV. For the full conceptual schema (all fields, types, and rationale), see **[Teaching → Data Schema Example (CMAP)](https://github.com/Computational-Ethnography-Lab/teaching#data-schema-example-cmap)**.
283+
284+
| Column | Required? | Type | Notes |
285+
|--------|-----------|------|-------|
286+
| `text` | **Required** | string | Paragraph-level content to analyze. If no `text` column exists, the loader falls back to the first column whose name contains `text`, `content`, or `body`; if none is found it stops. |
287+
| `codes` | Optional | list of strings | Qualitative codes. Enables code-based analyses and code filtering. |
288+
| `data_group` | Optional | list of strings | Document-set labels for subsetting (e.g. by data type or characteristic). |
289+
| `project` | Optional | string | Project label, used to subset the data to one or more projects. |
321290

322-
**Critical Fields**:
323-
- `text`: Main content field - cannot be empty
324-
- `document`: Source information - cannot be empty
325-
- `codes`: Required for code-based analyses - must be a list of strings if used
291+
Other columns from the full schema (e.g. `document`, position fields, `word_count`, `doc_id`) are preserved if present but are not required by the loader.
326292

327293
**Important Notes**:
328-
- Lists (like `codes` and `data_group`) must be proper Python lists, not strings that look like lists
329-
- If you're exporting from qualitative data analysis software, ensure you convert any code fields to proper lists
330-
- The toolkit will validate your data structure and provide error messages for common issues
294+
- Lists (like `codes` and `data_group`) must be proper Python lists, not strings that look like lists. The loader will attempt to convert list-looking strings, but real lists are safest.
295+
- If you're exporting from qualitative data analysis software, ensure you convert any code fields to proper lists.
296+
- The toolkit will validate your data structure and provide error messages for common issues.
297+
298+
## Design Notes
299+
300+
Rationale for two setup steps in the notebook (`visualization_toolkit_final.ipynb`). The notebook keeps a short key-decision note at each of these steps and points here for the full explanation.
301+
302+
### Environment Configuration
303+
304+
In this section, we define the core directory structure used throughout the replication project. These paths help organize:
305+
306+
- **raw data**,
307+
- **trained models**,
308+
- **clustering results**, and
309+
- **final outputs**.
310+
311+
This setup also makes it easier for users to customize where intermediate results and final outputs will be saved. For example, by changing these directory names, users can **create their own versions of model runs or clustering outputs without overwriting previous results.**
312+
313+
All directories will be automatically created if they don't already exist.
314+
315+
### Stopword Expansion and Semantic Word Family Definitions
316+
317+
This section defines a comprehensive list of stopwords, extending NLTK’s default stopword set with:
318+
- **punctuation**,
319+
- **contractions**,
320+
- **common filler words**, and
321+
- **project-specific conversational terms** that are semantically uninformative in analysis.
322+
323+
We also build a custom `WORD_FAMILIES` dictionary, which groups related words into unified concepts (e.g., "death", "caregiver", "memory"). This allows the model to:
324+
- **compress synonyms and variations** into semantically meaningful units,
325+
- **reduce noise** in the embedding space,
326+
- and **support cultural/qualitative interpretation** of the results.
327+
328+
This section also includes validation checks to:
329+
- Ensure **no accidental overlaps** between stopwords and key analytical terms,
330+
- Detect **redundant words across families**,
331+
- And print summaries for user verification.
332+
333+
These definitions are critical for interpretability in downstream visualization and clustering.
331334

332335
## Troubleshooting
333336

@@ -403,7 +406,7 @@ For more detailed information, refer to the [Anaconda Documentation](https://doc
403406

404407
## References
405408

406-
This toolkit builds on academic work combining computational text analysis with qualitative research methods (Abramson et al. 2018, 2025). Please see the [lab repo](https://github.com/Computational-Ethnography-Lab) for additional resources and related research papers.
409+
This toolkit builds on academic work combining computational text analysis with qualitative research methods (Abramson et al. 2018, 2025). For a curated topical bibliography with DOIs, see [Teaching → Bibliography](https://github.com/Computational-Ethnography-Lab/teaching#v-bibliography). Please see the [lab repo](https://github.com/Computational-Ethnography-Lab) for additional resources and related research papers.
407410

408411
# Policies
409412
## License

documentation/paper.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ Reproducible Jupyter notebooks (see workshop repo), CMAP visualizations, codeboo
319319

320320
For structured analysis and visualization (e.g., using the CMAP toolkit), data should be organized into a consistent tabular format (e.g., CSV or DataFrame). Below is an example schema:
321321

322+
> **Note:** The canonical data schema lives in the [teaching repo](https://github.com/Computational-Ethnography-Lab/teaching#data-schema-example-cmap). This paper keeps a self-contained copy so it renders standalone.
323+
322324
```python
323325
# Updated schema with Python typing
324326
schema = {

visualization_toolkit_final.ipynb

Lines changed: 10 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -7,73 +7,20 @@
77
"source": [
88
"# Visualization Toolkit Usage Guide\n",
99
"\n",
10-
"This notebook provides a suite of semantic analysis and visualization tools to explore word-level patterns and relationships in qualitative text data. It supports multiple clustering and embedding strategies for t-SNE, semantic networks, and word clouds. You can review the version with explanations here https://colab.research.google.com/drive/1n90EDMSiXhIaOULUMPJ4W4hqdZCh1NQw?usp=sharing\n",
10+
"A suite of semantic-analysis and visualization tools for word-level patterns in qualitative text data — word clouds, t-SNE semantic maps, word/code heatmaps, and semantic networks. An annotated online version is on [Colab](https://colab.research.google.com/drive/1n90EDMSiXhIaOULUMPJ4W4hqdZCh1NQw?usp=sharing) (not for sensitive data); see also the [video tutorial](https://vimeo.com/1122226315) and the [working-paper description](https://github.com/Computational-Ethnography-Lab/cmap_visualization_toolkit/blob/main/documentation/paper.md).\n",
1111
"\n",
12-
"### What You Can Do with This Toolkit\n",
12+
"**Full documentation — install, usage, data schema, design notes, license — is in the [README](https://github.com/Computational-Ethnography-Lab/cmap_visualization_toolkit#readme).** This notebook is meant to be run top-to-bottom: the **Setup** and **Helper Function** cells are background setup (run them once, in order); then use the **Analytics Tool** sections to generate and customize visuals.\n",
1313
"\n",
14-
"- **Generate Word Clouds** \n",
15-
" Visualize the most frequent and salient terms across your dataset or within filtered subsets based on keywords or project name.\n",
14+
"### How to run\n",
15+
"1. **Prepare your data** — a `.csv`/DataFrame with at least a `text` column (optional `project`, `codes`, `data_group` for subsetting). Full schema: [Teaching → Data Schema Example (CMAP)](https://github.com/Computational-Ethnography-Lab/teaching#data-schema-example-cmap).\n",
16+
"2. **Run Setup + Helper Functions top-to-bottom** — these load packages, define directories, stopwords / word-families, validators, and the plotting functions.\n",
17+
"3. **Run a tool section** — Basic (word cloud), Intermediate (heatmaps, t-SNE, networks), or Advanced (full / interactive). Edit the user-configuration block at the top of each section.\n",
1618
"\n",
17-
"- **Plot t-SNE Semantic Maps** \n",
18-
" Reduce high-dimensional similarity or co-occurrence matrices into 2D using t-SNE to highlight semantic proximity between words. Seed words are emphasized to anchor interpretation.\n",
19-
"\n",
20-
"- **Create Word-Based Heatmaps and Semantic Networks** \n",
21-
" Explore how terms relate to each other in both visual space and co-occurrence structure:\n",
22-
" \n",
23-
" - **Basic Heatmap**: Highlights semantically clustered keywords based on selected embeddings or similarity matrices.\n",
24-
" - **Heatmap + Network**: Adds a basic network graph on top of the heatmap using default node/edge colors (no bundling, no category styling).\n",
25-
" - **Heatmap + Network (Colored Nodes & Edges)**: Fully stylized version including colored clusters, semantic links, and optional edge styling.\n",
26-
"\n",
27-
"- **Visualize Code Co-Occurrence Heatmaps** \n",
28-
" Plot the frequency with which qualitative codes appear together in the same entries. \n",
29-
"\n",
30-
"These tools help you visually investigate language patterns, conceptual clustering, and topic proximity—whether you’re doing grounded theory, thematic analysis, or exploratory semantic mapping.\n",
31-
"\n",
32-
"### How to Use\n",
33-
"1. **Prepare Your Dataset** \n",
34-
" Make sure your dataset is a `.csv` or DataFrame with at least:\n",
35-
" - A `text` column (raw text)\n",
36-
" - Optionally, a `project` column (for subsetting)\n",
37-
" - optionally a `codes' column` (for subsetting, and analysis)\n",
38-
" - Please see READ.md for the complete schema and more possibilities.\n",
39-
"\n",
40-
"2. **Set Key Parameters** \n",
41-
" Most functions accept:\n",
42-
" - `stopwords_path`: path to extra stopwords (optional)\n",
43-
" - `clustering_method`: 1 = RoBERTa, 2 = Jaccard, 3 = PMI, 4 = TF-IDF\n",
44-
" - `distance_metric`: \"cosine\" or \"default\" (used for similarity matrix choice)\n",
45-
"\n",
46-
"3. **Run Visualizations**\n",
47-
"You can explore and generate a variety of visual outputs using the execution blocks provided in the **Analytics Tools** and **Advanced Analytics Tools** sections.\n",
48-
"\n",
49-
"These include:\n",
50-
"- **Word Clouds** for highlighting high-frequency terms in selected texts or projects.\n",
51-
"- **t-SNE Semantic Maps** to project word relationships into 2D space for visualizing proximity and clusters.\n",
52-
"- **Word-Based Heatmaps** to show how frequently words co-occur.\n",
53-
"- **Semantic Network Graphs** (with optional heatmaps), including:\n",
54-
" - show relationships in text\n",
55-
" - basic node/seed networks,\n",
56-
" - networks with customized node colors,\n",
57-
" - and networks with or without edge bundling.\n",
58-
"- **Code-based Heatmap** to visualize co-occurrence patterns among qualitative codes\n",
59-
"\n",
60-
"📍 Simply scroll down to the relevant execution cells to run and customize these visualizations based on your dataset.\n",
61-
"\n",
62-
"### File Structure Notes\n",
63-
"- Define constants like `DATA_DIR`, `OUTPUT_DIR`, and stopword files before running.\n",
64-
"- Ensure required files and embeddings are preloaded or generated using prior pipeline steps.\n",
65-
"\n",
66-
"> Tip: Start by testing on one project or topic before scaling to all data.\n",
67-
"\n",
68-
"# TESTING\n",
19+
"**Key parameters (set per tool):** `clustering_method` 1 = RoBERTa, 2 = Jaccard, 3 = PMI, 4 = TF-IDF; `distance_metric` `\"cosine\"` or `\"default\"`. Design rationale for the environment-configuration and word-family setup steps is in [README → Design Notes](https://github.com/Computational-Ethnography-Lab/cmap_visualization_toolkit#design-notes).\n",
6920
"\n",
7021
"## License & Citation\n",
7122
"\n",
72-
"**License:** [BSD 3-Clause](https://opensource.org/license/bsd-3-clause/) · “AS IS” — no warranties or liability.\n",
73-
"\n",
74-
"**Citation:** *Abramson, Corey M. and Yuhan (Victoria) Nian. 2025. CMAP Visualization Toolkit.* <https://github.com/Computational-Ethnography-Lab/cmap_visualization_toolkit>\n",
75-
"\n",
76-
"For questions or use requests, please email <corey.abramson@rice.edu>."
23+
"BSD 3-Clause (\"AS IS\", no warranty). **Cite as:** Abramson, Corey M. and Yuhan (Victoria) Nian. 2025. *CMAP Visualization Toolkit.* Full citation with the Zenodo DOI and contributor list is in the [README](https://github.com/Computational-Ethnography-Lab/cmap_visualization_toolkit#policies). Questions: <corey.abramson@rice.edu>."
7724
]
7825
},
7926
{
@@ -241,16 +188,7 @@
241188
"source": [
242189
"### Environment Configuration\n",
243190
"\n",
244-
"In this section, we define the core directory structure used throughout the replication project. These paths help organize:\n",
245-
"\n",
246-
"- **raw data**, \n",
247-
"- **trained models**, \n",
248-
"- **clustering results**, and \n",
249-
"- **final outputs**.\n",
250-
"\n",
251-
"This setup also makes it easier for users to customize where intermediate results and final outputs will be saved. For example, by changing these directory names, users can **create their own versions of model runs or clustering outputs without overwriting previous results.**\n",
252-
"\n",
253-
"All directories will be automatically created if they don't already exist."
191+
"Defines the core directory structure (raw data, models, clustering results, outputs); all directories are auto-created. Change these names to keep separate model/clustering runs without overwriting previous results. **Full rationale:** [README → Design Notes](https://github.com/Computational-Ethnography-Lab/cmap_visualization_toolkit#design-notes)."
254192
]
255193
},
256194
{
@@ -357,23 +295,7 @@
357295
"source": [
358296
"### Stopword Expansion and Semantic Word Family Definitions\n",
359297
"\n",
360-
"This section defines a comprehensive list of stopwords, extending NLTK’s default stopword set with:\n",
361-
"- **punctuation**, \n",
362-
"- **contractions**, \n",
363-
"- **common filler words**, and \n",
364-
"- **project-specific conversational terms** that are semantically uninformative in analysis.\n",
365-
"\n",
366-
"We also build a custom `WORD_FAMILIES` dictionary, which groups related words into unified concepts (e.g., \"death\", \"caregiver\", \"memory\"). This allows the model to:\n",
367-
"- **compress synonyms and variations** into semantically meaningful units,\n",
368-
"- **reduce noise** in the embedding space,\n",
369-
"- and **support cultural/qualitative interpretation** of the results.\n",
370-
"\n",
371-
"This section also includes validation checks to:\n",
372-
"- Ensure **no accidental overlaps** between stopwords and key analytical terms,\n",
373-
"- Detect **redundant words across families**, \n",
374-
"- And print summaries for user verification.\n",
375-
"\n",
376-
"These definitions are critical for interpretability in downstream visualization and clustering."
298+
"Extends NLTK's stopwords (punctuation, contractions, filler, project-specific terms) and builds the `WORD_FAMILIES` dictionary that groups related words into unified concepts — compressing synonyms, reducing embedding noise, and supporting qualitative interpretation. Validation checks flag stopword/analytical-term overlaps and redundant families. **Full rationale:** [README → Design Notes](https://github.com/Computational-Ethnography-Lab/cmap_visualization_toolkit#design-notes)."
377299
]
378300
},
379301
{
@@ -3139,12 +3061,6 @@
31393061
"This section contains advanced heatmap and network combined execution blocks."
31403062
]
31413063
},
3142-
{
3143-
"cell_type": "markdown",
3144-
"id": "bcbc21be",
3145-
"metadata": {},
3146-
"source": []
3147-
},
31483064
{
31493065
"cell_type": "code",
31503066
"execution_count": null,
@@ -3686,30 +3602,6 @@
36863602
"if __name__ == \"__main__\":\n",
36873603
" main()"
36883604
]
3689-
},
3690-
{
3691-
"cell_type": "code",
3692-
"execution_count": null,
3693-
"id": "536568e4-3b86-4507-852a-9bee92d6d18e",
3694-
"metadata": {},
3695-
"outputs": [],
3696-
"source": []
3697-
},
3698-
{
3699-
"cell_type": "code",
3700-
"execution_count": null,
3701-
"id": "1ddb3204-ce24-4895-8c23-ed640eb6e407",
3702-
"metadata": {},
3703-
"outputs": [],
3704-
"source": []
3705-
},
3706-
{
3707-
"cell_type": "code",
3708-
"execution_count": null,
3709-
"id": "d443a3f1-86ae-4d39-bd87-9781538cd388",
3710-
"metadata": {},
3711-
"outputs": [],
3712-
"source": []
37133605
}
37143606
],
37153607
"metadata": {

0 commit comments

Comments
 (0)