Worked Examples
Developer reference for survey instrument validity — Catalyst Grit
Develop and audit survey-validity workflows in Catalyst Grit using versioned instrument contracts, reproducible Python scoring, and automated security tests. This developer reference covers measurement integrity, privacy, source provenance, missing data, psychometric limitations, and human-reviewed publication requirements.
Application: Catalyst Grit
Status: Substantive developer guidance — verification pending
Component: Research Governance / Survey Instrument Validity
Source-reviewed software: v2.0.0, pinned source commit
Last verified installed version: Not established
Header summary: Develop and audit survey-validity workflows in Catalyst Grit using versioned instrument contracts, reproducible Python scoring and security-negative tests. This guide separates software correctness from psychometric validity, with explicit safeguards for consent, source integrity, missing data and publication review.
Goal
Implement a defensible engineering workflow for examining whether a versioned survey’s questions and scoring rules are consistent with its stated construct, population, time window and intended interpretation. The immediate outcome is a reproducible, privacy-preserving validation-readiness report, not a declaration that the questionnaire is scientifically valid.
Acceptance criterion: the instrument blueprint, pilot provenance, scoring and exclusion rules, response completeness, uncertainty, known limitations, independent review status and allowed score use are preserved as distinct evidence. A valid software pipeline must reject wrong versions, unauthorized access, duplicate/conflicting submissions, broken source integrity and unreviewed publication.
Requirements
- Python 3.10 or newer; no third-party libraries required for the packaged local adapter. A terminal and permission to read only the synthetic ZIP are sufficient.
- A documented construct definition, target population, administration mode, recall period and intended use, plus a versioned question-and-response-option map.
- Item scoring keys, reverse-coding rules, missing-value handling, a consistent participant-wave key and an explicit minimum-data/reporting plan.
- Authorization for any real study, including human-subjects/ethics review where applicable, consent or other valid basis, instrument licensing, project access and retention policy.
- Access to an appropriate independent psychometric reviewer for real claims. Statistical code, an error-free API or an apparently high alpha cannot substitute for validity evidence.
Use only the fictional fixtures supplied with this package unless an approved protocol and security configuration explicitly authorize a different dataset.
Software verification status
Source reviewed: Catalyst Grit v2.0.0 at commit f9617160ffd276c6a6fd847b1e846bb5f73b07ae, using the versioned README and the v2.0.0 OpenAPI contract. The repository documents private records, read/write/review scopes, append-only provenance and governed publication. It does not establish that a survey-validity endpoint, the JSON contract below or the example commands are deployed in Catalyst Grit.
Last verified installed version: Not established. Last source-reviewed version: v2.0.0. Set the Knowledge Base editorial field only after independently confirming the installed build and staging checks; writing a version in this article does not satisfy that control.
Data model and contract boundaries
The developer reference separates five artifacts:
| Artifact | Purpose | Required provenance |
|---|---|---|
| Instrument blueprint | Construct, intended use, questions, response choices and scoring rules | instrument_id, immutable version, checksum, owner |
| Response data | Participant-wave observations; missingness remains explicit | Project scope, pseudonymous key, collection authorization, source checksum |
| Scientific evidence register | Content, response-process, structure, reliability, fairness and interpretation evidence | Method, limitations, status, source, reviewer, date |
| Evaluation event | Scoring request, schema version, expected revision, idempotency key and source hashes | Actor, tenant/project, payload digest, audit revision |
| Review/publication decision | Human decision about appropriate reporting and permitted release | Named reviewer, decision status, redaction approval, append-only history |
The package’s fixtures/developer_contract.json is a proposed teaching contract; its identifiers and permission strings are not confirmed Catalyst Grit API fields.
Survey design and scientific scope
The original five scored items (Q1–Q5) illustrate perceived recovery-planning support, not clinical recovery or an established psychological trait. Q5 is reverse coded using 6 − response. Context questions C1 and C2 are excluded from the scored composite. The fictional participants answer on a five-point ordinal response scale at baseline (T0) and follow-up (T1).
For an actual scientific study, document the construct domain and item blueprint before analyzing response patterns. Require appropriate content review by subject-matter experts and representatives of the intended population; investigate whether participants understand each item as intended. The evidence register explicitly records these studies as pending, not completed.
Fictional research dataset and expected outputs
| Measure | T0 | T1 |
|---|---|---|
| Fictional participant responses | 48 | 48 |
| Complete five-item records | 46 | 44 |
| Missing/incomplete records | 2 | 4 |
| Exploratory alpha (synthetic) | 0.9723 | 0.9543 |
Across both waves, 42 fictional participants have complete paired five-item responses. Strong simulated internal consistency and test–retest correlation are intentional characteristics of the generated fixtures and do not prove factor structure, construct validity, invariance or meaningful clinical change. No actual participants are represented.
Procedure
- Define the target: record the construct, time window, context of use, population, permissible interpretation, excluded uses and instrument license.
- Freeze the blueprint: assign an instrument ID, version, item keys, scoring direction, response range and missingness rule; obtain a source hash before analysis.
- Authorize collection: verify the actual study’s consent/ethics and project scope outside the local demonstration. Separate participant identifiers and protect collection logs.
- Validate each row: require a unique participant-wave combination, exact version, expected project, approved scope, supported response values (1–5) and explicit missing entries.
- Score conservatively: reverse-code Q5 with
6-x; omit C1/C2 from the score; compute a five-item mean only for complete cases in this demonstration. - Report denominators: count valid, missing and paired records at each wave; never code missing as zero or quietly carry scores forward.
- Inspect, but do not overclaim: calculate descriptive statistics, corrected item–total correlations and alpha; document their assumptions and the absence of independent structural-validity evidence.
- Register evidence gaps: plan expert/participant content review, cognitive interviews, factor analysis on suitable real data, subgroup invariance, convergent/discriminant hypotheses, retest agreement and responsiveness.
- Preserve computation provenance: record actor, project, expected revision, idempotency key, source hashes and review state in an append-only system where supported.
- Review before release: require real scientific and security approvals and a redacted artifact; local success does not change a draft into an approved instrument.
Terminal setup and reproducible baseline
# Run from the extracted package directory
python3 --version
python3 code/survey_validity.py audit
python3 code/survey_validity.py score
python3 code/scientific_survey_validation.py validate
python3 code/developer_survey_validity.py contract
python3 code/developer_survey_validity.py evaluate
python3 code/developer_survey_validity.py manifest
python3 -m unittest discover -s tests -v
Expected contract output includes "status": "offline_contract_pass", "research_validity_established": false and "deployed_api_verified": false. The reference uses the Python standard library and deliberately avoids remote calls, WordPress credentials and participant PII.
Executable contract illustration
{
"contract_version": "sc-survey-validation-reference/1.0",
"mode": "fictional_educational_only",
"project_id": "SYNTHETIC-ONLY",
"instrument_id": "FICTIONAL-RESEARCH-CHECKIN-001",
"instrument_version": "0.1.0-prototype",
"request": {
"operation": "evaluate",
"event_id": "fictional-event-001",
"idempotency_key": "fictional-evaluation-001",
"expected_revision": "rev-001",
"current_revision": "rev-001"
},
"evaluation": {
"reverse_coded_items": ["Q5"],
"unscored_context_items": ["C1", "C2"],
"missingness": "complete_case_no_automatic_imputation"
},
"publication": {"status": "draft", "reviewer_approved": false}
}
This is an abridged teaching example, not a complete request: the actual fixture also includes full actor/tenant permissions, source hashes, payload digest, privacy policy, and audit data. To run the contract validator, use the complete fixtures/developer_contract.json.
Reference Python implementation
# Illustrative excerpt from code/developer_survey_validity.py
if q.get("expected_revision") != q.get("current_revision"):
issue("STALE_REVISION")
if q.get("previous_key_payload_hash") not in (None, q.get("payload_hash")):
issue("IDEMPOTENCY_CONFLICT")
if eval.get("reverse_coded_items") != ["Q5"]:
issue("REVERSE_SCORING_CONTRACT_MISMATCH")
if pub.get("status") == "approved" and not pub.get("reviewer_approved"):
issue("PUBLICATION_BYPASS")
The full module additionally compares source SHA-256 digests against local files, verifies private scopes, checks the original scoring/data validator, checks the scientific evidence register, and returns machine-readable diagnostic codes. These are reference error codes, not verified production API responses.
Fault injection: instrument and data integrity
# Detect changed scoring rules and falsified response integrity
python3 code/developer_survey_validity.py inject --case wrong_reverse_key
python3 code/developer_survey_validity.py inject --case impute_missing_zero
python3 code/developer_survey_validity.py inject --case bad_response_hash
python3 code/developer_survey_validity.py inject --case wrong_instrument_version
python3 code/developer_survey_validity.py inject --case changed_original_response
# Run all 54 new developer fault cases
python3 code/developer_survey_validity.py matrix
Injected errors must be detected and reported without altering the baseline fixtures. A corrupt source, unexpected item response, mismatched instrument version or inconsistent scoring key blocks acceptance pending a versioned correction.
Fault injection: permissions and state
python3 code/developer_survey_validity.py inject --case wrong_tenant
python3 code/developer_survey_validity.py inject --case wrong_project
python3 code/developer_survey_validity.py inject --case missing_scope
python3 code/developer_survey_validity.py inject --case stale_revision
python3 code/developer_survey_validity.py inject --case idempotency_conflict
python3 code/developer_survey_validity.py inject --case audit_outage
python3 code/developer_survey_validity.py inject --case public_restricted_export
python3 code/developer_survey_validity.py inject --case approved_without_review
python3 code/developer_survey_validity.py inject --case claim_alpha_validity
Do not retry stale or conflicting writes as new research events without reconciling the revision and unique event identity. For sensitive data, failed audit recording, unauthorized scope, or missing review must fail closed.
Psychometric validity evidence required
| Evidence family | What developers can verify | What independent research must establish |
|---|---|---|
| Content validity | Item blueprint, version, reviewer record presence | Relevance, comprehensiveness and comprehensibility with experts and intended users |
| Response processes | Interview metadata, accessibility issue tracking | Actual comprehension, translation quality and cognitive interview results |
| Structural validity | Reproducible model inputs/results and assumptions | Defensible dimensional model in adequate real samples |
| Internal consistency | Correctly calculated alpha/other metrics with sample and CI | Interpretability of consistency conditional on sound structure |
| Construct hypotheses | Prespecification, instrument licensing and external-variable mapping | Convergent/discriminant and relevant criterion evidence |
| Invariance/fairness | Comparison plans, group rules and missingness audit | Sufficient sample and appropriate DIF/invariance analyses |
| Responsiveness | Version-consistent retest inputs, intervals and calculations | Meaningful change, measurement error and stability assumptions |
| Consequences | Controlled publication and downstream-use restrictions | Human review of benefit, bias, harm and intended score uses |
The 2024 COSMIN guideline, version 2.0 emphasizes assessing different measurement properties rather than relying on a single statistic. The AERA/APA/NCME Standards for Educational and Psychological Testing also treat validity as evidence supporting particular score interpretations and uses.
Missing observations and interpretation boundaries
In the supplied fictional pilot, 46 of 48 T0 response records and 44 of 48 T1 records have complete five-item scores; 42 paired fictional IDs are complete at both waves. The scoring adapter calculates a complete-case average, never imputes a zero, and reports item-wise missingness. Analyses of missingness in real studies must consider potential selection, nonresponse mechanisms and the estimand before any inference.
Extremely high synthetic alpha and a strong Pearson test–retest correlation do not establish unidimensionality, construct relevance or longitudinal invariance. Factor analysis, independent content interviews, clinical thresholds and employment/personality uses are not validated by this ZIP. No participant-level score should be used for diagnosis, employee screening, eligibility or automated ranking.
Access controls, idempotency and provenance
The proposed contract binds actor_id, tenant_id, project_id, explicit permissions, instrument/revision IDs and source file digests to an evaluation event. idempotency_key paired with payload_hash is designed to reject the same key reused for different content; a stale expected revision is rejected rather than silently overwriting evidence.
For actual deployment, implement authorization and transactionality in server code, not merely client-side JSON validation. Keep audit entries append-only and protect token material, identifiers and raw responses from public logs. The local adapter cannot validate database race conditions or real server enforcement.
Symptoms
| Observed symptom | Developer evidence to inspect |
|---|---|
| Alpha changes between identical runs | Item order, reverse-coding version, source hash, data selection and dependency versions |
| Responses scored despite missing Q1–Q5 | Missingness rule, parser behavior, schema and complete-case denominator |
| Survey output appears under wrong project | Actor, tenant, project, token scope and record lineage |
| Old or changed instrument used with new responses | Instrument version, digest, participant-wave pairing and migration history |
| Draft reported as validated | Review state, source evidence register and approval/publishing transition |
| Public export contains private item-level data | Export scopes, redaction, publication gate and incident logs |
Cause
Common causes include a changed reverse-coding key; parser conflation of missing, zero and invalid response values; duplicated participant-wave rows; inconsistent source versions; mistaken cross-project authorization; stale optimistic-lock revisions; incomplete append-only audit records; and application code inferring scientific validity from a numerically stable statistic.
These are candidate causes until inspected against actual source, logs and staging behavior. Do not assign blame or infer a defect from the reference fixtures alone.
Troubleshooting
- Run
python3 code/developer_survey_validity.py contract. Confirm the clean fixture passes and reportsresearch_validity_established: false. - Run
manifestand compare the instrument, CSV, registry and contract SHA-256 digests to the original release manifest. - Run the original
survey_validity.py auditto distinguish invalid responses from missing data and version mismatches. - Run
scientific_survey_validation.py evidence-matrixto distinguish actual evidence gaps from numerical/scoring failures. - Reproduce a single named negative case with
inject --case ..., saving only synthetic inputs and nonsecret error codes. - Compare actor permissions, tenant and project IDs, event identity, prior idempotency payload and expected/current revisions.
- Confirm that publication remains a draft with no clinically valid, real participant or automated people-decision claims.
- Escalate unresolved privacy breaches, contradictory permissions, or invalid publication decisions before further processing.
Resolution
- Preserve evidence: store the failing test case, source file hashes, schema and software versions, redacted logs and canonical record identifiers. Do not edit or delete original participant data as a repair shortcut.
- Correct the smallest boundary: fix the relevant mapping, reverse-key, access-control rule, revision check, export gate or reviewer decision using a new versioned change.
- Invalidate unsafe outputs: quarantine or withdraw unapproved report outputs, invalidate stale caches, and document whether downstream consumers received an affected artifact.
- Retest at the right level: run unit/fault tests, then real staging auth, transactional concurrency, audit append and export-redaction checks under approved credentials.
- Reanalyze with appropriate scientific governance: a corrected score does not independently justify validity claims; update the evidence register and commission expert/participant review as needed.
- Release only after human review: record the disposition, rollback plan, authorized acceptance and remaining uncertainty; maintain the audit trail.
Verification
Run the complete local test suite and check all three layers separately: (a) survey scoring/data quality, (b) scientific-evidence readiness, and (c) the proposed developer contract. Acceptance requires no unexpected errors, all negative cases detected, no private export, no publication bypass and no unsupported psychological claims.
python3 code/developer_survey_validity.py contract
python3 code/developer_survey_validity.py matrix
python3 code/developer_survey_validity.py review-gate
python3 -m unittest discover -s tests -v
sha256sum fixtures/fictional_instrument.json fixtures/fictional_responses.csv
Expected: a clean contract passes; the developer matrix detects its 54 injected cases; the review gate remains publication_blocked because substantive real-world validation evidence is absent. Additional inherited modules provide 30 original survey faults and 32 scientific-evidence faults.
Staging acceptance matrix
The ZIP includes docs/STAGING_ACCEPTANCE.md with explicit open checks covering actual build/version identification, isolated tenant access, secrets and audit-log redaction, migration/version mismatch, duplicate and concurrent event submissions, authorized exports, human publication review and independent psychometric review. These checks are not completed merely because the offline tests passed.
Source-reviewed repository references
- Catalyst Grit README — release description and governance boundary.
- OpenAPI v2.0.0 — scoped records, audits and publication contract.
- Persistent workspace — private record history, retention and purge.
- Methodology profile — evidence versus assumptions and human interpretation limits.
- Institutional API — bearer scopes, project allowlists, audit.
- Connected platform — artifact provenance, human review and decision guardrails.
Source inspection is not installation verification. The external URLs describe the software repository at one reviewed commit. The package’s developer_survey_validity.py is supplied here; it is not a repository endpoint or claimed official CLI command.
Reporting and editorial metadata
Report the construct and intended use, instrument version and license, recruitment and exclusion criteria, per-wave and paired denominators, missingness, all transformations, estimates with appropriate uncertainty, limitations, privacy authorization and unresolved validity evidence. Keep public examples separate from restricted evidence.
Application: Catalyst Grit
Primary component: Research Governance
Subcomponent: Survey Instrument Validity
Article type: Developer reference
Last source-reviewed version: v2.0.0
Last verified installed version: Not established
Research/technical certification: Pending
Estimated reading time: 22–30 minutes.
