Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennifer Jiang-Kells authored and Jennifer Jiang-Kells committed Jun 13, 2024
1 parent 0999ea1 commit 78b7f24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pydantic import BaseModel

from healthchain.base import BaseStrategy, BaseUseCase, UseCaseType
from healthchain.fhir_resources.bundle_resources import Bundle_EntryModel, BundleModel
from healthchain.models.data.cdsfhirdata import CdsFhirData
from healthchain.models.requests.cdsrequest import CDSRequest
from healthchain.use_cases.cds import ClinicalDecisionSupportStrategy
from healthchain.clients import EHRClient
Expand All @@ -25,7 +27,10 @@ class synth_data:

class MockDataGenerator:
def __init__(self) -> None:
self.data = synth_data(context={}, prefetch=MockBundle())
self.data = CdsFhirData(
context={}, prefetch=BundleModel(entry=[Bundle_EntryModel()])
)
# self.data = synth_data(context={}, prefetch=MockBundle())
self.workflow = None

def set_workflow(self, workflow):
Expand All @@ -39,17 +44,17 @@ def cds_strategy():

@pytest.fixture
def valid_data():
return synth_data(
return CdsFhirData(
context={"userId": "Practitioner/123", "patientId": "123"},
prefetch=MockBundle(),
prefetch=BundleModel(entry=[Bundle_EntryModel()]),
)


@pytest.fixture
def invalid_data():
return synth_data(
return CdsFhirData(
context={"invalidId": "Practitioner", "patientId": "123"},
prefetch=MockBundle(),
prefetch=BundleModel(entry=[Bundle_EntryModel()]),
)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_service_with_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def load_data(self):
def llm(self, text: str):
return [
Card(
summary=self.data_generator.data.prefetch.condition,
summary="test",
indicator="info",
source={"label": "website"},
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_valid_data_request_construction(cds_strategy, valid_data):
mock_init.assert_called_once_with(
hook=Workflow.patient_view.value,
context=PatientViewContext(userId="Practitioner/123", patientId="123"),
prefetch={},
prefetch={"entry": [{}]},
)


Expand Down

0 comments on commit 78b7f24

Please sign in to comment.