dotimplement / HealthChain

Simplify testing and validating AI and NLP applications in a healthcare context 💫 🏥
https://dotimplement.github.io/HealthChain/
Apache License 2.0
25 stars 15 forks source link

Make client function return request directly instead of data objects? #86

Open jenniferjiangkells opened 1 month ago

jenniferjiangkells commented 1 month ago

Description

Currently the client function requires that a specific type of data object is returned, e.g. CdsFhirData or CcdData. Would it be better to be more explicit to modify the usage so that the client returns the request object directly, which the service receives? I think it's a little less confusing.

Current:

    @hc.ehr(workflow="encounter-discharge")
    def load_data_in_client(self) -> CdsFhirData:
        cds_fhir_data = self.data_generator.generate()
        return cds_fhir_data

    @hc.api
    def my_service(self, request: CDSRequest) -> CDSResponse:
        cds_response = self.pipeline(request)
        return cds_response

Suggested:

    @hc.ehr(workflow="encounter-discharge")
    def load_data_in_client(self) -> CDSRequest:
        # either 
        cds_request = CdsLoader('/path/')
        # or
        cds_request = self.data_generator.generate()

        return cds_request

    @hc.api
    def my_service(self, request: CDSRequest) -> CDSResponse:
        cds_response = self.pipeline(request)
        return cds_response