You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating an Instruct command, the interpreter on the home-app side takes the first result from science for the provided instruction, following this code:
first_result = (
next(iter(search_for_instructions(instruction)), None) if instruction else None
)
The consequence is that if there are two instructions, one containing the same characters than the other with a few additional ones and having a better score, it is always chosen.
So, when trying to create an Instruct command for the instruction Advice to return, it always ends up with the instruction Advice to return to work based on this request:
Here is some plugin code to reproduce the issue:
from canvas_sdk.commands.commands.instruct import InstructCommand
from canvas_sdk.effects import Effect
from canvas_sdk.events import EventType
from canvas_sdk.protocols import BaseProtocol
from canvas_sdk.v1.data.note import Note
from logger import log
class Commander(BaseProtocol):
RESPONDS_TO = [
EventType.Name(EventType.PATIENT_PROFILE__SECTION_CONFIGURATION),
]
def compute(self) -> list[Effect]:
patient_uuid = self.target
note = Note.objects.filter(patient__id=patient_uuid).order_by('-dbid').first()
note_uuid = str(note.id)
commands = [
InstructCommand(
instruction="Advice to return",
comment='Follow up and come back to the clinic in two weeks.',
note_uuid=note_uuid,
)
]
log.info('--------------------')
log.info(f"event {self.event.name}")
log.info(f"patient_uuid {patient_uuid}")
log.info(f"note_uuid {note_uuid}")
log.info(f"commands {len(commands)}")
log.info('--------------------')
return [command.originate() for command in commands]
The text was updated successfully, but these errors were encountered:
Another approach, which doesn't solve the specific problem with search result selection, would be to allow specification of SNOMED code itself in the Instruct class constructor so there is direct control. Right now, there is no direct control over the SNOMED code.
When creating an
Instruct
command, the interpreter on thehome-app
side takes the first result fromscience
for the provided instruction, following this code:The consequence is that if there are two instructions, one containing the same characters than the other with a few additional ones and having a better score, it is always chosen.
So, when trying to create an
Instruct
command for the instructionAdvice to return
, it always ends up with the instructionAdvice to return to work
based on this request:Here is some plugin code to reproduce the issue:
The text was updated successfully, but these errors were encountered: