Documentation Generation for Talosix EDC
Domain Context
Talosix builds Electronic Data Capture systems for clinical trials. Documentation is not optional -- it is a regulatory requirement. FDA 21 CFR Part 11, ICH E6(R2) GCP guidelines, and GAMP 5 all mandate thorough documentation of computerized systems used in clinical trials. Poor documentation can result in FDA warning letters, trial delays, or data rejection.
Documentation Categories
1. API Documentation
Approach
- Scan the codebase for API route definitions, controllers, and endpoint handlers.
- Extract request/response schemas, HTTP methods, URL patterns, and authentication requirements.
- Document query parameters, path parameters, request bodies, and response formats.
- Include error response codes and their meanings.
EDC-Specific API Concerns
- Document which endpoints trigger audit trail entries.
- Note endpoints that require electronic signatures (21 CFR Part 11).
- Identify endpoints that handle Protected Health Information (PHI) and their access controls.
- Document rate limits, especially for data export and integration endpoints used by clinical sites.
- Flag endpoints used by external systems (CTMS, IVRS/IWRS, lab systems).
Output Format
## POST /api/v1/studies/{studyId}/subjects/{subjectId}/forms/{formId}/data
**Description**: Submit or update form data for a subject visit.
**Authentication**: Bearer token (JWT). Requires role: DataEntry or Investigator.
**Audit Trail**: Yes. Records field-level changes with old/new values, user, timestamp.
**Parameters**:
| Name | In | Type | Required | Description |
|------|-----|------|----------|-------------|
| studyId | path | UUID | yes | Study identifier |
| subjectId | path | string | yes | Subject number |
| formId | path | UUID | yes | Form definition ID |
**Request Body**: JSON object with field values keyed by field OID.
**Responses**:
| Code | Description |
|------|-------------|
| 200 | Data saved successfully |
| 409 | Conflict - data modified by another user |
| 422 | Validation errors - edit checks failed |
2. Architecture Documentation
Approach
- Analyze project structure, configuration files, and infrastructure code.
- Identify services, databases, message queues, caches, and external integrations.
- Map data flows between components.
- Document technology stack and version requirements.
Structure
- System Overview: High-level description of the EDC platform and its role in clinical trials.
- Component Diagram: Services, databases, and their interactions.
- Data Flow Diagrams: How clinical data moves from site entry to database to export.
- Integration Points: Connections to external systems (CTMS, randomization, lab, safety).
- Security Architecture: Authentication, authorization, encryption at rest and in transit.
- Infrastructure: Cloud provider, regions, availability zones, disaster recovery.
- Audit Architecture: How the audit trail is implemented, stored, and protected from modification.
EDC-Specific Architecture Concerns
- Document the audit trail implementation (append-only tables, triggers, application-level).
- Describe the electronic signature workflow and its compliance with 21 CFR Part 11.
- Map the data flow for regulatory submissions (define.xml, CDISC datasets).
- Document multi-tenancy approach and data isolation between sponsors/studies.
- Describe backup and recovery procedures with recovery time/point objectives.
3. Runbooks
Approach
- Identify operational procedures from deployment scripts, monitoring configurations, and incident history.
- Document step-by-step procedures for common operational tasks.
- Include troubleshooting decision trees.
Standard Runbook Structure
# Runbook: [Procedure Name]
## Purpose
What this procedure accomplishes and when to use it.
## Prerequisites
- Access requirements
- Tools needed
- Approvals required (change control for production)
## Procedure
1. Step-by-step instructions
2. Include exact commands with placeholders
3. Expected output at each step
4. Verification steps
## Rollback
How to reverse the procedure if something goes wrong.
## Escalation
Who to contact if the procedure fails.
Essential EDC Runbooks
- Database failover: Steps to promote a replica, with data integrity verification.
- Study environment provisioning: Creating a new study database and configuration.
- Data export for regulatory submission: Generating compliant export packages.
- User access review: Periodic review of active users and their roles.
- Incident response: Steps for investigating and containing data integrity issues.
- Audit trail verification: Confirming audit trail completeness and integrity.
- Certificate rotation: Updating SSL/TLS certificates without downtime.
- Backup restoration and verification: Testing backup restores with data integrity checks.
4. Compliance Documentation
IQ (Installation Qualification)
- Documents that the system is installed correctly per specifications.
- Generate from: deployment logs, infrastructure-as-code outputs, environment configurations.
- Content includes:
- Hardware/infrastructure specifications and verification.
- Software component versions and checksums.
- Network configuration and connectivity verification.
- Security configuration (firewalls, access controls, encryption).
- Backup configuration verification.
OQ (Operational Qualification)
- Documents that the system operates correctly under expected conditions.
- Generate from: automated test results, integration test reports.
- Content includes:
- Functional test results mapped to requirements.
- Security testing results (authentication, authorization, session management).
- Audit trail verification test results.
- Electronic signature workflow test results.
- Data validation and edit check test results.
- Boundary and negative test results.
PQ (Performance Qualification)
- Documents that the system performs as expected in its production environment.
- Generate from: production monitoring data, user acceptance test results.
- Content includes:
- Performance benchmarks under expected load.
- End-to-end workflow verification by business users.
- Data migration verification (if applicable).
- Integration verification with external systems.
Traceability Matrix
- Map user requirements to functional specifications to test cases to test results.
- Generate by scanning requirement IDs in code comments, test names, and documentation.
- Format:
| Requirement ID | Description | Test Case(s) | Result | Evidence |
|---------------|-------------|--------------|--------|----------|
| REQ-AUTH-001 | Users must authenticate with username and password | TC-AUTH-001, TC-AUTH-002 | Pass | test-report-v2.3.pdf |
| REQ-AUDIT-001 | All data changes must be recorded in audit trail | TC-AUDIT-001 through TC-AUDIT-015 | Pass | test-report-v2.3.pdf |
Generation Workflow
Step 1: Codebase Analysis
- Scan for route/controller files to identify API endpoints.
- Read configuration files (docker-compose, k8s manifests, terraform) for architecture.
- Find test files and extract test descriptions and coverage.
- Locate existing documentation and assess currency.
Step 2: Content Extraction
- Parse code comments, docstrings, and annotations.
- Extract type definitions, interfaces, and schemas.
- Read migration files for database schema understanding.
- Analyze error handling for error code documentation.
Step 3: Documentation Assembly
- Organize extracted information into the appropriate template.
- Cross-reference between documents for consistency.
- Flag gaps where documentation cannot be generated from code alone.
- Mark sections that require manual review or human input.
Step 4: Quality Checks
- Verify all API endpoints are documented.
- Check that documented interfaces match actual code.
- Validate that compliance references are accurate.
- Ensure runbook commands are syntactically correct.
Style Guidelines
- Use clear, unambiguous language. Avoid jargon that regulators may not understand.
- Include version numbers and dates on all documents.
- Use consistent terminology (align with CDISC, ICH, and FDA glossaries).
- Mark draft documents clearly. Only finalized documents enter the quality system.
- Keep paragraphs short. Use tables and lists for structured information.
- Include diagrams described in text (Mermaid, PlantUML) that can be rendered.
When Applying This Skill
- Determine which documentation type is needed.
- Scan the relevant parts of the codebase using Grep and Glob.
- Read key files to extract detailed information.
- Assemble the documentation following the templates and structure above.
- Note any gaps or areas requiring manual input.
- If generating compliance documentation, explicitly state which regulatory requirements are addressed.
1---2name: documentation-generation3description: Generate technical documentation from Talosix EDC codebases including API docs, architecture docs, runbooks, and GxP compliance documentation with IQ/OQ/PQ references.4---56# Documentation Generation for Talosix EDC78## Domain Context910Talosix builds Electronic Data Capture systems for clinical trials. Documentation is not optional -- it is a regulatory requirement. FDA 21 CFR Part 11, ICH E6(R2) GCP guidelines, and GAMP 5 all mandate thorough documentation of computerized systems used in clinical trials. Poor documentation can result in FDA warning letters, trial delays, or data rejection.1112## Documentation Categories1314### 1. API Documentation1516#### Approach17- Scan the codebase for API route definitions, controllers, and endpoint handlers.18- Extract request/response schemas, HTTP methods, URL patterns, and authentication requirements.19- Document query parameters, path parameters, request bodies, and response formats.20- Include error response codes and their meanings.2122#### EDC-Specific API Concerns23- Document which endpoints trigger audit trail entries.24- Note endpoints that require electronic signatures (21 CFR Part 11).25- Identify endpoints that handle Protected Health Information (PHI) and their access controls.26- Document rate limits, especially for data export and integration endpoints used by clinical sites.27- Flag endpoints used by external systems (CTMS, IVRS/IWRS, lab systems).2829#### Output Format30```markdown31## POST /api/v1/studies/{studyId}/subjects/{subjectId}/forms/{formId}/data3233**Description**: Submit or update form data for a subject visit.3435**Authentication**: Bearer token (JWT). Requires role: DataEntry or Investigator.3637**Audit Trail**: Yes. Records field-level changes with old/new values, user, timestamp.3839**Parameters**:40| Name | In | Type | Required | Description |41|------|-----|------|----------|-------------|42| studyId | path | UUID | yes | Study identifier |43| subjectId | path | string | yes | Subject number |44| formId | path | UUID | yes | Form definition ID |4546**Request Body**: JSON object with field values keyed by field OID.4748**Responses**:49| Code | Description |50|------|-------------|51| 200 | Data saved successfully |52| 409 | Conflict - data modified by another user |53| 422 | Validation errors - edit checks failed |54```5556### 2. Architecture Documentation5758#### Approach59- Analyze project structure, configuration files, and infrastructure code.60- Identify services, databases, message queues, caches, and external integrations.61- Map data flows between components.62- Document technology stack and version requirements.6364#### Structure65- **System Overview**: High-level description of the EDC platform and its role in clinical trials.66- **Component Diagram**: Services, databases, and their interactions.67- **Data Flow Diagrams**: How clinical data moves from site entry to database to export.68- **Integration Points**: Connections to external systems (CTMS, randomization, lab, safety).69- **Security Architecture**: Authentication, authorization, encryption at rest and in transit.70- **Infrastructure**: Cloud provider, regions, availability zones, disaster recovery.71- **Audit Architecture**: How the audit trail is implemented, stored, and protected from modification.7273#### EDC-Specific Architecture Concerns74- Document the audit trail implementation (append-only tables, triggers, application-level).75- Describe the electronic signature workflow and its compliance with 21 CFR Part 11.76- Map the data flow for regulatory submissions (define.xml, CDISC datasets).77- Document multi-tenancy approach and data isolation between sponsors/studies.78- Describe backup and recovery procedures with recovery time/point objectives.7980### 3. Runbooks8182#### Approach83- Identify operational procedures from deployment scripts, monitoring configurations, and incident history.84- Document step-by-step procedures for common operational tasks.85- Include troubleshooting decision trees.8687#### Standard Runbook Structure88```markdown89# Runbook: [Procedure Name]9091## Purpose92What this procedure accomplishes and when to use it.9394## Prerequisites95- Access requirements96- Tools needed97- Approvals required (change control for production)9899## Procedure1001. Step-by-step instructions1012. Include exact commands with placeholders1023. Expected output at each step1034. Verification steps104105## Rollback106How to reverse the procedure if something goes wrong.107108## Escalation109Who to contact if the procedure fails.110```111112#### Essential EDC Runbooks113- **Database failover**: Steps to promote a replica, with data integrity verification.114- **Study environment provisioning**: Creating a new study database and configuration.115- **Data export for regulatory submission**: Generating compliant export packages.116- **User access review**: Periodic review of active users and their roles.117- **Incident response**: Steps for investigating and containing data integrity issues.118- **Audit trail verification**: Confirming audit trail completeness and integrity.119- **Certificate rotation**: Updating SSL/TLS certificates without downtime.120- **Backup restoration and verification**: Testing backup restores with data integrity checks.121122### 4. Compliance Documentation123124#### IQ (Installation Qualification)125- Documents that the system is installed correctly per specifications.126- Generate from: deployment logs, infrastructure-as-code outputs, environment configurations.127- Content includes:128 - Hardware/infrastructure specifications and verification.129 - Software component versions and checksums.130 - Network configuration and connectivity verification.131 - Security configuration (firewalls, access controls, encryption).132 - Backup configuration verification.133134#### OQ (Operational Qualification)135- Documents that the system operates correctly under expected conditions.136- Generate from: automated test results, integration test reports.137- Content includes:138 - Functional test results mapped to requirements.139 - Security testing results (authentication, authorization, session management).140 - Audit trail verification test results.141 - Electronic signature workflow test results.142 - Data validation and edit check test results.143 - Boundary and negative test results.144145#### PQ (Performance Qualification)146- Documents that the system performs as expected in its production environment.147- Generate from: production monitoring data, user acceptance test results.148- Content includes:149 - Performance benchmarks under expected load.150 - End-to-end workflow verification by business users.151 - Data migration verification (if applicable).152 - Integration verification with external systems.153154#### Traceability Matrix155- Map user requirements to functional specifications to test cases to test results.156- Generate by scanning requirement IDs in code comments, test names, and documentation.157- Format:158159```markdown160| Requirement ID | Description | Test Case(s) | Result | Evidence |161|---------------|-------------|--------------|--------|----------|162| REQ-AUTH-001 | Users must authenticate with username and password | TC-AUTH-001, TC-AUTH-002 | Pass | test-report-v2.3.pdf |163| REQ-AUDIT-001 | All data changes must be recorded in audit trail | TC-AUDIT-001 through TC-AUDIT-015 | Pass | test-report-v2.3.pdf |164```165166## Generation Workflow167168### Step 1: Codebase Analysis169- Scan for route/controller files to identify API endpoints.170- Read configuration files (docker-compose, k8s manifests, terraform) for architecture.171- Find test files and extract test descriptions and coverage.172- Locate existing documentation and assess currency.173174### Step 2: Content Extraction175- Parse code comments, docstrings, and annotations.176- Extract type definitions, interfaces, and schemas.177- Read migration files for database schema understanding.178- Analyze error handling for error code documentation.179180### Step 3: Documentation Assembly181- Organize extracted information into the appropriate template.182- Cross-reference between documents for consistency.183- Flag gaps where documentation cannot be generated from code alone.184- Mark sections that require manual review or human input.185186### Step 4: Quality Checks187- Verify all API endpoints are documented.188- Check that documented interfaces match actual code.189- Validate that compliance references are accurate.190- Ensure runbook commands are syntactically correct.191192## Style Guidelines193194- Use clear, unambiguous language. Avoid jargon that regulators may not understand.195- Include version numbers and dates on all documents.196- Use consistent terminology (align with CDISC, ICH, and FDA glossaries).197- Mark draft documents clearly. Only finalized documents enter the quality system.198- Keep paragraphs short. Use tables and lists for structured information.199- Include diagrams described in text (Mermaid, PlantUML) that can be rendered.200201## When Applying This Skill2022031. Determine which documentation type is needed.2042. Scan the relevant parts of the codebase using Grep and Glob.2053. Read key files to extract detailed information.2064. Assemble the documentation following the templates and structure above.2075. Note any gaps or areas requiring manual input.2086. If generating compliance documentation, explicitly state which regulatory requirements are addressed.