Analysis supplement
Herbal combinations in Xiaoyao San–related prescriptions for menstrual and emotional disorders
Dongfei Lin

Reproduction
Unzip all files to one directory. Run python analysis.py with Python, NumPy, pandas, SciPy and statsmodels installed. Run python figures.py with Matplotlib installed to regenerate all six figures from the matrices. Run python additional_checks.py for the female-only, size, label and complete-inventory analyses. CSV is UTF-8. Source workbooks are required only for rechecking source records. This archive contains no case narratives or patient identifiers.

Files and units
case_matrix.csv contains one indexed recipe per case. id is a nonconsecutive zero-based formula-hit index. book, sheet and row locate a source record; row is the one-based Excel row including the header. group M is menstrual and E emotional. year is the first documented consultation year. doctor ? denotes unattributed. label X is base Xiaoyao with or without individualized changes, D is a Danzhi lineage, J a Jiawei label, O another named derivative. later = 1 marks a family recipe first indexed after the initial recorded visit or a subsequent revision. border = 1 marks a primarily cycle-associated symptom presentation or an emotional case with an independent menstrual diagnosis. size is the distinct ingredient count. Remaining columns are binary variables in the 36-ingredient panel. Source terminology, rather than botanical authentication, underlies the ingredient identities.
all_ingredients.csv contains all 946 case–ingredient incidences. terms.csv is the observed term-to-ingredient crosswalk. A vertical bar in the standardized term field splits a conjunctive term into two ingredients. full_counts.csv contains counts by group across the entire inventory. The grouped wheat variable includes Xiaomai, Huaixiaomai and Fuxiaomai.
inventory.csv gives record and name-hit counts by file and sheet. candidate_log.csv gives the locators and inclusion status for all 249 screened candidates. index_extraction.csv gives the selected text-field line spans and the adjudicated indication for included cases. Numbered lines are zero-based, with empty lines removed from the source field picked by the screening program. s denotes the structured formula field. Formal review uses the original row, as an extracted heading or field may contain a following visit. One example is record 590, where the second of two sequential prescriptions is the Xiaoyao component. Source name/indication keyword screens are in screening/. Raw worksheets and verbatim clinical text are not distributed.
order_audit.csv reports aggregate order lines in the second archive. The file includes the single incidental place-name match. The query is in screening/orders_audit.py.
individual.csv and pairs.csv report group counts, denominators, absolute percentage-point differences (E minus M), pointwise 95% Newcombe intervals, two-sided Fisher tests and Benjamini–Hochberg q values. tests.csv gives the global profile contrasts. allocations counts random draws for Monte Carlo tests and all allocations for exact tests. The scripts are the numerical definitions for these outputs. All inferential analyses are exploratory.

Versions used: Python 3.14.6, NumPy 2.5.1, pandas 2.3.3, SciPy 1.18.0, statsmodels 0.15.0, Matplotlib 3.11.1.
