dotimplement / HealthChain

Simplify prototyping and testing LLM applications in healthcare context 💫 🏥
https://dotimplement.github.io/HealthChain/
Apache License 2.0
10 stars 1 forks source link

Refactor Use-case/Workflow strings to be Class objects #21

Open adamkells opened 3 months ago

adamkells commented 3 months ago

Currently the workflows and use-cases (encounter-discharge etc.) are specified through explicit strings 'encounter-discharge'. This runs the risk of users making easy spelling mistakes (i.e. 'encounter_discharge' vs 'encounter-discharge').

It would be better to refactor so that the exact string is hidden away. This will also ensure that the strings live in a centralised place and any renaming only needs to happen in 1 place.

E.g. from healthchain import UseCases use_case = UseCases.EncounterDischarge

jenniferjiangkells commented 3 months ago

It was actually an intentional decision to use strings such as "encounter-discharge" as opposed to importing UseCases as I think it's more aesthetically pleasing in a decorator and it doesn't involve declaring it somewhere else 😛 .

Another reason is because the name of the hook is conventionally named context-action as specified by the CDS documentation, though that might not always be the case. So although we tend to think explicit string = bad, I think there's a risk of abstracting too much away from the user if we keep the hook names hidden.

Nonetheless I do think there should be a method with which the user should be able to see all the options that are available to them as well as better handling of the Workflow string in general. Also document this more clearly.