dhti-cli 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,409 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
374
+
375
+ ---------------------
376
+
377
+ Healthcare Disclaimer
378
+
379
+ In the United States, or any other jurisdictions where they may apply, the
380
+ following additional disclaimer of warranty and limitation of liability are
381
+ hereby incorporated into the terms and conditions of MPL 2.0:
382
+
383
+ 1. No warranties of any kind whatsoever are made as to the results that
384
+ You will obtain from relying upon the covered code (or any information
385
+ or content obtained by way of the covered code), including but not
386
+ limited to compliance with privacy laws or regulations or clinical
387
+ care industry standards and protocols. Use of the covered code is not
388
+ a substitute for a health care provider’s standard practice or
389
+ professional judgment. Any decision with regard to the appropriateness
390
+ of treatment, or the validity or reliability of information or content
391
+ made available by the covered code, is the sole responsibility of the
392
+ health care provider. Consequently, it is incumbent upon each health
393
+ care provider to verify all medical history and treatment plans with
394
+ each patient.
395
+
396
+ 2. Under no circumstances and under no legal theory, whether tort
397
+ (including negligence), contract, or otherwise, shall any Contributor,
398
+ or anyone who distributes Covered Software as permitted by the
399
+ license, be liable to You for any indirect, special, incidental,
400
+ consequential damages of any character including, without limitation,
401
+ damages for loss of goodwill, work stoppage, computer failure or
402
+ malfunction, or any and all other damages or losses, of any nature
403
+ whatsoever (direct or otherwise) on account of or associated with the
404
+ use or inability to use the covered content (including, without
405
+ limitation, the use of information or content made available by the
406
+ covered code, all documentation associated therewith, and the failure
407
+ of the covered code to comply with privacy laws and regulations or
408
+ clinical care industry standards and protocols), even if such party
409
+ shall have been informed of the possibility of such damages.
package/README.md ADDED
@@ -0,0 +1,239 @@
1
+
2
+ <p align="center">
3
+ <img src="https://github.com/dermatologist/dhti/blob/develop/notes/dhti-logo.jpg" />
4
+ </p>
5
+
6
+ [![npm version](https://badge.fury.io/js/dhti.svg)](https://www.npmjs.com/package/dhti)
7
+ [![npm](https://img.shields.io/npm/dt/dhti)](https://www.npmjs.com/package/dhti)
8
+ [![Build](https://github.com/dermatologist/dhti/workflows/CI/badge.svg)](https://nuchange.ca)
9
+ [![Known Vulnerabilities](https://snyk.io/test/github/dermatologist/dhti/badge.svg)](https://www.npmjs.com/package/dhti)
10
+ [![Documentation](https://badgen.net/badge/icon/documentation?icon=libraries&label)](https://dermatologist.github.io/dhti/)
11
+
12
+ ## About
13
+ - 🚀 *Dhanvantari rose out of the water with his four hands, holding a pot full of elixirs!*
14
+
15
+ TL; DR: **dhti-cli is for quick prototyping, developing, sharing and testing of Gen AI applications, models, and UI elements within the context of an electronic health record.**
16
+ [Paper coming soon!](https://nuchange.ca)
17
+
18
+ Gen AI can transform medicine. But it needs a framework for collaborative research and practice. DHTI is a reference architecture and an implementation for such a framework that integrates an EMR ([OpenMRS](https://openmrs.org/)), :link: Gen AI application server ([LangServe](https://python.langchain.com/v0.2/docs/langserve/)), self-hosted LLMs for privacy ([Ollama](https://ollama.com/)), tools on [MCP server](https://github.com/dermatologist/fhir-mcp-server), vector store for RAG ([redis](https://redis.io/)), monitoring ([LangFuse](https://langfuse.com/)), 🔥 FHIR repository with [CQL](https://nuchange.ca/2025/06/v-llm-in-the-loop-cql-execution-with-unstructured-data-and-fhir-terminology-support.html) support ([HAPI](https://cloud.alphora.com/sandbox/r4/cqm/)) and graph utilities ([Neo4j](https://neo4j.com/)) in one docker-compose! DHTI is inspired by [Bahmni](https://www.bahmni.org/) and **aims to facilitate GenAI adoption and research in areas with low resources.** The MCP server hosts pluggable, agent-invokable tools (FHIR query, summarization, terminology lookup, custom analytics, etc.) that you can extend without modifying core services.
19
+
20
+ The essence of DHTI is *modularity* with an emphasis on *configuration!* It is non-opinionated on LLMs, hyperparameters and pretty much everything. DHTI supports installable Gen AI routines through [LangChain templates](https://templates.langchain.com/) (which we call :curry: **elixir**) and installable UI elements through [OpenMRS O3](https://o3-docs.openmrs.org/) React container (which we call :shell: **conch**). 🔥 FHIR is used for backend and [CDS-Hooks](https://cds-hooks.org/) for frontend communication, decoupling conches from OpenMRS, making them potentially usable with any health information system. We have a [fork of the cds-hook sandbox](https://github.com/dermatologist/cds-hooks-sandbox/tree/dhti-1) for testing that uses the [order-select](https://cds-hooks.org/hooks/order-select/) hook, utilizing the contentString from the [FHIR CommunicationRequest](https://build.fhir.org/communicationrequest.html) within the [cds-hook context](https://cds-hooks.org/examples/) for user inputs (recommended).
21
+
22
+ <p align="center">
23
+ <img src="https://github.com/dermatologist/dhti/blob/develop/notes/cds-hook-sandbox.jpg" />
24
+ </p>
25
+
26
+ 🚀 dhti-cli is a CLI tool for quick prototyping and testing of elixirs and conches. You can create a new docker-compose with required modules, start/stop services, install Elixirs and conch, create Docker images for them, and more. 🚀 This helps to test new ideas and share them with others quickly. 🚀 Once tested, you can transition them to the production team for deployment. Adoption of standards makes this transition easier!
27
+
28
+ ⭐️ **Pitched at [Falling Walls Lab Illinois](https://falling-walls.com/falling-walls-lab-illinois) and released on 09/12/2025.**
29
+
30
+ ## What problems do DHTI solve?
31
+
32
+ | Why | How |
33
+ | --- | --- |
34
+ | I know LangChain, but I don’t know how to build a chain/agent based on data in our EHR. | [This template](https://github.com/dermatologist/dhti-elixir-template) adopts FHIR and cds-hooks as standards for data retrieval and display. The [base class](https://github.com/dermatologist/dhti-elixir-base) provides reusable artifacts |
35
+ | I need a simple platform for experimenting. | This repository provides everything to start experimenting fast. The command-line tools help to virtualize and orchestrate your experiments using [Docker](https://www.docker.com/)|
36
+ | I am a UI designer. I want to design helpful UI for real users. | See [this template](https://github.com/dermatologist/openmrs-esm-dhti-template). It shows how to build interface components (conches) for [OpenMRS](https://openmrs.org/) an open-source EMR used by many. Read more about [OpenMRS UI](https://o3-docs.openmrs.org/) |
37
+ | We use another EMR | Your EMR may support CDS-Hook for displaying components. In that case, you can use [cds-hooks-sandbox for testing](https://github.com/dermatologist/cds-hooks-sandbox/tree/dhti-1) |
38
+ | Our IT team is often unable to take my experiments to production. | Use DHTI, follow the recommended patterns, and you will make their lives easier.|
39
+
40
+
41
+ ## Architecture
42
+ <p align="center">
43
+ <img src="https://github.com/dermatologist/dhti/blob/develop/notes/arch-1.drawio.svg" />
44
+ </p>
45
+
46
+ ## ✨ Features
47
+ * **Modular**: Supports installable Gen AI routines and UI elements.
48
+ * **Quick prototyping**: CLI helps in quick prototyping and testing of Gen AI routines and UI elements.
49
+ * **Easy to use**: Can be installed in a few minutes.
50
+ * **Developer friendly**: Copy working files to running containers for testing.
51
+ * **Dependency Injection**: Dependency injection for models and hyperparameters for configuring elixirs.
52
+ * **Generate synthetic data**: DHTI supports generating synthetic data for testing.
53
+ * **CQL support**: [CQL for clinical decision support](https://nuchange.ca/2025/06/v-llm-in-the-loop-cql-execution-with-unstructured-data-and-fhir-terminology-support.html).
54
+ * **FHIR**: Data exchange with FHIR schema.
55
+ * **MCP**: Built in MCP server for pluggable tools.
56
+ * **EMR**: Built in EMR, OpenMRS, for patient records.
57
+ * **Vector store**: Redis for vector store.
58
+ * **Monitoring**: LangFuse for monitoring.
59
+ * **Graph utilities**: Neo4j for graph utilities.
60
+ * **LLM**: Ollama for self-hosting LLM models.
61
+
62
+ ## 🔧 For Gen AI Developers
63
+
64
+ *Developers can build elixirs and conchs for DHTI.*
65
+
66
+ :curry: Elixirs are [LangChain templates]((https://templates.langchain.com/)) for backend GenAI functionality. By convention, Elixirs are prefixed with *dhti-elixir-* and all elixirs depend on [dhti-elixir-base](https://github.com/dermatologist/dhti-elixir-base) which provides some base classes and defines dependencies. You can use [this template](https://github.com/dermatologist/dhti-elixir-template) to build new elixirs, and license it the way you want (We :heart: open-source!).
67
+
68
+ :shell: Conches are [OpenMRS O3s](https://o3-docs.openmrs.org/) and follow the standard naming convention *openmrs-esm-*. A separate OpenMRS independant container for conchs is on our roadmap for use outside OpenMRS. You can use [this template](https://github.com/dermatologist/openmrs-esm-dhti-template) to build new conches.
69
+
70
+ :white_check_mark:
71
+ * **Developer friendly**: Copy working files to running containers for testing.
72
+ * **Dependency Injection**: Dependency injection for models and hyperparameters for configuring elixirs.
73
+
74
+ ## 🧠 For Gen AI Researchers
75
+
76
+ *DHTI provides a platform to deploy language models and Gen AI applications in the context of an electronic health record.*
77
+
78
+ DHTI serves as a platform for testing prompts, chains and agents in healthcare applications. Since the stack uses the :fire: FHIR data model, it is easy to load synthetic data.
79
+
80
+ Tools to fine-tune language models for the stack are on our roadmap. We encourage all language models built for this platform to be open sourced on [HuggingFace](https://huggingface.co/) with the names starting with *dhti-*.
81
+
82
+ :white_check_mark:
83
+ * **Generate synthetic data**: DHTI supports generating synthetic data for testing.
84
+ * **CQL support**: [CQL for clinical decision support](https://nuchange.ca/2025/06/v-llm-in-the-loop-cql-execution-with-unstructured-data-and-fhir-terminology-support.html).
85
+ * **FHIR**: Data exchange with FHIR schema.
86
+ * **EMR**: Built in EMR, OpenMRS, for patient records.
87
+
88
+ 🌈 *Join us to make the Gen AI equitable and help doctors save lives!*
89
+
90
+ ## :sparkles: Resources
91
+ * [fhiry](https://github.com/dermatologist/fhiry): FHIR to pandas dataframe for data analytics, AI and ML!
92
+ * [pyOMOP](https://github.com/dermatologist/pyomop): For OMOP CDM support
93
+
94
+ ## :sparkles: Resources (in Beta)
95
+ * [dhti-elixir-base](https://github.com/dermatologist/dhti-elixir-base): Base classes for dhti-elixir
96
+ * [dhti-elixir-template](https://github.com/dermatologist/dhti-elixir-template): A template for creating new dhti-elixirs.
97
+ * [fhir-mcp-server](https://github.com/dermatologist/fhir-mcp-server): A MCP server for hosting FHIR-compliant tools.
98
+
99
+ ## :sparkles: Resources (in Alpha)
100
+ * [cookiecutter for scaffolding elixirs](https://github.com/dermatologist/cookiecutter-uv)
101
+ * [cds-hooks-sandbox for testing](https://github.com/dermatologist/cds-hooks-sandbox/tree/dhti-1)
102
+
103
+ ## :sunglasses: Coming soon
104
+
105
+ * [dhti-elixir-fhire](https://github.com/dermatologist/dhti-elixir-fhire): An elixir for extracting embeddings from FHIR resources for Q&A on patient records.
106
+ * [dhti-elixir-fhirs](https://github.com/dermatologist/dhti-elixir-fhirs): An elixir for text to FHIR search query conversion.
107
+ * [dhti-elixir-upload](https://github.com/dermatologist/dhti-elixir-upload-file): Upload documents to the vector store for clinical knowledgebase and clinical trial matching.
108
+ * [openmrs-esm-qa](https://github.com/dermatologist/openmrs-esm-genai): A sample conch for Q&A on patient records using the dhti-elixir-fhire elixir.
109
+
110
+ ## 🔧 Usage
111
+
112
+ ### List of plugins
113
+ ```
114
+ dhti-cli help
115
+ ```
116
+
117
+ ### Get help for each plugin
118
+ * As an example, get help for compose:
119
+
120
+ ```
121
+ dhti-cli compose --help
122
+ ```
123
+
124
+ ### 🏗️ *Try it out! It takes only a few minutes to setup GenAI backed EMR in your local machine!*
125
+
126
+ You only need:
127
+ * docker
128
+ * nodejs
129
+
130
+ ## :walking: Step 1
131
+
132
+ * Git clone this repository: `git clone https://github.com/dermatologist/dhti.git && cd dhti`
133
+ * Install the required packages: `npm install`
134
+ * Build the CLI: `npm run build`
135
+ * Install CLI locally: `npm link`
136
+ * Test the CLI: `dhti-cli help` *This will show the available commands.*
137
+ * The working directory is `~/dhti` (Customizable)
138
+
139
+ ### 🔧 Create a new docker-compose
140
+ * Create a new docker-compose file: `dhti-cli compose add -m openmrs -m langserve`
141
+
142
+ * The docker-compose.yml is created with the following modules:
143
+ - OpenMRS (EMR)
144
+ - LangServe (API for LLM models)
145
+
146
+ Other available modules: `ollama, langfuse, cqlFhir, redis, neo4j and mcpFhir` (Documentation in progress)
147
+
148
+ You can read the newly created docker-compose by: `dhti-cli compose read`
149
+
150
+
151
+ ### 🚀 Start the services for initial setup
152
+ * Start the services: `dhti-cli docker -u`
153
+
154
+ It may take a while to download the images and start the services. ([OpenMRS](https://openmrs.org/) may take upto 45 mins the first time to setup the database)
155
+
156
+
157
+ ### 🚀 Access OpenMRS and login:
158
+ * Go to `http://localhost/openmrs/spa/home`
159
+ * Login with the following credentials:
160
+ - Username: admin
161
+ - Password: Admin123
162
+ - Choose any location and click on 'confirm'.
163
+
164
+ ### 🚀 Access the LangServe API
165
+ * Go to `localhost:8001/docs` (Empty Swagger UI)
166
+
167
+ ## Congratulations! You have successfully setup DHTI! :tada:
168
+ * Shut down the services: `dhti-cli docker -d`
169
+
170
+ ## :running: STEP 2: 🛠️ *Now let us Install an Elixir (Gen AI functionalities are packaged as elixirs)*
171
+
172
+ * Let's install the elixir here: https://github.com/dermatologist/dhti-elixir-template. This is just a template that uses a Mock LLM to output random text. You can use this template to build your own elixirs! (Cookiecutter to be released soon!) Later you will see how to add real LLM support.
173
+
174
+ :running:
175
+
176
+ `dhti-cli elixir install -g https://github.com/dermatologist/dhti-elixir-template.git -n dhti-elixir-template`.
177
+
178
+ You may also install from PyPi or a wheel file!
179
+
180
+ ### 🔍 Examine bootstrap.py (Optional)
181
+ `cat ~/dhti/elixir/app/bootstrap.py`
182
+
183
+ This is where you can override defaults in the elixir for *LLM, embedding model, hyperparameters etc that are injected at runtime.* Refer to each elixir for the available options. [You may check out how to inject a real LLM using Google Gemini!](/notes/add-llm.md)
184
+
185
+ ### 🔧 Create docker container
186
+ `dhti-cli docker -n beapen/genai-test:1.0 -t elixir`
187
+
188
+ (You may replace `beapen/genai-test:1.0` with your own image name)
189
+
190
+ ### 🚀 Congratulations! You installed your first elixir. We will see it in action later!
191
+
192
+ While developing you can copy the app folder to a running container for testing (provided there are no changes in dependencies). Read more [here](/notes/dev-copy.md).
193
+
194
+ ## STEP 3: :shell: *Now let us Install a Conch (The UI component)*
195
+
196
+ * Let's install the conch here:https://github.com/dermatologist/openmrs-esm-dhti-template. This uses the elixir template that we installed in STEP 2 as the backend. You can use the template to build your own conchs.
197
+
198
+ :shell: `dhti-cli conch install -g https://github.com/dermatologist/openmrs-esm-dhti-template.git -n openmrs-esm-dhti-template`
199
+
200
+ We can also install from a dev folder after cloning the repository. While developing you can copy the dist folder to a running container for testing. Read more [here](/notes/dev-copy.md).
201
+
202
+ ### 🔧 Create new docker container
203
+ `dhti-cli docker -n beapen/conch-test:1.0 -t conch`
204
+
205
+ ## 🚀 It is now time to start DHTI!
206
+
207
+ `dhti-cli docker -u`
208
+
209
+ ### :clap: Access the Conch in OpenMRS and test the integration
210
+
211
+ * Go to `http://localhost/openmrs/spa/home`
212
+ * Login with the following credentials:
213
+ - Username: admin
214
+ - Password: Admin123
215
+
216
+ You will see the new conch in the left margin. Click on **Dhti app** to see the UI.
217
+ This is just a template, though. You can build your own conchs!
218
+
219
+ Add some text to the text area and click on **Submit**.
220
+ You will see the text above the textbox.
221
+
222
+ ### Stop the services
223
+ You can remove the services by: `dhti-cli docker -d`
224
+
225
+ ### The demo uses a template with mock LLM. [Check out how to add real LLM support using Google Gemini.](/notes/add-llm.md)
226
+
227
+ :hugs: **Thank you for trying out DHTI!**
228
+
229
+ ## 🚀 Advanced
230
+
231
+ * [Setting up Ollama](/notes/setup-ollama.md)
232
+ * [CLI Options](/notes/cli-options.md)
233
+
234
+ ## Give us a star ⭐️
235
+ If you find this project useful, give us a star. It helps others discover the project.
236
+
237
+ ## Contributors
238
+
239
+ * [Bell Eapen](https://nuchange.ca) | [![Twitter Follow](https://img.shields.io/twitter/follow/beapen?style=social)](https://twitter.com/beapen)
package/bin/dev.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
package/bin/dev.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
2
+
3
+ // eslint-disable-next-line n/shebang
4
+ import {execute} from '@oclif/core'
5
+
6
+ await execute({development: true, dir: import.meta.url})
package/bin/run.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({dir: import.meta.url})
@@ -0,0 +1,4 @@
1
+ {
2
+ "commands": {},
3
+ "version": "0.1.0"
4
+ }
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "dhti-cli",
3
+ "description": "DHTI CLI",
4
+ "version": "0.1.0",
5
+ "author": "Bell Eapen",
6
+ "bin": {
7
+ "dhti-cli": "bin/run.js"
8
+ },
9
+ "bugs": "https://github.com/dermatologist/dhti/issues",
10
+ "dependencies": {
11
+ "@langchain/community": "^0.3.53",
12
+ "@langchain/ollama": "^0.2.3",
13
+ "@oclif/core": "^4",
14
+ "@oclif/plugin-help": "^6",
15
+ "@oclif/plugin-plugins": "^5",
16
+ "child_process": "^1.0.2",
17
+ "js-yaml": "^4.1.0",
18
+ "medpromptjs": ">=0.4.3",
19
+ "ora": "^8.0.1",
20
+ "request": "^2.88.2"
21
+ },
22
+ "devDependencies": {
23
+ "@oclif/prettier-config": "^0.2.1",
24
+ "@oclif/test": "^4",
25
+ "@types/chai": "^4",
26
+ "@types/js-yaml": "^4.0.9",
27
+ "@types/mocha": "^10",
28
+ "@types/node": "^18",
29
+ "@types/request": "^2.48.12",
30
+ "@types/sinon": "^17.0.4",
31
+ "chai": "^4",
32
+ "eslint": "^8",
33
+ "eslint-config-oclif": "^5",
34
+ "eslint-config-oclif-typescript": "^3",
35
+ "eslint-config-prettier": "^9",
36
+ "mocha": "^10",
37
+ "oclif": "^4",
38
+ "shx": "^0.3.3",
39
+ "sinon": "^21.0.0",
40
+ "ts-node": "^10",
41
+ "typescript": "^5"
42
+ },
43
+ "engines": {
44
+ "node": ">=18.0.0"
45
+ },
46
+ "files": [
47
+ "bin",
48
+ "dist",
49
+ "oclif.manifest.json"
50
+ ],
51
+ "homepage": "https://github.com/dermatologist/dhti",
52
+ "keywords": [
53
+ "oclif"
54
+ ],
55
+ "license": "Apache-2.0",
56
+ "main": "dist/index.js",
57
+ "type": "module",
58
+ "oclif": {
59
+ "bin": "dhti-cli",
60
+ "dirname": "dhti-cli",
61
+ "commands": "./dist/commands",
62
+ "plugins": [
63
+ "@oclif/plugin-help",
64
+ "@oclif/plugin-plugins"
65
+ ],
66
+ "topicSeparator": " ",
67
+ "topics": {
68
+ "hello": {
69
+ "description": "Say hello to the world and others"
70
+ }
71
+ }
72
+ },
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "git+https://github.com/dermatologist/dhti.git"
76
+ },
77
+ "scripts": {
78
+ "build": "shx rm -rf dist && tsc -b",
79
+ "lint": "eslint . --ext .ts",
80
+ "fix": "eslint . --ext .ts --fix",
81
+ "postpack": "shx rm -f oclif.manifest.json",
82
+ "posttest": "echo 'npm run lint'",
83
+ "prepack": "oclif manifest && oclif readme",
84
+ "test": "mocha --forbid-only \"test/**/*.test.ts\"",
85
+ "version": "oclif readme && git add README.md"
86
+ },
87
+ "types": "dist/index.d.ts"
88
+ }