QC Studio is a Streamlit app for QC data import, target tracking, and charting.
This guide shows:
- How to create a GitHub repository
- How to upload this project to GitHub
- How to run and deploy the app with Streamlit
- How to customize the code for your own panel (including replacing "test")
- GitHub account
- Python installed (3.9+ recommended)
- VS Code (recommended)
- Go to GitHub and click New repository.
- Enter a repo name (for example: qc-my-panel).
- Choose Private or Public.
- Click Create repository.
From the project folder, run:
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/<your-username>/<your-repo>.git
git push -u origin mainIf you created an empty repo on GitHub first, upload these files:
- qc_unified_app.py
- requirements.txt
- README.md
- Open your new repository.
- Click Add file > Upload files.
- Drag and drop the files.
- Commit changes.
git add .
git commit -m "Upload QC Studio files"
git pushIn your project folder:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
streamlit run qc_unified_app.pyThen open the URL shown in terminal, usually:
- Push latest code to GitHub.
- Go to https://share.streamlit.io
- Sign in with GitHub.
- Click New app.
- Select repository, branch, and main file: qc_unified_app.py
- Click Deploy.
If your panel is not "test", rename labels and defaults to your panel name.
- In VS Code, open global Search and Replace.
- Search for:
test
- Replace with your panel name, for example:
thyroid
- Review each match before replacing (some words may be unrelated).
- UI titles and captions
- Any default DB file names
- README project description
- Any old query parameter names in URLs
- Export labels (if they mention panel or hormone)
python -m py_compile qc_unified_app.py
streamlit run qc_unified_app.pyCheck:
- Data import works
- Targets import works
- Dashboard charts render correctly
- Export and report still work
After edits:
git add .
git commit -m "Panel customization updates"
git pushIf deployed on Streamlit Cloud, it will auto-redeploy from GitHub.
The app includes built-in database management in the Database page.
- Open the app.
- Go to the Database module.
- In Database File Management, click:
Download current database (.db)
- Save the file to your computer as a backup.
- Go to Database module.
- Open Danger Zone.
- Tick:
I understand this cannot be undone.
- Click:
Delete database file and reset
This permanently removes all imported data from the local database file.
From the project folder:
rm -f test_panel.dbIf you changed the DB path with QC_STUDIO_DB_PATH, delete that file path instead.
The app has 2 upload areas in the Database module:
- Import QC Data (builds database samples/results and charts)
- Upload Mean/SD Targets File (stores QC mean and SD target lines)
Accepted file types:
- .csv
- .xls
- .xlsx
Your CSV should include metadata columns:
- Type
- Level
- Data File
- Data Path
- Acq. Date-Time (or equivalent acquisition datetime label)
And analyte result columns named like:
<Analyte Name> Results
Notes:
- Type should be QC for rows to be imported as QC samples.
- Level should map to High/HQC or Low/LQC.
Pattern A: Workbook with one sheet per analyte.
Each analyte sheet should contain:
- QC run table with Date/Run and RESULT columns for HQC and LQC values
- HQC and LQC summary blocks with QC mean and SD information
Pattern B: Flat table sheet with columns such as:
- analyte/compound/name
- date (or run date)
- either HQC/LQC value columns, or
- qc level + concentration/value columns
This upload creates/updates:
- runs
- samples
- analytes
- results
- (if present) qc_targets from summary tables
Accepted file types:
- .csv
- .xls
- .xlsx
Minimum required target fields:
- analyte
- qc_level (High/HQC or Low/LQC)
- target_mean (QC mean)
- target_sd (provided SD)
Optional target fields:
- effective_from
- effective_to
- lot_number
For workbook-style Excel targets, each analyte sheet should have HQC/LQC summary tables where the app can read:
- QC mean
- SD (or values from which SD can be derived: ±2SD, ±3SD, or %CV)
- Import QC data file first (for data points).
- Import targets file (or workbook with summary tables) for mean/2SD/3SD lines.
- If parser logic changed, re-import the targets file so stored target rows are refreshed.
If something looks wrong:
- Re-check uploaded target values in the app
- Re-import files after parser changes
- Run compile check:
python -m py_compile qc_unified_app.py- Confirm required libraries are installed:
pip install -r requirements.txt- Add a sample input files folder (
examples/) with:- one valid CSV for QC data
- one valid Excel workbook for QC data
- one valid targets file
- Add a data dictionary table describing required/optional columns, accepted aliases, and examples.
- Add screenshots of each module (Import, Targets, Dashboard, Database) so new users can follow visually.
- Add a versioned changelog (
CHANGELOG.md) to track parser and schema changes. - Add a FAQ section for common setup/import/deploy issues.
- Add stronger file validation with clear, row-level error messages.
- Add preview tables before import so users can confirm parsed columns.
- Add progress bars and import summaries (rows accepted/rejected, analytes detected, target rows loaded).
- Add one-click “Download template” files for QC and targets uploads.
- Add confirmation dialogs for any destructive database actions.
- Add automated tests for:
- CSV parser
- Excel parser (both supported patterns)
- target extraction logic
- Add CI checks (GitHub Actions) for:
- syntax/compile
- linting
- tests
- Add schema migration/version checks so database changes are safer over time.
If you use AI tools (e.g., Copilot/ChatGPT) to modify the project, prompt quality matters a lot.
- Be specific about the file and function
- Example: “Update
qc_unified_app.pyfunctionparse_targets_file()to accept%CVand calculate SD asmean * (%CV/100).”
- Example: “Update
- State constraints clearly
- Keep backward compatibility.
- Do not rename existing DB tables/columns.
- Preserve Streamlit page layout.
- Define expected output format
- Request a diff-style response.
- Ask for exact code block replacements.
- Provide acceptance criteria
- “Must still pass
python -m py_compile qc_unified_app.py.” - “Must import both CSV and Excel targets without breaking current files.”
- “Must still pass
- Ask for edge-case handling
- Missing columns
- blank cells
- mixed HQC/LQC labels (
High,HQC,high, etc.)
- Request tests with the change
- “Also generate unit tests for the new parsing branch.”
- Iterate in small steps
- One change per prompt is safer than many unrelated changes at once.
In qc_unified_app.py, update target parsing so target_sd can also be derived from %CV when SD is missing.
Rules:
1) If target_sd exists, use it.
2) Else if percent_cv exists and target_mean exists, compute target_sd = target_mean * (percent_cv/100).
3) Preserve existing behavior for CSV and Excel inputs.
4) Add warnings (not crashes) for rows missing both SD and %CV.
5) Show me a minimal patch and include a quick test plan.
Note: These are common failure modes based on the current workflow described in this README.
-
Environment activation mismatch
source .venv/bin/activateworks on macOS/Linux, not default Windows shell.- Windows alternative:
- PowerShell:
.venv\Scripts\Activate.ps1 - CMD:
.venv\Scripts\activate.bat
- PowerShell:
-
Missing dependencies
- Import or runtime errors if
requirements.txtpackages are not installed. - Fix:
pip install -r requirements.txt
- Import or runtime errors if
-
Wrong main file on Streamlit Cloud
- Deploy fails if main file is not set to
qc_unified_app.py.
- Deploy fails if main file is not set to
-
Column naming mismatches in uploads
- CSV/Excel imports may silently fail or partially import if expected columns differ.
- Fix: align headers to README requirements and standardize level labels.
-
QC level mapping issues
- Inconsistent values (e.g.,
HIGH,H,Level 1) may not map cleanly to HQC/LQC logic.
- Inconsistent values (e.g.,
-
Target lines not showing on charts
- Usually happens when targets were not imported, imported with missing fields, or require re-import after parser updates.
-
Database deletion risk
- “Delete database file and reset” is irreversible; accidental clicks can remove all local data.
-
Database file path confusion
- If
QC_STUDIO_DB_PATHis set, users may deletetest_panel.dbbut actual DB is elsewhere.
- If
QC Studio already provides a solid flow for:
- importing QC data,
- importing target mean/SD values,
- charting and tracking results,
- and managing the local database.
The highest-impact next steps are:
- improve validation and import feedback,
- add tests + CI for parser reliability,
- strengthen docs with templates/examples/screenshots,
- and use structured AI prompts for safer, faster customization.