Skip to content

Commit

Permalink
WIP connector usage in pipelines and components
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferjiangkells committed Oct 14, 2024
1 parent dad5336 commit ee797da
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion healthchain/pipeline/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from healthchain.pipeline.basepipeline import Pipeline
from healthchain.pipeline.components.basecomponent import BaseComponent, Component
from healthchain.pipeline.components.models import Model
from healthchain.pipeline.components.model import Model
from healthchain.pipeline.components.preprocessors import TextPreProcessor
from healthchain.pipeline.components.postprocessors import TextPostProcessor
from healthchain.pipeline.genericpipeline import GenericPipeline
Expand Down
2 changes: 1 addition & 1 deletion healthchain/pipeline/components/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .preprocessors import TextPreProcessor
from .postprocessors import TextPostProcessor
from .models import Model
from .model import Model
from .basecomponent import BaseComponent, Component

__all__ = [
Expand Down
20 changes: 20 additions & 0 deletions healthchain/pipeline/components/llm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from healthchain.pipeline.components.basecomponent import Component
from healthchain.io.containers import Document
from typing import TypeVar, Generic

T = TypeVar("T")


# TODO: implement this class
class LLM(Component[T], Generic[T]):
def __init__(self, model_name: str):
self.model = model_name

def load_model(self):
pass

def load_chain(self):
pass

def __call__(self, doc: Document) -> Document:
return doc
File renamed without changes.
2 changes: 1 addition & 1 deletion healthchain/pipeline/medicalcodingpipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from healthchain.pipeline.basepipeline import Pipeline
from healthchain.pipeline.components.preprocessors import TextPreProcessor
from healthchain.pipeline.components.postprocessors import TextPostProcessor
from healthchain.pipeline.components.models import Model
from healthchain.pipeline.components.model import Model


# TODO: Implement this pipeline in full
Expand Down
19 changes: 19 additions & 0 deletions healthchain/pipeline/summarizationpipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from healthchain.io.cdsfhirconnector import CdsFhirConnector
from healthchain.pipeline.basepipeline import Pipeline
from healthchain.pipeline.components.llm import LLM


# TODO: Implement this pipeline in full
class SummarizationPipeline(Pipeline):
def configure_pipeline(self, model_name: str) -> None:
cds_fhir_connector = CdsFhirConnector(hook_name="encounter-discharge")
self.add_input(cds_fhir_connector)

# Add summarization component
llm = LLM(model_name)
self.add(llm, stage="summarization")

# Maybe you can have components that create cards
# self.add(CardCreator(), stage="card-creation")

self.add_output(cds_fhir_connector)

0 comments on commit ee797da

Please sign in to comment.