neurotcs 1.35.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. neurotcs-1.35.0/LICENSE +201 -0
  2. neurotcs-1.35.0/PKG-INFO +271 -0
  3. neurotcs-1.35.0/README.md +229 -0
  4. neurotcs-1.35.0/pyproject.toml +87 -0
  5. neurotcs-1.35.0/setup.cfg +4 -0
  6. neurotcs-1.35.0/src/neurotcs/__init__.py +233 -0
  7. neurotcs-1.35.0/src/neurotcs/__main__.py +5 -0
  8. neurotcs-1.35.0/src/neurotcs/adapters/__init__.py +44 -0
  9. neurotcs-1.35.0/src/neurotcs/audit_core/__init__.py +93 -0
  10. neurotcs-1.35.0/src/neurotcs/audit_core/__main__.py +6 -0
  11. neurotcs-1.35.0/src/neurotcs/audit_core/audit.py +572 -0
  12. neurotcs-1.35.0/src/neurotcs/audit_core/bootstrap.py +308 -0
  13. neurotcs-1.35.0/src/neurotcs/audit_core/cli.py +158 -0
  14. neurotcs-1.35.0/src/neurotcs/audit_core/scoring.py +362 -0
  15. neurotcs-1.35.0/src/neurotcs/audit_core/trajectory.py +301 -0
  16. neurotcs-1.35.0/src/neurotcs/cli.py +300 -0
  17. neurotcs-1.35.0/src/neurotcs/clinical_ranges/__init__.py +60 -0
  18. neurotcs-1.35.0/src/neurotcs/clinical_ranges/adapters/__init__.py +6 -0
  19. neurotcs-1.35.0/src/neurotcs/clinical_ranges/adapters/trial_excel.py +292 -0
  20. neurotcs-1.35.0/src/neurotcs/clinical_ranges/audit.py +447 -0
  21. neurotcs-1.35.0/src/neurotcs/clinical_ranges/loader.py +132 -0
  22. neurotcs-1.35.0/src/neurotcs/clinical_ranges/schema.py +580 -0
  23. neurotcs-1.35.0/src/neurotcs/clinical_ranges/yaml_hash.py +121 -0
  24. neurotcs-1.35.0/src/neurotcs/cross_sheet/__init__.py +56 -0
  25. neurotcs-1.35.0/src/neurotcs/cross_sheet/audit.py +1656 -0
  26. neurotcs-1.35.0/src/neurotcs/cross_sheet/loader.py +129 -0
  27. neurotcs-1.35.0/src/neurotcs/cross_sheet/schema.py +766 -0
  28. neurotcs-1.35.0/src/neurotcs/fairness/__init__.py +369 -0
  29. neurotcs-1.35.0/src/neurotcs/input_contract/__init__.py +20 -0
  30. neurotcs-1.35.0/src/neurotcs/input_contract/v1_0/SPECIFICATION.md +341 -0
  31. neurotcs-1.35.0/src/neurotcs/input_contract/v1_0/__init__.py +31 -0
  32. neurotcs-1.35.0/src/neurotcs/input_contract/v1_0/adapters/adapter_adni.py +138 -0
  33. neurotcs-1.35.0/src/neurotcs/input_contract/v1_0/schemas/manifest.schema.json +195 -0
  34. neurotcs-1.35.0/src/neurotcs/input_contract/v1_0/validate.py +394 -0
  35. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/SPECIFICATION.md +334 -0
  36. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/__init__.py +33 -0
  37. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/adapters/adapter_adni.py +42 -0
  38. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/adapters/adapter_adni_canonical.py +144 -0
  39. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/adapters/adapter_adni_volumetric.py +33 -0
  40. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/adapters/adapter_miriad.py +1257 -0
  41. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/adapters/adapter_nacc.py +201 -0
  42. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/adapters/adapter_oasis3.py +434 -0
  43. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/schemas/manifest.schema.json +201 -0
  44. neurotcs-1.35.0/src/neurotcs/input_contract/v1_1/validate.py +739 -0
  45. neurotcs-1.35.0/src/neurotcs/input_contract/v1_2/__init__.py +43 -0
  46. neurotcs-1.35.0/src/neurotcs/input_contract/v1_2/adapters/adapter_adni.py +42 -0
  47. neurotcs-1.35.0/src/neurotcs/input_contract/v1_2/adapters/adapter_adni_canonical.py +144 -0
  48. neurotcs-1.35.0/src/neurotcs/input_contract/v1_2/adapters/adapter_adni_volumetric.py +33 -0
  49. neurotcs-1.35.0/src/neurotcs/input_contract/v1_2/adapters/adapter_miriad.py +1257 -0
  50. neurotcs-1.35.0/src/neurotcs/input_contract/v1_2/adapters/adapter_nacc.py +201 -0
  51. neurotcs-1.35.0/src/neurotcs/input_contract/v1_2/adapters/adapter_oasis3.py +434 -0
  52. neurotcs-1.35.0/src/neurotcs/input_contract/v1_2/validate.py +819 -0
  53. neurotcs-1.35.0/src/neurotcs/io/__init__.py +26 -0
  54. neurotcs-1.35.0/src/neurotcs/io/readers.py +198 -0
  55. neurotcs-1.35.0/src/neurotcs/orchestration/__init__.py +0 -0
  56. neurotcs-1.35.0/src/neurotcs/orchestration/bundle.py +433 -0
  57. neurotcs-1.35.0/src/neurotcs/orchestration/orchestrator.py +332 -0
  58. neurotcs-1.35.0/src/neurotcs/orchestration/vocabulary.py +137 -0
  59. neurotcs-1.35.0/src/neurotcs/reference_adapters/__init__.py +42 -0
  60. neurotcs-1.35.0/src/neurotcs/reference_adapters/adni_categorical_submission.py +278 -0
  61. neurotcs-1.35.0/src/neurotcs/reference_adapters/adni_volumetric_submission.py +170 -0
  62. neurotcs-1.35.0/src/neurotcs/report/__init__.py +12 -0
  63. neurotcs-1.35.0/src/neurotcs/report/csv_report.py +46 -0
  64. neurotcs-1.35.0/src/neurotcs/report/pdf_report.py +145 -0
  65. neurotcs-1.35.0/src/neurotcs/report/svg_report.py +144 -0
  66. neurotcs-1.35.0/src/neurotcs/rulepack/__init__.py +58 -0
  67. neurotcs-1.35.0/src/neurotcs/rulepack/loader.py +172 -0
  68. neurotcs-1.35.0/src/neurotcs/rulepack/rules/ad/aa_2024.yaml +628 -0
  69. neurotcs-1.35.0/src/neurotcs/rulepack/rules/ad/aa_2024_trac.yaml +264 -0
  70. neurotcs-1.35.0/src/neurotcs/rulepack/rules/ad/at_biological.yaml +165 -0
  71. neurotcs-1.35.0/src/neurotcs/rulepack/rules/ad/niaaa_2018.yaml +310 -0
  72. neurotcs-1.35.0/src/neurotcs/rulepack/schema.py +733 -0
  73. neurotcs-1.35.0/src/neurotcs/sample_size/__init__.py +554 -0
  74. neurotcs-1.35.0/src/neurotcs/scanner_factorial/__init__.py +176 -0
  75. neurotcs-1.35.0/src/neurotcs/silent_deployment/__init__.py +256 -0
  76. neurotcs-1.35.0/src/neurotcs/threshold_derivation/__init__.py +202 -0
  77. neurotcs-1.35.0/src/neurotcs.egg-info/PKG-INFO +271 -0
  78. neurotcs-1.35.0/src/neurotcs.egg-info/SOURCES.txt +80 -0
  79. neurotcs-1.35.0/src/neurotcs.egg-info/dependency_links.txt +1 -0
  80. neurotcs-1.35.0/src/neurotcs.egg-info/entry_points.txt +3 -0
  81. neurotcs-1.35.0/src/neurotcs.egg-info/requires.txt +18 -0
  82. neurotcs-1.35.0/src/neurotcs.egg-info/top_level.txt +1 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Marufjon Salokhiddinov, MD PhD
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: neurotcs
3
+ Version: 1.35.0
4
+ Summary: Citation-locked, fail-closed longitudinal medical AI audit framework (NeuroTCS / temporalmetric).
5
+ Author-email: "Marufjon Salokhiddinov, MD PhD" <drmaruf1991@gmail.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/DrMaruf1991/NeuroTCS
8
+ Project-URL: Repository, https://github.com/DrMaruf1991/NeuroTCS
9
+ Project-URL: Issues, https://github.com/DrMaruf1991/NeuroTCS/issues
10
+ Keywords: medical-ai,longitudinal,audit,clinical-trial,regulatory,neuroimaging,alzheimer,alzheimers-disease,dementia,amyloid,tau,cdr,mci,fda,fhir
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Healthcare Industry
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: pydantic>=2.5
26
+ Requires-Dist: PyYAML>=6.0
27
+ Requires-Dist: pandas>=2.0
28
+ Requires-Dist: pyarrow>=14.0
29
+ Requires-Dist: openpyxl>=3.1
30
+ Requires-Dist: reportlab>=4.0
31
+ Requires-Dist: jsonschema>=4.0
32
+ Requires-Dist: pyreadr>=0.4.7
33
+ Requires-Dist: numpy>=1.24
34
+ Requires-Dist: scipy>=1.11
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=7.4; extra == "dev"
37
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
38
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
39
+ Provides-Extra: fhir
40
+ Requires-Dist: fhir.resources>=7.0; extra == "fhir"
41
+ Dynamic: license-file
42
+
43
+ # NeuroTCS
44
+
45
+ **Citation-locked, fail-closed longitudinal medical AI audit framework.**
46
+
47
+ [![CI](https://github.com/DrMaruf1991/NeuroTCS/actions/workflows/ci.yml/badge.svg)](https://github.com/DrMaruf1991/NeuroTCS/actions/workflows/ci.yml)
48
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
49
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
50
+ [![Version 1.33.1](https://img.shields.io/badge/version-1.33.1-success.svg)](CHANGELOG.md)
51
+ [![Tests 1437](https://img.shields.io/badge/tests-1437%20passed-success.svg)](tests/)
52
+ [![Spec v1.7 FINAL](https://img.shields.io/badge/spec-v1.7_FINAL-success.svg)](docs/spec/temporalmetric_v1.7_FINAL.md)
53
+
54
+ NeuroTCS audits the temporal coherence of longitudinal medical AI predictions against internationally endorsed published clinical guidelines. It answers the question regulators, hospitals, and trialists ask first: *does this AI model's visit-to-visit prediction trajectory obey the clinical biology it claims to predict?*
55
+
56
+ The framework is anchored on Dr. Marufjon Salokhiddinov's ASNR 2026 presentation (Austin, May 2026) and the temporalmetric v1.7 FINAL technical specification.
57
+
58
+ ## Hallmark result — four-cohort triangulation lock
59
+
60
+ Five locked audit invariants reproduce byte-exactly across N=5 cold reruns, numpy 2.0.2↔2.4.4, pyreadr 0.5.0↔0.5.6, on Linux and Windows. Max pairwise ΔcTCS = 0.009206 (ADNI vs MIRIAD), all 6 pairwise comparisons ≤ 0.01 world-class threshold.
61
+
62
+ | Cohort | n_scored / n_total | Transitions | Flagged | cTCS | audit_id |
63
+ |---|---:|---:|---:|---:|---|
64
+ | OASIS-3 (Aim 2 external replication) | 1,377 | 7,248 | 30 (0.41%) | **0.994191** | `92df5429...` |
65
+ | ADNI-2/3/4 (Aim 1, canonical R-format) | 2,958 / 3,762 | 12,006 | 65 (0.54%) | **0.994575** | `7a973f7b...` |
66
+ | NACC UDS v73 (added v1.8) | 39,361 / 56,529 | 158,423 | 1,217 (0.77%) | **0.991502** | `58329c65...` |
67
+ | MIRIAD longitudinal (Aim 3 A) | 69 | 454 | 7 (1.54%) | **0.985369** | `abda26cb...` |
68
+ | MIRIAD test-retest (Aim 3 B) | 69 (pairs) | 69 | 0 (0.00%) | **1.000000** | `4de7f711...` |
69
+
70
+ Each cohort also locks an `audit_id_v2` (C6 collision-resistant variant). See `tests/audit_core/test_real_*.py` for full locked-invariant constants, and [`docs/datasheet/ad_neurotcs_datasheet.md`](docs/datasheet/ad_neurotcs_datasheet.md) Section A for full audit_ids and methodology.
71
+
72
+ The cTCS metric generalises across institution, decade, recruitment criteria, AND staging instrument. Three of the four cohorts use CDR-anchored staging; MIRIAD uses MMSE-anchored staging. The 4-cohort agreement at ≤0.01 ΔcTCS is the strongest cross-cohort evidence to date that the framework measures what it claims to measure.
73
+
74
+ ## What's in this repo
75
+
76
+ NeuroTCS is the umbrella for seven engineering pieces plus five v1.7.0 methodological modules. Pieces 1–4 + 6 are production-shipped; Pieces 5 and 7 are roadmap items planned for v1.9.x (importing them raises a helpful `ImportError` pointing to the roadmap).
77
+
78
+ | Piece | Subpackage | Status | Description |
79
+ |---|---|---|---|
80
+ | 1 | `neurotcs.input_contract.v1_0` | ✅ shipped | Categorical input contract (8-step validation, fail-closed) |
81
+ | 2 | `neurotcs.input_contract.v1_1` | ✅ shipped | Continuous-biomarker contract with UCUM unit enforcement |
82
+ | 3 | `neurotcs.rulepack` | ✅ shipped | **3 production AD rule packs** (NIA-AA 2018, AA 2024, AA 2024 TRAC) |
83
+ | 4 | `neurotcs.audit_core` | ✅ shipped | cTCS / pTCS / uTCS engine + cluster bootstrap + BCa + Huber |
84
+ | 5 | `neurotcs.output_schema` | 🗺️ roadmap v1.9.x | FHIR Observation emitter (importing raises ImportError) |
85
+ | 6a | `neurotcs.input_contract.v1_1.adapters` | ✅ shipped | OASIS-3, ADNI (canonical R-format), NACC, MIRIAD trajectory loaders |
86
+ | 6b | `neurotcs.reference_adapters` | ✅ shipped | Reference submission-builders for vendor onboarding (ADNI categorical + volumetric) |
87
+ | 7 | `neurotcs.validation_harness` | 🗺️ roadmap v1.9.x | Synthetic-trajectory self-tests (importing raises ImportError) |
88
+
89
+ Plus five methodological modules (all shipped in v1.7.0+, all with tests):
90
+
91
+ - `neurotcs.sample_size` — external-validation precision per Riley 2024
92
+ - `neurotcs.fairness` — FUTURE-AI Fairness + Robustness panels per Lekadir 2025 BMJ
93
+ - `neurotcs.silent_deployment` — Kwong 2022 silent-trial methodology
94
+ - `neurotcs.scanner_factorial` — Scanner × vendor × interval factorial robustness
95
+ - `neurotcs.threshold_derivation` — Larson 2025 empirical operational thresholds
96
+
97
+ ## Rule packs shipped
98
+
99
+ NeuroTCS v1.x is scope-narrowed to **Alzheimer's disease** in preparation for FDA Q-Submission (target Q1 2027). The 3 AD rule packs encode the dominant diagnostic and trajectory frameworks. See [docs/SCOPE.md](docs/SCOPE.md) for the scope-decision rationale; non-AD packs that previously shipped in v1.7.x (PD/Hoehn-Yahr, MS/McDonald, oncology RECIST + iRECIST, stroke mRS, lung-nodule Fleischner) have been extracted to seed future per-disease repositories post-FDA-clearance.
100
+
101
+ | Pack | Disease | Anchor publication | PMID | Transitions |
102
+ |---|---|---|---|---|
103
+ | `ad/niaaa_2018@1.3.0` | Alzheimer's | Jack 2018 NIA-AA Framework | 29653606 | 4 + 2 inadmissible |
104
+ | `ad/aa_2024@2.1.0` | Alzheimer's | Jack 2024 AA Revised Criteria | 38934362 | 28 + 17 inadmissible (Table 7 integrated staging, 17 states) |
105
+ | `ad/aa_2024_trac@1.1.0` | Alzheimer's (anti-Aβ) | La Joie 2025 TRAC framework | 41298245 | 6 + 3 inadmissible (5 require `treatment_status`) |
106
+
107
+ Each rule pack is:
108
+
109
+ - **Citation-locked** — every transition requires `citation_pmid` or `citation_doi` AND `guideline_section` (exact section/table/figure pointer).
110
+ - **Version-stamped** — canonical JSON SHA-256 hash computed at load time.
111
+ - **Fail-closed** — Pydantic v2 strict mode rejects unknown fields, missing citations, inconsistent state spaces.
112
+
113
+ **Schema v1.3.0** adds backward-compatible support for **context-conditional admissibility** (the TRAC pack uses this to encode that A+ → A− amyloid clearance is admissible *only* under anti-Aβ therapy) and `attribution_type` (clinical_inference vs guideline_quote, per ERRATA E-2026-003).
114
+
115
+ ## Authority model
116
+
117
+ NeuroTCS rule packs do NOT require disease-specialist co-authorship to be authoritative. They require provenance to internationally endorsed published guidelines. The schema makes this explicit:
118
+
119
+ - `clinical_source_authority` — names the peer-reviewed publication + endorsing professional society where clinical authority resides.
120
+ - `transcribed_by` — names the board-certified physician who attests the YAML faithfully encodes the cited guideline.
121
+ - `guideline_section` per transition — exact pointer so any reviewer can verify the transcription.
122
+ - `reviewers` — additive specialist sign-off (non-blocking).
123
+
124
+ This mirrors how FHIR / SNOMED / LOINC terminology encodings work. Authority lives in the cited publication, not in a co-author's signature.
125
+
126
+ See [`docs/transcription_audit/`](docs/transcription_audit/) for side-by-side YAML ↔ source-paragraph audits.
127
+
128
+ ## Quick start
129
+
130
+ ```bash
131
+ git clone https://github.com/DrMaruf1991/NeuroTCS.git
132
+ cd NeuroTCS
133
+ pip install -e .
134
+
135
+ # Framework-only tests (no cohort data required) — expect 1437 passed, 13 skipped (v1.33.1)
136
+ python -m pytest tests/ -q \
137
+ --ignore=tests/audit_core/test_real_adni_audit.py \
138
+ --ignore=tests/audit_core/test_real_oasis3_audit.py \
139
+ --ignore=tests/audit_core/test_real_nacc_audit.py \
140
+ --ignore=tests/audit_core/test_real_miriad_audit.py \
141
+ --ignore=tests/audit_core/test_real_miriad_fairness_audit.py \
142
+ --ignore=tests/audit_core/test_four_cohort_triangulation.py
143
+
144
+ # Full suite with cohort data (set env vars first; expect 1437+cohort tests passed, cohort-version-dependent)
145
+ export NEUROTCS_OASIS3_CDR=/path/to/OASIS3_UDSb4_cdr.csv
146
+ export NEUROTCS_ADNI_DXSUM_RDA=/path/to/ADNIMERGE2/data/DXSUM.rda
147
+ export NEUROTCS_NACC_CSV=/path/to/investigator_nacc73_slim.csv
148
+ export NEUROTCS_MIRIAD_DIR=/path/to/MIRIAD_directory
149
+ python -m pytest tests/ -q
150
+ ```
151
+
152
+ The test count is environment-dependent: **1437 passed / 13 skipped** without cohort env vars (cohort tests skip; current as of v1.33.1). With all four cohort env vars pointing at valid files, the cohort tests additionally execute and pass; the exact pass count is cohort-version-dependent. Both outcomes are correct behavior.
153
+
154
+ ### Rule pack only
155
+
156
+ ```python
157
+ from neurotcs import load_rulepack
158
+
159
+ pack = load_rulepack("ad/niaaa_2018")
160
+ ok, rule = pack.rulepack.is_admissible("CN", "AD", delta_t_days=200)
161
+ print(ok) # False — CN->AD requires >=365 days (Jack 2018)
162
+ ```
163
+
164
+ ### Full audit pipeline (canonical pattern)
165
+
166
+ ```python
167
+ from neurotcs import audit, load_rulepack
168
+ from neurotcs.input_contract.v1_1.adapters.adapter_adni_canonical import (
169
+ load_adni_trajectories,
170
+ )
171
+
172
+ pack = load_rulepack("ad/niaaa_2018")
173
+ trajectories, report = load_adni_trajectories(
174
+ dxsum_rda_path="/path/to/ADNIMERGE2/data/DXSUM.rda",
175
+ hash_ids=False, skip_invalid=True,
176
+ )
177
+ result = audit(trajectories, pack, bootstrap_B=10_000, seed=42, ci_method="bca")
178
+
179
+ print(f"cTCS: {result.ctcs.ci.point:.6f}") # 0.994575 (v1.20.0 locked)
180
+ print(f"audit_id: {result.audit_id}") # 7a973f7b... (v1.20.0 locked)
181
+ print(f"audit_id_v2: {result.audit_id_v2}") # dda642ff... (v1.20.0 locked)
182
+ result.to_json("report.json")
183
+ ```
184
+
185
+ Worked examples for all four cohorts: see [`tests/audit_core/test_real_*.py`](tests/audit_core/) (each test reproduces a locked invariant) and [`examples/`](examples/) (runnable demos).
186
+
187
+ ### CLI
188
+
189
+ ```bash
190
+ neurotcs-audit audit \
191
+ --predictions predictions.csv \
192
+ --rulepack ad/niaaa_2018 \
193
+ --output report.json \
194
+ --bootstrap 10000 --seed 42 \
195
+ --patient-col RID --date-col EXAMDATE --state-col DIAGNOSIS \
196
+ --state-label-map Dementia=AD
197
+ ```
198
+
199
+ ## Reviewer verification
200
+
201
+ For third-party reviewers (FDA technical staff, pharma diligence, academic peer reviewers, hospital AI governance):
202
+
203
+ - **v2 canonical protocol**: [`docs/reviewer_package/reviewer_verification_prompt.md`](docs/reviewer_package/reviewer_verification_prompt.md) — 8-step manual reproduction (~90 min). Produces signed YAML attestation.
204
+ - **Cursor IDE prompt**: [`docs/reviewer_package/cursor_verification_prompt.md`](docs/reviewer_package/cursor_verification_prompt.md) — AI-guided execution (~30 min).
205
+ - **Colab notebook**: [`docs/reviewer_package/NeuroTCS_v1.8.0_Reviewer_Verification.ipynb`](docs/reviewer_package/NeuroTCS_v1.8.0_Reviewer_Verification.ipynb) — browser-only zero-install preview (~10 min, synthetic-data demo).
206
+
207
+ All three surfaces produce the same YAML attestation schema and reference the same locked invariants. The Colab path can only achieve `FRAMEWORK_INSTALL_VERIFIED` (DUA-controlled data cannot be uploaded to third-party cloud); local paths can achieve `FULL_REPRODUCED`.
208
+
209
+ ## Specification
210
+
211
+ The canonical spec is [`docs/spec/temporalmetric_v1.7_FINAL.md`](docs/spec/temporalmetric_v1.7_FINAL.md). Read this to understand:
212
+
213
+ - §A.2 — Coherence Temporal Consistency Score (cTCS) definition
214
+ - §A.3 — Probabilistic TCS with matrix exponential M(Δτ) = exp(Q · Δτ / 365)
215
+ - §A.4 — Unified TCS (weighted ensemble)
216
+ - §A.5 — Cluster bootstrap (B = 10,000) + Huber M-estimation (c = 1.345)
217
+ - §B.1 — Aims 1–6 validation plan
218
+ - §B.2 — Required datasets (ADNI, OASIS-3, NACC, MIRIAD; ALZ-NET planned)
219
+ - §B.6 — Rule pack registry and engineering discipline
220
+ - §C — Library architecture
221
+
222
+ ## Roadmap to v0.2 / v1.0 / Q-Sub
223
+
224
+ - **v1.8.0** (May 2026) — Four-cohort triangulation lock + ADNI canonical source. ✅ shipped.
225
+ - **v1.8.1** (May 2026) — Documentation, test hygiene, CI matrix, reference-adapter reorganization, citation backfill. ✅ shipped.
226
+ - **v1.9.0** (May 2026) — **AD-only scope contraction**: non-AD rule packs (PD, MS, oncology, stroke, lung nodule) extracted to seed future per-disease repositories post-FDA-clearance. ✅ shipped.
227
+ - **v1.9.x** (Q3 2026) — Piece 5 (FHIR output) + Piece 7 (validation harness) + cohort-specific transition priors.
228
+ - **W22 (~Sept 2026)** — Nature Medicine submission with AD validation across ADNI + OASIS-3 + NACC + MIRIAD.
229
+ - **Oct 2026** — ASFNR Newport Beach workshop demo.
230
+ - **Q1 2027** — FDA Q-Submission with v1.0.0 release.
231
+
232
+ ## Citation
233
+
234
+ ```bibtex
235
+ @software{salokhiddinov2026neurotcs,
236
+ author = {Salokhiddinov, Marufjon},
237
+ title = {NeuroTCS: Citation-locked, fail-closed longitudinal medical AI audit framework},
238
+ version = {1.20.0},
239
+ year = {2026},
240
+ url = {https://github.com/DrMaruf1991/NeuroTCS},
241
+ note = {temporalmetric v1.7 FINAL specification, 3 AD production rule packs, four-cohort triangulation lock; v1.9.0+ AD-only scope}
242
+ }
243
+ ```
244
+
245
+ See [`CITATION.cff`](CITATION.cff) for GitHub's citation widget.
246
+
247
+ ## Known limitations (honestly disclosed)
248
+
249
+ NeuroTCS publicly documents what is NOT yet covered so reviewers can assess
250
+ fitness for purpose. The complete, current gap disclosure — spanning
251
+ methodological, validation, fairness, and regulatory-status gaps — is
252
+ maintained as a single source of truth in
253
+ [`docs/datasheet/ad_neurotcs_datasheet.md`](docs/datasheet/ad_neurotcs_datasheet.md)
254
+ **Section F — Honest gaps acknowledged**.
255
+
256
+ To avoid drift, the README does not duplicate the list here; Section F is
257
+ authoritative (enforced by `tests/docs/test_gap_disclosure_single_source.py`).
258
+ These gaps do not invalidate the reproducibility evidence — they define the
259
+ scope within which it is interpretable.
260
+
261
+ ## License
262
+
263
+ Apache 2.0 — see [`LICENSE`](LICENSE). The cited published guidelines remain © their respective publishers; this package transcribes them into machine-readable form for academic / regulatory audit purposes under fair-use interpretation. NeuroTCS does NOT redistribute the publications themselves.
264
+
265
+ ## Contact
266
+
267
+ **Dr. Marufjon Salokhiddinov, MD PhD**
268
+ ESOR-BRACCO-ESNR Neuroimaging Fellow
269
+ Kimyo International University in Tashkent (KIUT), Uzbekistan
270
+
271
+ Issues and contributions via GitHub.