Add patient tags support to protocol variables - #673
Merged
marceloarocha merged 1 commit intoSep 6, 2026
Conversation
Adds the "tags" protocol variable field: a list of patient tag names (marcador table) tested with IN/NOTIN against Patient.tags. Comparison is case-insensitive on both sides; a patient without tags never matches IN and always matches NOTIN. - AlertProtocol evaluates the new field and reports matched tags in the trace; unsupported operators are traced as OPERATOR_NOT_SUPPORTED - protocol co-pilot gets a list_tags tool and prompt guidance for the field - unit tests for match/no-match, empty tags, case and trace details Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UT3SoG4j3iqxMvFiR8N4Tf
There was a problem hiding this comment.
The PR successfully implements patient tag support for protocol variables across all layers of the system. The implementation follows existing patterns consistently and includes comprehensive test coverage. The changes integrate cleanly with the protocol evaluation engine, agent tools, and trace functionality.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
marceloarocha
deleted the
claude/pessoa-marcadores-protocol-var-k2st8c
branch
September 6, 2026 13:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for patient tags as a protocol variable field, allowing protocols to trigger based on tags assigned to patients. Tags are compared using IN/NOTIN operators with case-insensitive matching.
Key Changes
tagsfield toProtocolVariableFieldEnumto enable tag-based protocol conditionsalert_protocol.pywith:OPERATOR_NOT_SUPPORTEDreason)list_tags()tool to protocol agent to list active patient tags by name, supporting bothPATIENTandPATIENT_NAVIGATIONtag typesImplementation Details
patient_service._get_tagsconvention)matchedfield showing which tags from the filter list were found in the patient's tagshttps://claude.ai/code/session_01UT3SoG4j3iqxMvFiR8N4Tf