How this archive works

Contents

The 30-second tour

Every data SOURCE we touch gets a folder under _datashare/ named for the source agency (e.g. TEA_AEIS, THECB, TDI). Inside every source folder you'll find:

The seven-step Stata pipeline

Every datashare project ships with seven numbered do-files in _code/:

FileRoleWrites to
000_controlfile.doPaths + globals + Stata environment(globals only)
100_data_download.doFetches raw files from the source01_raw/
200_data_management.doImports raw, cleans, reshapes, merges02_cleaned/
300_labels.doVariable + value labels, notes, characteristics02_cleaned/ (in-place re-save)
400_data_profiler.doCodebook, summary stats, missingness, frequencies(webdoc2 page only)
500_aggregation.doCollapse / contract to county-year, statewide, panel02_cleaned/
600_analysis.doHeadline figures + tables for this source03_output/

Each file is independently re-runnable — every do-file calls dsload at the top, which loads 000_controlfile.do if its globals aren't already in scope.

000_controlfile.do in turn loads 050_preferences.do (color palette, graph dimensions, number formats, default file types), so every numbered file inherits the same look and feel without restating preferences.

How the website is built

Each numbered do-file is also a webdoc2 document. Running it:

  1. Executes the Stata code AND writes the HTML rendering of that code (with collapsible code accordions, embedded log output, and rendered graphs) into _documentation/website/.
  2. Opens with wdinit (Bootstrap 5 + Inter font + back-to-top button), draws a navbar with wdds_navbar, and an in-page TOC with wdtoc.
  3. Wraps code blocks with button/buttonclose (collapsed by default) or wd/wdclose (always-visible log). Graphs use graphbutton/graphbuttonclose.

Two extra do-files in _documentation/ finish the site:

Project metadata (000_controlfile.do)

Each project carries a small metadata block, set at scaffold time and editable any time:

GlobalMeaningThis project
Insurance_PriceTransparency_BCBSTXfolder name (CamelCase, underscored)Insurance_PriceTransparency_BCBSTX
Transparency-in-Coverage machine-readable files (in-network negotiated rates + prescription drugs) published by Blue Cross and Blue Shield of Texas (HCSC).one-line descriptionTransparency-in-Coverage machine-readable files (in-network negotiated rates + prescription drugs) published by Blue Cross and Blue Shield of Texas (HCSC).
https://www.bcbstx.com/member/machine-readable-filessource agency URLhttps://www.bcbstx.com/member/machine-readable-files
health care, insurance, pricestopic tag(s)health care, insurance, prices
yes / no / unsure
monthly refresh (source files restated ~monthly)refresh cadencemonthly refresh (source files restated ~monthly)
free-text caveats
up to 10 outcome vars for the auto-profiler
up to 10 by-vars for the auto-profiler
1 = export descsave codebook in 300_labels

Rebuilding everything

After editing any do-file, rebuild the website with:

. do "/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/_documentation/_runall.do"

_runall.do calls webdoc2 file.do, replace cleanup for every numbered file, then builds index.html and help.html last. On Mac it opens index.html at the end.

To rebuild ONE page only:

. webdoc2 "/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/_code/400_data_profiler.do", replace cleanup open

File-naming conventions (cheatsheet)

Full conventions: _datashare/_documentation/README_NamingConventions.txt

Extending: R, Python, GIS, JavaScript

The Stata pipeline is canonical. To add work in another language, drop parallel files into _code/ using the same numeric step + a language-appropriate extension:

. * Equivalent steps in different languages
. * 100_data_download.do        Stata (canonical)
. * 100_data_download.R         R alternative
. * 100_data_download.py        Python alternative
. * 200_data_management.ipynb   Jupyter notebook
. * 500_aggregation.qgz         QGIS project
. * 600_analysis_dashboard.html static dashboard built by 600


Outputs from non-Stata code still land in 02_cleaned/ (cross-language artifacts: .parquet, .csv, .feather) or 03_output/ (deliverables).

Path globals (set by 000_controlfile.do)

GlobalResolves to
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research TeamGoogle Drive root (Shared drives/Data and Research Team)
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_codeshareShared drives/Data and Research Team/_codeshare
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashareShared drives/Data and Research Team/_datashare
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTXthis project folder
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/01_raw / /Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/01_raw/_convertedraw files / machine-converted copies
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/02_cleanedcleaned analytic tables
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/03_outputoutput deliverables
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/_codedo-files
/Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/_documentation / /Users/ericbooth/Library/CloudStorage/GoogleDrive-eric.booth@texas2036.org/Shared drives/Data and Research Team/_datashare/Insurance_PriceTransparency/BCBSTX/_documentation/websitedocumentation / built website

Creating a new datashare project

From any Stata session:

. projectbuilder MySource_Subsource, desc("Short description") url("https://source.example.com/")

This scaffolds _datashare/MySource_Subsource/ with the full folder tree, all seven do-files, and the documentation templates pre-filled. See help projectbuilder for options.

Contacts