cascade-protocol 1.0.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 (39) hide show
  1. cascade_protocol-1.0.0/.gitignore +5 -0
  2. cascade_protocol-1.0.0/CHANGELOG.md +44 -0
  3. cascade_protocol-1.0.0/LICENSE +200 -0
  4. cascade_protocol-1.0.0/PKG-INFO +382 -0
  5. cascade_protocol-1.0.0/README.md +144 -0
  6. cascade_protocol-1.0.0/pyproject.toml +65 -0
  7. cascade_protocol-1.0.0/src/cascade_protocol/__init__.py +179 -0
  8. cascade_protocol-1.0.0/src/cascade_protocol/deserializer/__init__.py +10 -0
  9. cascade_protocol-1.0.0/src/cascade_protocol/deserializer/turtle_parser.py +353 -0
  10. cascade_protocol-1.0.0/src/cascade_protocol/models/__init__.py +84 -0
  11. cascade_protocol-1.0.0/src/cascade_protocol/models/allergy.py +67 -0
  12. cascade_protocol-1.0.0/src/cascade_protocol/models/common.py +209 -0
  13. cascade_protocol-1.0.0/src/cascade_protocol/models/condition.py +79 -0
  14. cascade_protocol-1.0.0/src/cascade_protocol/models/coverage.py +148 -0
  15. cascade_protocol-1.0.0/src/cascade_protocol/models/family_history.py +55 -0
  16. cascade_protocol-1.0.0/src/cascade_protocol/models/health_profile.py +87 -0
  17. cascade_protocol-1.0.0/src/cascade_protocol/models/immunization.py +102 -0
  18. cascade_protocol-1.0.0/src/cascade_protocol/models/lab_result.py +108 -0
  19. cascade_protocol-1.0.0/src/cascade_protocol/models/medication.py +182 -0
  20. cascade_protocol-1.0.0/src/cascade_protocol/models/patient_profile.py +179 -0
  21. cascade_protocol-1.0.0/src/cascade_protocol/models/procedure.py +72 -0
  22. cascade_protocol-1.0.0/src/cascade_protocol/models/vital_sign.py +99 -0
  23. cascade_protocol-1.0.0/src/cascade_protocol/models/wellness.py +126 -0
  24. cascade_protocol-1.0.0/src/cascade_protocol/pandas_integration/__init__.py +13 -0
  25. cascade_protocol-1.0.0/src/cascade_protocol/pandas_integration/dataframe.py +142 -0
  26. cascade_protocol-1.0.0/src/cascade_protocol/pod/__init__.py +7 -0
  27. cascade_protocol-1.0.0/src/cascade_protocol/pod/pod.py +324 -0
  28. cascade_protocol-1.0.0/src/cascade_protocol/serializer/__init__.py +37 -0
  29. cascade_protocol-1.0.0/src/cascade_protocol/serializer/turtle_serializer.py +543 -0
  30. cascade_protocol-1.0.0/src/cascade_protocol/validator/__init__.py +11 -0
  31. cascade_protocol-1.0.0/src/cascade_protocol/validator/validator.py +380 -0
  32. cascade_protocol-1.0.0/src/cascade_protocol/vocabularies/__init__.py +24 -0
  33. cascade_protocol-1.0.0/src/cascade_protocol/vocabularies/namespaces.py +493 -0
  34. cascade_protocol-1.0.0/tests/__init__.py +1 -0
  35. cascade_protocol-1.0.0/tests/test_conformance.py +212 -0
  36. cascade_protocol-1.0.0/tests/test_deserializer.py +121 -0
  37. cascade_protocol-1.0.0/tests/test_pod.py +146 -0
  38. cascade_protocol-1.0.0/tests/test_serializer.py +393 -0
  39. cascade_protocol-1.0.0/tests/test_validator.py +103 -0
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ .obsidian/
3
+ node_modules/
4
+ dist/
5
+ package-lock.json
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ All notable changes to `cascade-protocol` (Python SDK) will be documented in this file.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-02-22
9
+
10
+ ### Added
11
+
12
+ - Initial release of the Cascade Protocol Python SDK.
13
+ - Full data model support for all Phase 1 record types:
14
+ - `Medication` (`health:MedicationRecord`)
15
+ - `Condition` (`health:ConditionRecord`)
16
+ - `Allergy` (`health:AllergyRecord`)
17
+ - `LabResult` (`health:LabResultRecord`)
18
+ - `VitalSign` (`clinical:VitalSign`)
19
+ - `Immunization` (`health:ImmunizationRecord`)
20
+ - `Procedure` (`health:ProcedureRecord`)
21
+ - `FamilyHistory` (`health:FamilyHistoryRecord`)
22
+ - `Coverage` (`coverage:InsurancePlan`)
23
+ - `PatientProfile` (`cascade:PatientProfile`)
24
+ - `ActivitySnapshot` (`health:ActivitySnapshot`)
25
+ - `SleepSnapshot` (`health:SleepSnapshot`)
26
+ - `HealthProfile` (aggregate container)
27
+ - `serialize(record)` — converts any Cascade record to valid RDF/Turtle
28
+ - `validate(turtle)` — structural validation with optional SHACL support
29
+ - `parse(turtle, type)` — deserializes Turtle back to Python model objects
30
+ - `Pod` class for reading Cascade Pod directories (LDP container layout)
31
+ - `RecordSet.to_dataframe()` — pandas DataFrame conversion (optional dependency)
32
+ - `<ModelClass>.from_dataframe(df)` — reconstruct models from DataFrame
33
+ - Conformance test suite integration (`tests/test_conformance.py`)
34
+ - Three example Jupyter notebooks
35
+ - Namespace constants matching the TypeScript SDK exactly
36
+ - Zero network calls; all processing is local
37
+ - Apache 2.0 license
38
+
39
+ ### Conformance
40
+
41
+ - Passes all positive conformance fixtures from the Cascade Protocol conformance suite v1.0
42
+ - Structural validation correctly rejects all negative conformance fixtures
43
+
44
+ [1.0.0]: https://github.com/cascade-protocol/sdk-python/releases/tag/v1.0.0
@@ -0,0 +1,200 @@
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 made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other transformations
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner, any work of
50
+ authorship, including the original version of the Work and any
51
+ modifications or additions to that Work or any modifications or
52
+ additions to a Derivative Works of the Work.
53
+
54
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
55
+ whom a Contribution has been submitted to the Licensor.
56
+
57
+ "Contributor Version" shall mean the combination of the Contributor's
58
+ Contributions, plus any modifications or additions to such
59
+ Contributions submitted to the Licensor for inclusion in the Work.
60
+
61
+ "Submitted" shall mean any form of electronic, verbal, or written
62
+ communication sent to the Licensor or its representatives, including
63
+ but not limited to communication on electronic mailing lists, source code
64
+ control systems, and issue tracking systems that are managed by, or on
65
+ behalf of, the Licensor for the purpose of discussing and improving the
66
+ Work, but excluding communication that is conspicuously marked or
67
+ otherwise designated in writing by the copyright owner as "Not a
68
+ Contribution."
69
+
70
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
71
+ whom a Contribution has been submitted to the Licensor.
72
+
73
+ 2. Grant of Copyright 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
+ copyright license to reproduce, prepare Derivative Works of,
77
+ publicly display, publicly perform, sublicense, and distribute the
78
+ Work and such Derivative Works in Source or Object form.
79
+
80
+ 3. Grant of Patent License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ (except as stated in this section) patent license to make, have made,
84
+ use, offer to sell, sell, import, and otherwise transfer the Work,
85
+ where such license applies only to those patent claims licensable
86
+ by such Contributor that are necessarily infringed by their
87
+ Contribution(s) alone or by the combination of their Contribution(s)
88
+ with the Work to which such Contribution(s) was submitted. If You
89
+ institute patent litigation against any entity (including a cross-claim
90
+ or counterclaim in a lawsuit) alleging that the Work or any
91
+ Contribution embodied within the Work constitutes direct or
92
+ contributory patent infringement, then any patent licenses granted to
93
+ You under this License for that Work shall terminate as of the date
94
+ such litigation is filed.
95
+
96
+ 4. Redistribution. You may reproduce and distribute copies of the
97
+ Work or Derivative Works thereof in any medium, with or without
98
+ modifications, and in Source or Object form, provided that You
99
+ meet the following conditions:
100
+
101
+ (a) You must give any other recipients of the Work or
102
+ Derivative Works a copy of this License; and
103
+
104
+ (b) You must cause any modified files to carry prominent notices
105
+ stating that You changed the files; and
106
+
107
+ (c) You must retain, in the Source form of any Derivative Works
108
+ that You distribute, all copyright, patent, trademark, and
109
+ attribution notices from the Source form of the Work,
110
+ excluding those notices that do not pertain to any part of
111
+ the Derivative Works; and
112
+
113
+ (d) If the Work includes a "NOTICE" text file as part of its
114
+ distribution, You must include a readable copy of the
115
+ attribution notices contained within such NOTICE file, in
116
+ at least one of the following places: within a NOTICE text
117
+ file distributed as part of the Derivative Works; within
118
+ the Source form or documentation, if provided along with the
119
+ Derivative Works; or, within a display generated by the
120
+ Derivative Works, if and wherever such third-party notices
121
+ normally appear. The contents of the NOTICE file are for
122
+ informational purposes only and do not modify the License.
123
+ You may add Your own attribution notices within Derivative
124
+ Works that You distribute, alongside or as an addendum to
125
+ the NOTICE text from the Work, provided that such additional
126
+ attribution notices cannot be construed as modifying the License.
127
+
128
+ You may add Your own license statement for Your modifications and
129
+ may provide additional grant of rights to use, copy, modify, merge,
130
+ publish, distribute, sublicense, and/or sell copies of the
131
+ modifications, and to permit persons to whom the modifications are
132
+ furnished, subject to the following conditions: the above copyright
133
+ notice and this permission notice shall be included in all copies or
134
+ substantial portions of the modifications.
135
+
136
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
137
+ any Contribution intentionally submitted for inclusion in the Work
138
+ by You to the Licensor shall be under the terms and conditions of
139
+ this License, without any additional terms or conditions.
140
+ Notwithstanding the above, nothing herein shall supersede or modify
141
+ the terms of any separate license agreement you may have executed
142
+ with Licensor regarding such Contributions.
143
+
144
+ 6. Trademarks. This License does not grant permission to use the trade
145
+ names, trademarks, service marks, or product names of the Licensor,
146
+ except as required for reasonable and customary use in describing the
147
+ origin of the Work and reproducing the content of the NOTICE file.
148
+
149
+ 7. Disclaimer of Warranty. Unless required by applicable law or
150
+ agreed to in writing, Licensor provides the Work (and each
151
+ Contributor provides its Contributions) on an "AS IS" BASIS,
152
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
153
+ implied, including, without limitation, any warranties or conditions
154
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
155
+ PARTICULAR PURPOSE. You are solely responsible for determining the
156
+ appropriateness of using or reproducing the Work and assume any
157
+ risks associated with Your exercise of permissions under this License.
158
+
159
+ 8. Limitation of Liability. In no event and under no legal theory,
160
+ whether in tort (including negligence), contract, or otherwise,
161
+ unless required by applicable law (such as deliberate and grossly
162
+ negligent acts) or agreed to in writing, shall any Contributor be
163
+ liable to You for damages, including any direct, indirect, special,
164
+ incidental, or exemplary damages of any character arising as a
165
+ result of this License or out of the use or inability to use the
166
+ Work (even if such Contributor has been advised of the possibility
167
+ of such damages).
168
+
169
+ 9. Accepting Warranty or Liability. While redistributing the Work or
170
+ Derivative Works thereof, You may choose to offer, and charge a fee
171
+ for, acceptance of support, warranty, indemnity, or other liability
172
+ obligations and/or rights consistent with this License. However, in
173
+ accepting such obligations, You may offer only obligations consistent
174
+ with this License, and only if You accept that such obligations are
175
+ consistent with this License and not in violation of the License.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. Also, we recommend that a
186
+ file and directory "README" file be included with your work.
187
+
188
+ Copyright 2026 Cascade Agentic Labs
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
@@ -0,0 +1,382 @@
1
+ Metadata-Version: 2.4
2
+ Name: cascade-protocol
3
+ Version: 1.0.0
4
+ Summary: Python SDK for the Cascade Protocol — privacy-first health data serialization in RDF/Turtle
5
+ Project-URL: Homepage, https://cascadeprotocol.org
6
+ Project-URL: Documentation, https://cascadeprotocol.org/docs
7
+ Project-URL: Repository, https://github.com/the-cascade-protocol/sdk-python
8
+ Project-URL: Issue Tracker, https://github.com/the-cascade-protocol/sdk-python/issues
9
+ License: Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship made available under
44
+ the License, as indicated by a copyright notice that is included in
45
+ or attached to the work (an example is provided in the Appendix below).
46
+
47
+ "Derivative Works" shall mean any work, whether in Source or Object
48
+ form, that is based on (or derived from) the Work and for which the
49
+ editorial revisions, annotations, elaborations, or other transformations
50
+ represent, as a whole, an original work of authorship. For the purposes
51
+ of this License, Derivative Works shall not include works that remain
52
+ separable from, or merely link (or bind by name) to the interfaces of,
53
+ the Work and Derivative Works thereof.
54
+
55
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
56
+ in the Work by the copyright owner or by an individual or Legal Entity
57
+ authorized to submit on behalf of the copyright owner, any work of
58
+ authorship, including the original version of the Work and any
59
+ modifications or additions to that Work or any modifications or
60
+ additions to a Derivative Works of the Work.
61
+
62
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
63
+ whom a Contribution has been submitted to the Licensor.
64
+
65
+ "Contributor Version" shall mean the combination of the Contributor's
66
+ Contributions, plus any modifications or additions to such
67
+ Contributions submitted to the Licensor for inclusion in the Work.
68
+
69
+ "Submitted" shall mean any form of electronic, verbal, or written
70
+ communication sent to the Licensor or its representatives, including
71
+ but not limited to communication on electronic mailing lists, source code
72
+ control systems, and issue tracking systems that are managed by, or on
73
+ behalf of, the Licensor for the purpose of discussing and improving the
74
+ Work, but excluding communication that is conspicuously marked or
75
+ otherwise designated in writing by the copyright owner as "Not a
76
+ Contribution."
77
+
78
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
79
+ whom a Contribution has been submitted to the Licensor.
80
+
81
+ 2. Grant of Copyright License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ copyright license to reproduce, prepare Derivative Works of,
85
+ publicly display, publicly perform, sublicense, and distribute the
86
+ Work and such Derivative Works in Source or Object form.
87
+
88
+ 3. Grant of Patent License. Subject to the terms and conditions of
89
+ this License, each Contributor hereby grants to You a perpetual,
90
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
91
+ (except as stated in this section) patent license to make, have made,
92
+ use, offer to sell, sell, import, and otherwise transfer the Work,
93
+ where such license applies only to those patent claims licensable
94
+ by such Contributor that are necessarily infringed by their
95
+ Contribution(s) alone or by the combination of their Contribution(s)
96
+ with the Work to which such Contribution(s) was submitted. If You
97
+ institute patent litigation against any entity (including a cross-claim
98
+ or counterclaim in a lawsuit) alleging that the Work or any
99
+ Contribution embodied within the Work constitutes direct or
100
+ contributory patent infringement, then any patent licenses granted to
101
+ You under this License for that Work shall terminate as of the date
102
+ such litigation is filed.
103
+
104
+ 4. Redistribution. You may reproduce and distribute copies of the
105
+ Work or Derivative Works thereof in any medium, with or without
106
+ modifications, and in Source or Object form, provided that You
107
+ meet the following conditions:
108
+
109
+ (a) You must give any other recipients of the Work or
110
+ Derivative Works a copy of this License; and
111
+
112
+ (b) You must cause any modified files to carry prominent notices
113
+ stating that You changed the files; and
114
+
115
+ (c) You must retain, in the Source form of any Derivative Works
116
+ that You distribute, all copyright, patent, trademark, and
117
+ attribution notices from the Source form of the Work,
118
+ excluding those notices that do not pertain to any part of
119
+ the Derivative Works; and
120
+
121
+ (d) If the Work includes a "NOTICE" text file as part of its
122
+ distribution, You must include a readable copy of the
123
+ attribution notices contained within such NOTICE file, in
124
+ at least one of the following places: within a NOTICE text
125
+ file distributed as part of the Derivative Works; within
126
+ the Source form or documentation, if provided along with the
127
+ Derivative Works; or, within a display generated by the
128
+ Derivative Works, if and wherever such third-party notices
129
+ normally appear. The contents of the NOTICE file are for
130
+ informational purposes only and do not modify the License.
131
+ You may add Your own attribution notices within Derivative
132
+ Works that You distribute, alongside or as an addendum to
133
+ the NOTICE text from the Work, provided that such additional
134
+ attribution notices cannot be construed as modifying the License.
135
+
136
+ You may add Your own license statement for Your modifications and
137
+ may provide additional grant of rights to use, copy, modify, merge,
138
+ publish, distribute, sublicense, and/or sell copies of the
139
+ modifications, and to permit persons to whom the modifications are
140
+ furnished, subject to the following conditions: the above copyright
141
+ notice and this permission notice shall be included in all copies or
142
+ substantial portions of the modifications.
143
+
144
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
145
+ any Contribution intentionally submitted for inclusion in the Work
146
+ by You to the Licensor shall be under the terms and conditions of
147
+ this License, without any additional terms or conditions.
148
+ Notwithstanding the above, nothing herein shall supersede or modify
149
+ the terms of any separate license agreement you may have executed
150
+ with Licensor regarding such Contributions.
151
+
152
+ 6. Trademarks. This License does not grant permission to use the trade
153
+ names, trademarks, service marks, or product names of the Licensor,
154
+ except as required for reasonable and customary use in describing the
155
+ origin of the Work and reproducing the content of the NOTICE file.
156
+
157
+ 7. Disclaimer of Warranty. Unless required by applicable law or
158
+ agreed to in writing, Licensor provides the Work (and each
159
+ Contributor provides its Contributions) on an "AS IS" BASIS,
160
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
161
+ implied, including, without limitation, any warranties or conditions
162
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
163
+ PARTICULAR PURPOSE. You are solely responsible for determining the
164
+ appropriateness of using or reproducing the Work and assume any
165
+ risks associated with Your exercise of permissions under this License.
166
+
167
+ 8. Limitation of Liability. In no event and under no legal theory,
168
+ whether in tort (including negligence), contract, or otherwise,
169
+ unless required by applicable law (such as deliberate and grossly
170
+ negligent acts) or agreed to in writing, shall any Contributor be
171
+ liable to You for damages, including any direct, indirect, special,
172
+ incidental, or exemplary damages of any character arising as a
173
+ result of this License or out of the use or inability to use the
174
+ Work (even if such Contributor has been advised of the possibility
175
+ of such damages).
176
+
177
+ 9. Accepting Warranty or Liability. While redistributing the Work or
178
+ Derivative Works thereof, You may choose to offer, and charge a fee
179
+ for, acceptance of support, warranty, indemnity, or other liability
180
+ obligations and/or rights consistent with this License. However, in
181
+ accepting such obligations, You may offer only obligations consistent
182
+ with this License, and only if You accept that such obligations are
183
+ consistent with this License and not in violation of the License.
184
+
185
+ END OF TERMS AND CONDITIONS
186
+
187
+ APPENDIX: How to apply the Apache License to your work.
188
+
189
+ To apply the Apache License to your work, attach the following
190
+ boilerplate notice, with the fields enclosed by brackets "[]"
191
+ replaced with your own identifying information. (Don't include
192
+ the brackets!) The text should be enclosed in the appropriate
193
+ comment syntax for the file format. Also, we recommend that a
194
+ file and directory "README" file be included with your work.
195
+
196
+ Copyright 2026 Cascade Agentic Labs
197
+
198
+ Licensed under the Apache License, Version 2.0 (the "License");
199
+ you may not use this file except in compliance with the License.
200
+ You may obtain a copy of the License at
201
+
202
+ http://www.apache.org/licenses/LICENSE-2.0
203
+
204
+ Unless required by applicable law or agreed to in writing, software
205
+ distributed under the License is distributed on an "AS IS" BASIS,
206
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
207
+ See the License for the specific language governing permissions and
208
+ limitations under the License.
209
+ License-File: LICENSE
210
+ Keywords: cascade,fhir,health,privacy,rdf,turtle
211
+ Classifier: Development Status :: 5 - Production/Stable
212
+ Classifier: Intended Audience :: Developers
213
+ Classifier: Intended Audience :: Healthcare Industry
214
+ Classifier: License :: OSI Approved :: Apache Software License
215
+ Classifier: Programming Language :: Python :: 3
216
+ Classifier: Programming Language :: Python :: 3.10
217
+ Classifier: Programming Language :: Python :: 3.11
218
+ Classifier: Programming Language :: Python :: 3.12
219
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
220
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
221
+ Classifier: Typing :: Typed
222
+ Requires-Python: >=3.10
223
+ Requires-Dist: rdflib>=7.0.0
224
+ Provides-Extra: all
225
+ Requires-Dist: jupyter>=1.0.0; extra == 'all'
226
+ Requires-Dist: matplotlib>=3.7.0; extra == 'all'
227
+ Requires-Dist: pandas>=2.0.0; extra == 'all'
228
+ Requires-Dist: pyshacl>=0.26.0; extra == 'all'
229
+ Provides-Extra: notebooks
230
+ Requires-Dist: jupyter>=1.0.0; extra == 'notebooks'
231
+ Requires-Dist: matplotlib>=3.7.0; extra == 'notebooks'
232
+ Requires-Dist: pandas>=2.0.0; extra == 'notebooks'
233
+ Provides-Extra: pandas
234
+ Requires-Dist: pandas>=2.0.0; extra == 'pandas'
235
+ Provides-Extra: validation
236
+ Requires-Dist: pyshacl>=0.26.0; extra == 'validation'
237
+ Description-Content-Type: text/markdown
238
+
239
+ # cascade-protocol
240
+
241
+ Python SDK for the [Cascade Protocol](https://cascadeprotocol.org) — a privacy-first, local-first standard for serializing personal health data as RDF/Turtle.
242
+
243
+ ## Installation
244
+
245
+ ```bash
246
+ pip install cascade-protocol
247
+ ```
248
+
249
+ With optional extras:
250
+
251
+ ```bash
252
+ pip install "cascade-protocol[pandas]" # pandas DataFrame integration
253
+ pip install "cascade-protocol[validation]" # SHACL validation via pyshacl
254
+ pip install "cascade-protocol[notebooks]" # Jupyter notebook support
255
+ pip install "cascade-protocol[all]" # Everything
256
+ ```
257
+
258
+ ## Quick Start
259
+
260
+ ```python
261
+ from cascade_protocol import Medication, serialize, validate, Pod
262
+
263
+ # Create a medication record
264
+ med = Medication(
265
+ id="urn:uuid:med0-0001-aaaa-bbbb-ccccddddeeee",
266
+ medication_name="Metoprolol Succinate",
267
+ is_active=True,
268
+ dose="25mg",
269
+ data_provenance="ClinicalGenerated",
270
+ schema_version="1.3",
271
+ )
272
+
273
+ # Serialize to Turtle
274
+ turtle = serialize(med)
275
+ print(turtle)
276
+
277
+ # Validate structural integrity
278
+ result = validate(turtle)
279
+ print(result.is_valid, result.errors)
280
+
281
+ # Open a Cascade Pod and query records
282
+ pod = Pod.open("./my-pod")
283
+ meds = pod.query("medications")
284
+
285
+ # Convert to pandas DataFrame (requires pandas extra)
286
+ df = meds.to_dataframe()
287
+ print(df.head())
288
+
289
+ # Reconstruct models from DataFrame
290
+ restored = Medication.from_dataframe(df)
291
+ ```
292
+
293
+ ## Serialization Output
294
+
295
+ ```turtle
296
+ @prefix cascade: <https://ns.cascadeprotocol.org/core/v1#> .
297
+ @prefix health: <https://ns.cascadeprotocol.org/health/v1#> .
298
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
299
+
300
+ <urn:uuid:med0-0001-aaaa-bbbb-ccccddddeeee> a health:MedicationRecord ;
301
+ health:medicationName "Metoprolol Succinate" ;
302
+ health:isActive true ;
303
+ cascade:dataProvenance cascade:ClinicalGenerated ;
304
+ cascade:schemaVersion "1.3" ;
305
+ health:dose "25mg" .
306
+ ```
307
+
308
+ ## Supported Data Types
309
+
310
+ | Class | RDF Type | Description |
311
+ |---|---|---|
312
+ | `Medication` | `health:MedicationRecord` | Prescription and OTC drugs |
313
+ | `Condition` | `health:ConditionRecord` | Medical diagnoses |
314
+ | `Allergy` | `health:AllergyRecord` | Allergies and intolerances |
315
+ | `LabResult` | `health:LabResultRecord` | Laboratory test results |
316
+ | `VitalSign` | `clinical:VitalSign` | Vital sign measurements |
317
+ | `Immunization` | `health:ImmunizationRecord` | Vaccine records |
318
+ | `Procedure` | `health:ProcedureRecord` | Clinical procedures |
319
+ | `FamilyHistory` | `health:FamilyHistoryRecord` | Family health history |
320
+ | `Coverage` | `coverage:InsurancePlan` | Insurance coverage |
321
+ | `PatientProfile` | `cascade:PatientProfile` | Patient demographics |
322
+ | `ActivitySnapshot` | `health:ActivitySnapshot` | Daily activity data |
323
+ | `SleepSnapshot` | `health:SleepSnapshot` | Nightly sleep data |
324
+
325
+ ## Pod API
326
+
327
+ ```python
328
+ from cascade_protocol import Pod
329
+
330
+ pod = Pod.open("./my-pod")
331
+
332
+ # Query by data type
333
+ meds = pod.query("medications")
334
+ vitals = pod.query("vital-signs")
335
+ profile = pod.query("patient-profile")
336
+
337
+ # Iterate records
338
+ for med in meds:
339
+ print(med.medication_name, med.dose)
340
+
341
+ # DataFrame conversion
342
+ df = meds.to_dataframe()
343
+ ```
344
+
345
+ ## Parsing Turtle
346
+
347
+ ```python
348
+ from cascade_protocol.deserializer import parse, parse_one
349
+
350
+ # Parse multiple records
351
+ meds = parse(turtle_string, "MedicationRecord")
352
+
353
+ # Parse a single record
354
+ med = parse_one(turtle_string, "MedicationRecord")
355
+ ```
356
+
357
+ ## Namespaces
358
+
359
+ ```python
360
+ from cascade_protocol.vocabularies import NAMESPACES, CURRENT_SCHEMA_VERSION
361
+
362
+ print(NAMESPACES["cascade"]) # https://ns.cascadeprotocol.org/core/v1#
363
+ print(NAMESPACES["health"]) # https://ns.cascadeprotocol.org/health/v1#
364
+ print(CURRENT_SCHEMA_VERSION) # 1.3
365
+ ```
366
+
367
+ ## Privacy & Security
368
+
369
+ - Zero network calls during normal operation
370
+ - All processing is local
371
+ - No telemetry or analytics
372
+ - Data never leaves your machine
373
+
374
+ ## License
375
+
376
+ Apache 2.0 — see [LICENSE](LICENSE).
377
+
378
+ ## Links
379
+
380
+ - [Cascade Protocol Specification](https://cascadeprotocol.org/docs/spec)
381
+ - [Protocol Schema Reference](https://cascadeprotocol.org/docs/cascade-protocol-schemas)
382
+ - [Conformance Test Suite](https://github.com/cascade-protocol/conformance)