clinestra 0.3.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 (217) hide show
  1. clinestra-0.3.0/.gitignore +37 -0
  2. clinestra-0.3.0/CHANGELOG.md +26 -0
  3. clinestra-0.3.0/LICENSE +677 -0
  4. clinestra-0.3.0/LICENSE-NOTICE.md +5 -0
  5. clinestra-0.3.0/PKG-INFO +585 -0
  6. clinestra-0.3.0/README.md +520 -0
  7. clinestra-0.3.0/SECURITY.md +9 -0
  8. clinestra-0.3.0/docs/ai_harness.md +65 -0
  9. clinestra-0.3.0/docs/ai_runtime.md +63 -0
  10. clinestra-0.3.0/docs/api.md +352 -0
  11. clinestra-0.3.0/docs/api_ai.md +52 -0
  12. clinestra-0.3.0/docs/api_basics.md +81 -0
  13. clinestra-0.3.0/docs/api_capture.md +50 -0
  14. clinestra-0.3.0/docs/api_care.md +49 -0
  15. clinestra-0.3.0/docs/api_clinical.md +42 -0
  16. clinestra-0.3.0/docs/api_governance.md +71 -0
  17. clinestra-0.3.0/docs/api_people.md +31 -0
  18. clinestra-0.3.0/docs/cli.md +95 -0
  19. clinestra-0.3.0/docs/clinical_ai.md +33 -0
  20. clinestra-0.3.0/docs/clinical_consent.md +28 -0
  21. clinestra-0.3.0/docs/clinical_overview.md +30 -0
  22. clinestra-0.3.0/docs/clinical_review.md +36 -0
  23. clinestra-0.3.0/docs/clinical_safeguards.md +28 -0
  24. clinestra-0.3.0/docs/configuration.md +68 -0
  25. clinestra-0.3.0/docs/deployment.md +90 -0
  26. clinestra-0.3.0/docs/example_care_team_dashboard.md +101 -0
  27. clinestra-0.3.0/docs/example_digital_therapeutics.md +99 -0
  28. clinestra-0.3.0/docs/example_health_journal.md +84 -0
  29. clinestra-0.3.0/docs/example_inpatient.md +108 -0
  30. clinestra-0.3.0/docs/example_nurse_assistant.md +82 -0
  31. clinestra-0.3.0/docs/example_outpatient.md +106 -0
  32. clinestra-0.3.0/docs/examples.md +43 -0
  33. clinestra-0.3.0/docs/flows.md +75 -0
  34. clinestra-0.3.0/docs/guides.md +117 -0
  35. clinestra-0.3.0/docs/how_it_works.md +46 -0
  36. clinestra-0.3.0/docs/img/examples/care_team_dashboard.png +0 -0
  37. clinestra-0.3.0/docs/img/examples/digital_therapeutics.png +0 -0
  38. clinestra-0.3.0/docs/img/examples/health_journal.png +0 -0
  39. clinestra-0.3.0/docs/img/examples/inpatient.png +0 -0
  40. clinestra-0.3.0/docs/img/examples/nurse_assistant.png +0 -0
  41. clinestra-0.3.0/docs/img/examples/outpatient.png +0 -0
  42. clinestra-0.3.0/docs/longitudinal_care.md +82 -0
  43. clinestra-0.3.0/docs/packs.md +77 -0
  44. clinestra-0.3.0/docs/quickstart.md +58 -0
  45. clinestra-0.3.0/docs/setup.md +126 -0
  46. clinestra-0.3.0/docs/ui_components.md +53 -0
  47. clinestra-0.3.0/examples/api_walkthrough.sh +19 -0
  48. clinestra-0.3.0/examples/keys.example.json +5 -0
  49. clinestra-0.3.0/examples/packs/mdd/assessment_gad7.json +205 -0
  50. clinestra-0.3.0/examples/packs/mdd/assessment_phq9.json +258 -0
  51. clinestra-0.3.0/examples/packs/mdd/cohort_cohort_mdd.json +35 -0
  52. clinestra-0.3.0/examples/packs/mdd/health_profile_mdd_profile.json +30 -0
  53. clinestra-0.3.0/examples/packs/mdd/journal_plugin_mood_diary.json +28 -0
  54. clinestra-0.3.0/examples/packs/mdd/journey_mdd_care_program.json +48 -0
  55. clinestra-0.3.0/examples/packs/mdd/note_page_mdd_case_sheet.json +56 -0
  56. clinestra-0.3.0/examples/packs/mdd/pack.json +20 -0
  57. clinestra-0.3.0/examples/packs/mdd/protocol_proto_mdd_acute_phase.json +136 -0
  58. clinestra-0.3.0/examples/packs/mdd/reaction_severe_phq9_flag.json +37 -0
  59. clinestra-0.3.0/examples/packs/mdd/regimen_ssri_escitalopram.json +24 -0
  60. clinestra-0.3.0/examples/packs/mdd/regimen_ssri_sertraline.json +34 -0
  61. clinestra-0.3.0/examples/quickstart.py +21 -0
  62. clinestra-0.3.0/pyproject.toml +54 -0
  63. clinestra-0.3.0/scripts/gen_docs.py +245 -0
  64. clinestra-0.3.0/src/clinestra/__init__.py +16 -0
  65. clinestra-0.3.0/src/clinestra/_version.py +1 -0
  66. clinestra-0.3.0/src/clinestra/audit.py +60 -0
  67. clinestra-0.3.0/src/clinestra/base.py +74 -0
  68. clinestra-0.3.0/src/clinestra/cli.py +1168 -0
  69. clinestra-0.3.0/src/clinestra/concepts/capture.py +113 -0
  70. clinestra-0.3.0/src/clinestra/concepts/care.py +129 -0
  71. clinestra-0.3.0/src/clinestra/concepts/clinical.py +107 -0
  72. clinestra-0.3.0/src/clinestra/concepts/common.py +54 -0
  73. clinestra-0.3.0/src/clinestra/concepts/definitions.py +259 -0
  74. clinestra-0.3.0/src/clinestra/concepts/governance.py +68 -0
  75. clinestra-0.3.0/src/clinestra/concepts/people.py +112 -0
  76. clinestra-0.3.0/src/clinestra/emr/__init__.py +0 -0
  77. clinestra-0.3.0/src/clinestra/emr/canvas.py +332 -0
  78. clinestra-0.3.0/src/clinestra/emr/emru.py +132 -0
  79. clinestra-0.3.0/src/clinestra/emr/markdown.py +293 -0
  80. clinestra-0.3.0/src/clinestra/emr/prompts.py +463 -0
  81. clinestra-0.3.0/src/clinestra/engine/__init__.py +10 -0
  82. clinestra-0.3.0/src/clinestra/engine/cadence.py +62 -0
  83. clinestra-0.3.0/src/clinestra/engine/compute.py +415 -0
  84. clinestra-0.3.0/src/clinestra/engine/mtes.py +108 -0
  85. clinestra-0.3.0/src/clinestra/engine/overlay.py +66 -0
  86. clinestra-0.3.0/src/clinestra/engine/rules.py +125 -0
  87. clinestra-0.3.0/src/clinestra/engine/trajectory.py +69 -0
  88. clinestra-0.3.0/src/clinestra/engine/units.py +20 -0
  89. clinestra-0.3.0/src/clinestra/errors.py +30 -0
  90. clinestra-0.3.0/src/clinestra/examples_demo.py +116 -0
  91. clinestra-0.3.0/src/clinestra/harness.py +1608 -0
  92. clinestra-0.3.0/src/clinestra/pack_review.py +105 -0
  93. clinestra-0.3.0/src/clinestra/packs/__init__.py +1 -0
  94. clinestra-0.3.0/src/clinestra/packs/core/assessment_bmi.json +20 -0
  95. clinestra-0.3.0/src/clinestra/packs/core/care_team_standard.json +51 -0
  96. clinestra-0.3.0/src/clinestra/packs/core/careplan_hypertension_basic.json +35 -0
  97. clinestra-0.3.0/src/clinestra/packs/core/clinical_document_clinical_report.json +10 -0
  98. clinestra-0.3.0/src/clinestra/packs/core/clinical_document_consent_form.json +11 -0
  99. clinestra-0.3.0/src/clinestra/packs/core/clinical_document_prescription.json +14 -0
  100. clinestra-0.3.0/src/clinestra/packs/core/clinical_setting_clinic.json +23 -0
  101. clinestra-0.3.0/src/clinestra/packs/core/conversation_clinician_copilot.json +24 -0
  102. clinestra-0.3.0/src/clinestra/packs/core/conversation_general_assistant.json +16 -0
  103. clinestra-0.3.0/src/clinestra/packs/core/conversation_patient_coach.json +21 -0
  104. clinestra-0.3.0/src/clinestra/packs/core/encounter_opd_visit.json +17 -0
  105. clinestra-0.3.0/src/clinestra/packs/core/encounter_teleconsult.json +13 -0
  106. clinestra-0.3.0/src/clinestra/packs/core/health_profile_general.json +21 -0
  107. clinestra-0.3.0/src/clinestra/packs/core/health_profile_surgery.json +19 -0
  108. clinestra-0.3.0/src/clinestra/packs/core/journal_plugin_medication_taken.json +15 -0
  109. clinestra-0.3.0/src/clinestra/packs/core/journal_plugin_vitals_log.json +28 -0
  110. clinestra-0.3.0/src/clinestra/packs/core/journey_opd_flow.json +35 -0
  111. clinestra-0.3.0/src/clinestra/packs/core/note_page_general_case_sheet.json +65 -0
  112. clinestra-0.3.0/src/clinestra/packs/core/note_page_vitals_chart.json +42 -0
  113. clinestra-0.3.0/src/clinestra/packs/core/pack.json +31 -0
  114. clinestra-0.3.0/src/clinestra/packs/core/reaction_outcome_achieved_task.json +20 -0
  115. clinestra-0.3.0/src/clinestra/packs/core/routine_ward_vitals.json +17 -0
  116. clinestra-0.3.0/src/clinestra/packs/core/task_follow_up_call.json +23 -0
  117. clinestra-0.3.0/src/clinestra/packs/general_opd/care_team_opd_team.json +46 -0
  118. clinestra-0.3.0/src/clinestra/packs/general_opd/clinical_document_opd_visit_summary.json +10 -0
  119. clinestra-0.3.0/src/clinestra/packs/general_opd/clinical_setting_opd_clinic.json +20 -0
  120. clinestra-0.3.0/src/clinestra/packs/general_opd/encounter_opd_follow_up_visit.json +19 -0
  121. clinestra-0.3.0/src/clinestra/packs/general_opd/encounter_opd_new_visit.json +19 -0
  122. clinestra-0.3.0/src/clinestra/packs/general_opd/journey_opd_visit_flow.json +96 -0
  123. clinestra-0.3.0/src/clinestra/packs/general_opd/note_page_opd_consultation.json +48 -0
  124. clinestra-0.3.0/src/clinestra/packs/general_opd/note_page_opd_triage.json +83 -0
  125. clinestra-0.3.0/src/clinestra/packs/general_opd/pack.json +21 -0
  126. clinestra-0.3.0/src/clinestra/packs/general_opd/task_opd_follow_up_reminder.json +20 -0
  127. clinestra-0.3.0/src/clinestra/packs/general_opd/task_opd_results_review.json +23 -0
  128. clinestra-0.3.0/src/clinestra/packs/home_care/care_team_home_team.json +41 -0
  129. clinestra-0.3.0/src/clinestra/packs/home_care/clinical_setting_home_service.json +20 -0
  130. clinestra-0.3.0/src/clinestra/packs/home_care/encounter_home_visit.json +18 -0
  131. clinestra-0.3.0/src/clinestra/packs/home_care/journal_plugin_home_daily_log.json +33 -0
  132. clinestra-0.3.0/src/clinestra/packs/home_care/journey_home_visit_flow.json +58 -0
  133. clinestra-0.3.0/src/clinestra/packs/home_care/note_page_home_visit_note.json +75 -0
  134. clinestra-0.3.0/src/clinestra/packs/home_care/pack.json +19 -0
  135. clinestra-0.3.0/src/clinestra/packs/home_care/routine_home_visit_planning.json +16 -0
  136. clinestra-0.3.0/src/clinestra/packs/home_care/task_home_escalation.json +24 -0
  137. clinestra-0.3.0/src/clinestra/packs/medical_ward/care_team_ward_team.json +38 -0
  138. clinestra-0.3.0/src/clinestra/packs/medical_ward/clinical_document_ward_discharge_letter.json +10 -0
  139. clinestra-0.3.0/src/clinestra/packs/medical_ward/clinical_setting_ward_unit.json +20 -0
  140. clinestra-0.3.0/src/clinestra/packs/medical_ward/encounter_ward_admission_episode.json +19 -0
  141. clinestra-0.3.0/src/clinestra/packs/medical_ward/journey_ward_pathway.json +80 -0
  142. clinestra-0.3.0/src/clinestra/packs/medical_ward/note_page_ward_admission.json +40 -0
  143. clinestra-0.3.0/src/clinestra/packs/medical_ward/note_page_ward_discharge.json +40 -0
  144. clinestra-0.3.0/src/clinestra/packs/medical_ward/note_page_ward_obs.json +69 -0
  145. clinestra-0.3.0/src/clinestra/packs/medical_ward/note_page_ward_round.json +23 -0
  146. clinestra-0.3.0/src/clinestra/packs/medical_ward/pack.json +23 -0
  147. clinestra-0.3.0/src/clinestra/packs/medical_ward/routine_ward_doctor_round.json +17 -0
  148. clinestra-0.3.0/src/clinestra/packs/medical_ward/routine_ward_obs_round.json +17 -0
  149. clinestra-0.3.0/src/clinestra/packs/medical_ward/task_ward_discharge_prep.json +23 -0
  150. clinestra-0.3.0/src/clinestra/packs/surgical_ward/care_team_surg_team.json +59 -0
  151. clinestra-0.3.0/src/clinestra/packs/surgical_ward/clinical_document_surg_discharge_letter.json +10 -0
  152. clinestra-0.3.0/src/clinestra/packs/surgical_ward/clinical_setting_surg_ward_unit.json +21 -0
  153. clinestra-0.3.0/src/clinestra/packs/surgical_ward/encounter_surg_admission_episode.json +21 -0
  154. clinestra-0.3.0/src/clinestra/packs/surgical_ward/health_profile_surg_periop.json +20 -0
  155. clinestra-0.3.0/src/clinestra/packs/surgical_ward/journey_surg_pathway.json +139 -0
  156. clinestra-0.3.0/src/clinestra/packs/surgical_ward/note_page_surg_admission.json +44 -0
  157. clinestra-0.3.0/src/clinestra/packs/surgical_ward/note_page_surg_checklist.json +64 -0
  158. clinestra-0.3.0/src/clinestra/packs/surgical_ward/note_page_surg_discharge.json +51 -0
  159. clinestra-0.3.0/src/clinestra/packs/surgical_ward/note_page_surg_operative.json +51 -0
  160. clinestra-0.3.0/src/clinestra/packs/surgical_ward/note_page_surg_postop_obs.json +89 -0
  161. clinestra-0.3.0/src/clinestra/packs/surgical_ward/note_page_surg_preop.json +39 -0
  162. clinestra-0.3.0/src/clinestra/packs/surgical_ward/pack.json +28 -0
  163. clinestra-0.3.0/src/clinestra/packs/surgical_ward/routine_surg_obs_round.json +17 -0
  164. clinestra-0.3.0/src/clinestra/packs/surgical_ward/routine_surg_wound_check.json +17 -0
  165. clinestra-0.3.0/src/clinestra/packs/surgical_ward/task_surg_discharge_prep.json +26 -0
  166. clinestra-0.3.0/src/clinestra/packs/surgical_ward/task_surg_post_discharge_call.json +20 -0
  167. clinestra-0.3.0/src/clinestra/packs/surgical_ward/task_surg_preop_prep.json +26 -0
  168. clinestra-0.3.0/src/clinestra/packs_loader.py +67 -0
  169. clinestra-0.3.0/src/clinestra/providers/__init__.py +69 -0
  170. clinestra-0.3.0/src/clinestra/providers/remote.py +87 -0
  171. clinestra-0.3.0/src/clinestra/secrets.py +110 -0
  172. clinestra-0.3.0/src/clinestra/server/__init__.py +8 -0
  173. clinestra-0.3.0/src/clinestra/server/accounts.py +319 -0
  174. clinestra-0.3.0/src/clinestra/server/agentic/__init__.py +4 -0
  175. clinestra-0.3.0/src/clinestra/server/agentic/agents.py +457 -0
  176. clinestra-0.3.0/src/clinestra/server/agentic/content_blocks.py +179 -0
  177. clinestra-0.3.0/src/clinestra/server/agentic/defaults.py +148 -0
  178. clinestra-0.3.0/src/clinestra/server/agentic/deid.py +39 -0
  179. clinestra-0.3.0/src/clinestra/server/agentic/levels.py +100 -0
  180. clinestra-0.3.0/src/clinestra/server/agentic/local.py +110 -0
  181. clinestra-0.3.0/src/clinestra/server/agentic/openai_compat.py +168 -0
  182. clinestra-0.3.0/src/clinestra/server/agentic/runtime.py +219 -0
  183. clinestra-0.3.0/src/clinestra/server/agentic/skills.py +98 -0
  184. clinestra-0.3.0/src/clinestra/server/agentic/state.py +90 -0
  185. clinestra-0.3.0/src/clinestra/server/agentic/toolbox.py +157 -0
  186. clinestra-0.3.0/src/clinestra/server/agentic/tools.py +449 -0
  187. clinestra-0.3.0/src/clinestra/server/ai_routes.py +1061 -0
  188. clinestra-0.3.0/src/clinestra/server/app.py +496 -0
  189. clinestra-0.3.0/src/clinestra/server/auth.py +164 -0
  190. clinestra-0.3.0/src/clinestra/server/consents.py +547 -0
  191. clinestra-0.3.0/src/clinestra/server/emr_routes.py +510 -0
  192. clinestra-0.3.0/src/clinestra/server/portal/__init__.py +16 -0
  193. clinestra-0.3.0/src/clinestra/server/portal/interview.py +281 -0
  194. clinestra-0.3.0/src/clinestra/server/portal/sessions.py +426 -0
  195. clinestra-0.3.0/src/clinestra/settings.py +45 -0
  196. clinestra-0.3.0/src/clinestra/spec.py +248 -0
  197. clinestra-0.3.0/src/clinestra/storage.py +272 -0
  198. clinestra-0.3.0/tests/conftest.py +4 -0
  199. clinestra-0.3.0/tests/test_accounts.py +53 -0
  200. clinestra-0.3.0/tests/test_agent_levels.py +108 -0
  201. clinestra-0.3.0/tests/test_ai_portal.py +301 -0
  202. clinestra-0.3.0/tests/test_change_set.py +221 -0
  203. clinestra-0.3.0/tests/test_cli.py +479 -0
  204. clinestra-0.3.0/tests/test_consent_forms.py +113 -0
  205. clinestra-0.3.0/tests/test_content_blocks.py +18 -0
  206. clinestra-0.3.0/tests/test_core.py +466 -0
  207. clinestra-0.3.0/tests/test_default_packs.py +84 -0
  208. clinestra-0.3.0/tests/test_doc_examples.py +28 -0
  209. clinestra-0.3.0/tests/test_doc_flows.py +182 -0
  210. clinestra-0.3.0/tests/test_emr_canvas.py +51 -0
  211. clinestra-0.3.0/tests/test_emr_scribe.py +67 -0
  212. clinestra-0.3.0/tests/test_engine.py +72 -0
  213. clinestra-0.3.0/tests/test_openai_compat.py +40 -0
  214. clinestra-0.3.0/tests/test_postgres.py +143 -0
  215. clinestra-0.3.0/tests/test_security.py +32 -0
  216. clinestra-0.3.0/tests/test_tools_and_api.py +181 -0
  217. clinestra-0.3.0/tests/test_workflows.py +89 -0
@@ -0,0 +1,37 @@
1
+ # Data and databases
2
+ *.db
3
+ *.db-shm
4
+ *.db-wal
5
+ *.sqlite
6
+ *.sqlite3
7
+
8
+ # Keys and secrets
9
+ *.key
10
+ *.pem
11
+ keys.json
12
+ LOGINS*.md
13
+ .env
14
+ .env.*
15
+ !.env.example
16
+
17
+ # Virtual environments
18
+ .venv/
19
+ .venv-*/
20
+ venv/
21
+ env/
22
+
23
+ # Build output
24
+ dist/
25
+ build/
26
+ *.egg-info/
27
+ *.whl
28
+ *.tar.gz
29
+
30
+ # Caches
31
+ __pycache__/
32
+ *.py[cod]
33
+ .pytest_cache/
34
+ .mypy_cache/
35
+ .ruff_cache/
36
+ .coverage
37
+ htmlcov/
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0
4
+
5
+ - Records made from a `cohort_key`, `protocol_key` or `plugin_key` now store `definition_id` and `definition_version`. Previously only records created with `definition_key` did.
6
+ - Cohort entry and exit actions use the definition version the patient enrolled under, even if it has been retired. Records with no stored version still use the latest.
7
+ - In production mode, those same records now require a clinically approved definition, as `definition_key` records already did.
8
+ - `clinestra demo` no longer crashes on a Windows console that is not UTF-8.
9
+ - `LICENSE` contains the full GNU AGPL v3 text.
10
+ - Removed the `care_model` concept, its provider interface and its routes. Concepts are now 31.
11
+ - The MDD pack is no longer installed. It lives in `examples/packs/mdd`; load it by path. The default packs are `core` only.
12
+ - `CLINESTRA_ADMIN_ALL_ROLES` is off by default, so an admin no longer acts as a clinician unless it is set to `1`.
13
+ - Install extras: `clinestra[full]` is the API and AI install. `[all]` is an alias of it and no longer installs test tools. Contributors use `[dev]`.
14
+ - `clinestra demo` runs on the core pack.
15
+ - The source package and wheel include `LICENSE`.
16
+ - New commands: `doctor`, `audit verify`, `schema`, `pack new`, `pack validate`. `concepts` and `packs` gain `--json`; `packs` prints a table by default. `serve --dev` is refused on non-local hosts. Errors are one line, with exit code 1.
17
+
18
+ ## 0.2.0
19
+
20
+ - Regimens start as `proposed` and create medications only after a second clinician counter-signs and the regimen becomes `active`. Orders from a regimen are proposed care actions and are not dispatched.
21
+ - Definitions carry review metadata. Protocols, regimens, reactions and cohorts cannot be published without a citation and an approval from someone other than the author.
22
+ - Production mode refuses unapproved definitions, plaintext API keys, and a master key file next to the database.
23
+ - Portal OTP answers do not reveal whether a phone is registered. `dev_fixed` is limited to development. Sessions from a previous process epoch are rejected.
24
+ - API keys can be stored as HMAC-SHA256 hashes (`clinestra keys import`). New keys must be at least 32 characters.
25
+ - Calculator and assessment runs return a `usage_id`. A null reference range does not raise a flag. Expression errors return 422.
26
+ - The default AI policy does not send patient identifiers.