-
Notifications
You must be signed in to change notification settings - Fork 0
Expand SHA clinical applications with biomedical protocols and executable examples #2825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❌ Deploy Preview for stunning-zabaione-f1f1ef failed. Why did it fail? →
|
Co-authored-by: fermga <203334638+fermga@users.noreply.github.com>
…cumentation links Co-authored-by: fermga <203334638+fermga@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive clinical and biomedical documentation for the SHA (Silence) operator, along with executable example protocols. The documentation includes detailed clinical applications, expected telemetry, physiological correlates, and scientific references across six domains: cardiac coherence, trauma therapy, sleep consolidation, exercise recovery, meditation, and organizational strategy.
- Extended clinical documentation in operator definitions with cross-references to comprehensive guide
- Four executable Python examples demonstrating SHA protocols in biomedical contexts
- Comprehensive clinical applications documentation covering six domains with protocols, expected telemetry, and scientific references
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tnfr/operators/definitions.py | Added extended clinical documentation section with cross-references to comprehensive SHA guide |
| examples/biomedical/cardiac_coherence_sha.py | New executable example for HRV coherence training protocol |
| examples/biomedical/trauma_containment_sha.py | New executable example for PTSD trauma containment protocol |
| examples/biomedical/sleep_consolidation_sha.py | New executable example for sleep-dependent memory consolidation protocol |
| examples/biomedical/recovery_protocols_sha.py | New executable example for post-exercise recovery protocol |
| examples/biomedical/README.md | Overview and documentation for all biomedical examples with protocols and expected outputs |
| docs/source/examples/SHA_CLINICAL_APPLICATIONS.md | Comprehensive 878-line guide covering clinical protocols, telemetry, physiological correlates, and research applications |
Comments suppressed due to low confidence (2)
src/tnfr/operators/definitions.py:1081
- This assignment to 'theta_new' is unnecessary as it is redefined before this value is used.
theta_new = float(theta_new % (2 * np.pi))
src/tnfr/operators/definitions.py:14
- Import of 'cmath' is not used.
import cmath
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ### 1. Cardiac Coherence Training (`cardiac_coherence_sha.py`) | ||
|
|
||
| **Protocol**: `AL → IL → RA → SHA` |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol mismatch: The README documents the cardiac coherence protocol as 'AL → IL → RA → SHA' (including Resonance/RA), but the actual implementation in cardiac_coherence_sha.py uses only 'AL → IL → SHA' without the Resonance operator. The protocol documentation should match the implementation.
| **Protocol**: `AL → IL → RA → SHA` | |
| **Protocol**: `AL → IL → SHA` |
|
|
||
| ### 2. Trauma Containment (`trauma_containment_sha.py`) | ||
|
|
||
| **Protocol**: `AL → EN → OZ → SHA` |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol mismatch: The README documents the trauma containment protocol as 'AL → EN → OZ → SHA', but the actual implementation in trauma_containment_sha.py uses 'AL → EN → OZ → IL → SHA' (including Coherence/IL before SHA). The protocol documentation should match the implementation.
| **Protocol**: `AL → EN → OZ → SHA` | |
| **Protocol**: `AL → EN → OZ → IL → SHA` |
|
|
||
| ### 3. Sleep & Memory Consolidation (`sleep_consolidation_sha.py`) | ||
|
|
||
| **Protocol**: `[Day] AL → EN → IL → RA → IL` → `[Night] SHA` → `[Next Day] NAV → AL` |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol mismatch: The README documents the sleep consolidation protocol as '[Day] AL → EN → IL → RA → IL' (including Reception/EN and Resonance/RA), but the actual implementation in sleep_consolidation_sha.py uses only 'AL → IL → SHA' without Reception, Resonance, or the second Coherence. The protocol documentation should match the implementation.
| **Protocol**: `[Day] AL → EN → IL → RA → IL` → `[Night] SHA` → `[Next Day] NAV → AL` | |
| **Protocol**: `AL → IL → SHA` |
| AL → IL → RA → SHA | ||
| (Activate → Stabilize → Propagate → Preserve) |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol mismatch: The comprehensive guide documents the cardiac coherence protocol as 'AL → IL → RA → SHA' (including Resonance/RA), but the actual implementation in cardiac_coherence_sha.py uses only 'AL → IL → SHA'. The protocol should be consistent between documentation and implementation.
| AL → EN → OZ → SHA | ||
| (Activate memory → Receive emotion → Access dissonance → Contain) |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol mismatch: The comprehensive guide documents the trauma containment protocol as 'AL → EN → OZ → SHA', but the actual implementation in trauma_containment_sha.py uses 'AL → EN → OZ → IL → SHA' (including Coherence/IL). The protocol should be consistent between documentation and implementation.
| [Sleep] SHA | ||
| [Awake/Recall] NAV → AL | ||
| ``` | ||
|
|
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol mismatch: The comprehensive guide documents the sleep consolidation learning phase as 'AL → EN → IL → RA → IL' (including Reception/EN, Resonance/RA, and second Coherence/IL), but the actual implementation in sleep_consolidation_sha.py uses only 'AL → IL → SHA'. The protocol should be consistent between documentation and implementation, or explain why the simplified version is used.
| > **Note:** | |
| > The above protocol describes the comprehensive theoretical sequence for sleep consolidation (`AL → EN → IL → RA → IL → SHA`). | |
| > However, the current implementation in `sleep_consolidation_sha.py` uses a simplified protocol: | |
| > ``` | |
| > [Awake/Learning] AL → IL | |
| > [Sleep] SHA | |
| > [Awake/Recall] NAV → AL | |
| > ``` | |
| > This simplification omits the Reception (EN), Resonance (RA), and second Coherence (IL) steps for practical reasons, focusing on the core transitions most relevant to the modeled process. |
Pull Request: SHA Clinical Applications Expansion
🎯 Intent
Expand SHA (Silence) operator documentation with detailed clinical protocols and executable biomedical examples, enabling researchers and practitioners to apply TNFR structural operators in real-world therapeutic, neuroscientific, and physiological contexts.
🔧 Changes
Type of Change:
Documentation Created:
docs/source/examples/SHA_CLINICAL_APPLICATIONS.md(33KB): Comprehensive clinical protocols with 6 detailed applications:Each protocol includes: step-by-step TNFR sequences, expected telemetry (EPI, νf, ΔNFR), physiological correlates, clinical outcomes, research applications, mathematical models, and peer-reviewed references.
Executable Examples Created:
examples/biomedical/directory with 4 working Python scripts:cardiac_coherence_sha.py- AL → IL → SHA sequencetrauma_containment_sha.py- AL → EN → OZ → IL → SHA sequencesleep_consolidation_sha.py- AL → IL → SHA sequencerecovery_protocols_sha.py- AL → VAL → OZ → IL → SHA sequenceAll scripts use valid Grammar 2.0 sequences and demonstrate SHA's role in pattern preservation (νf → 0, EPI intact).
examples/biomedical/README.md: Usage instructions, expected outputs, scientific referencesCode Updates:
Silenceclass docstring insrc/tnfr/operators/definitions.pywith direct links to clinical documentation and executable examplesExample Usage:
🔬 Structural Impact
Operators Involved:
Affected Invariants:
Metrics Impact:
✅ Quality Checklist
Code Quality:
TNFR Canonical Requirements:
Testing:
Documentation:
Silencedocstring enhanced)examples/biomedical/README.md)Security:
🧪 Testing Evidence
Test Coverage:
Testing all biomedical examples... → cardiac_coherence_sha.py ✓ PASS → trauma_containment_sha.py ✓ PASS → sleep_consolidation_sha.py ✓ PASS → recovery_protocols_sha.py ✓ PASS All tests complete!Security Scan:
🔗 Related Issues
Closes #[issue_number] - Expand SHA clinical use cases and biomedical applications
📋 Additional Context
Key Distinction - SHA as Containment vs. Resolution:
The trauma therapy protocol demonstrates a critical SHA pattern: containment of high ΔNFR without resolution. This models protective pauses in therapy where distress is "held" (νf → 0) without suppression (ΔNFR remains high, material accessible), enabling safe session termination before deeper processing (THOL/ZHIR) in future sessions.
Cross-Domain Synthesis:
Documentation identifies common SHA patterns across all 6 domains:
Research-Ready:
All protocols include testable predictions, expected telemetry ranges, and peer-reviewed references (McCraty & Shaffer 2015, van der Kolk 2015, Tononi & Cirelli 2014, Kellmann et al. 2018).
For Extension Contributors
Extension-Specific Checks:
Community Pattern Checks:
Reviewer Notes
All changes are documentation and examples only. No core TNFR functionality modified. Examples demonstrate proper Grammar 2.0 sequence construction and SHA's preservation semantics (νf → 0, EPI intact, ΔNFR contained).
Original prompt
This section details on the original issue you should resolve
<issue_title>[SHA Documentation] Expandir casos de uso clínicos y aplicaciones biomédicas</issue_title>
<issue_description>## Contexto
La documentación actual de SHA en
definitions.pyincluye casos de uso generales, pero carece de ejemplos clínicos detallados y protocolos terapeuticos que serían valiosos para investigadores biomédicos.Casos de Uso Actuales (Básicos)
Biomedical (definitions.py)
Casos de Uso Ampliados Propuestos
A. Terapia de Coherencia Cardiaca (HRV)
Protocolo: Consolidación de Coherencia
Contexto clínico:
Paciente logra estado de coherencia cardiaca (HRV coherente) mediante respiración guiada. SHA se usa para consolidar el patrón antes de finalizar sesión.
Secuencia TNFR:
Ejemplo de código:
Telemetría esperada:
B. Terapia de Trauma (Contencion Protectora)
Protocolo: OZ → SHA (Disonancia Contenida)
Contexto clínico:
Paciente con PTSD accede a memoria traumática (OZ: alta disonancia). Terapeuta induce SHA para contener activación emocional excesiva, previniendo retraumatización.
Secuencia TNFR:
Ejemplo de código:
Notas clínicas:
C. Neurociencia: Consolidación de Memoria (Sleep)
Protocolo: Aprendizaje → Sueño → Memoria
Contexto neurocientífico:
Durante sueño profundo, neuronas reducen actividad (νf → 0) mientras consolidan patrones aprendidos. SHA modela este proceso.
Secuencia TNFR:
Ejemplo de código:
Correlación neurocientífica:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.