Skip to content

Conversation

@alhendrickson
Copy link
Collaborator

@alhendrickson alhendrickson commented Jan 8, 2026

  • feat(medcat-service): Demo page can now click annotations to view details
  • feat(medcat-service): Create AnonCAT demo page
  • style(medcat-service): Improve page formatting and display
  • build(medcat-service): Update gradio and fastapi version
  • refactor(medcat-service): Put example text into its own text files

Screenshots

Before

Pasted image 20260202150717

After

Pasted image 20260202172800

After: Anoncat demo

Split into two tabs to show details. First tab should be at least as good as existing one

Screenshot_2-2-2026_184210_localhost

image

@alhendrickson alhendrickson added the preview Preview changes label Jan 8, 2026
@alhendrickson alhendrickson removed the preview Preview changes label Jan 27, 2026
@alhendrickson alhendrickson reopened this Feb 2, 2026
@alhendrickson alhendrickson marked this pull request as ready for review February 2, 2026 17:30
@alhendrickson alhendrickson changed the title feat(medcat-service): Medcat Demo uplift in Gradio feat(medcat-service): Medcat Demo and AnonCAT demo uplift in Gradio Feb 2, 2026
@alhendrickson alhendrickson added the preview Preview changes label Feb 2, 2026
Copy link
Collaborator

@mart-r mart-r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this looks great!

Left a few comments on type hints for return types.

And one on the long-winded setup for the demo web interface that I think could use some refactoring for better readability and to reduce nesting.

]


def perform_named_entity_resolution(input_text: str, redact: bool | None = None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps adding the return type a type hint here would be useful? You've descried it in the docs anyway (though it's missing the last str).

I.e -> tuple[dict, list[list[str]], str]

return response_tuple


def medcat_demo_perform_named_entity_resolution(input_text: str):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, including the return type (-> tuple[dict, list[list[str]]]) could be useful.

return result[0], result[1]


def anoncat_demo_perform_deidentification(input_text: str, redact: bool):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, return type might be useful.

return annotation_details_placeholder_text


if settings.deid_mode:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little off to me. I suppose global state is to be expected here, but I wouldn't expect as much code to exist just within the module scope.

Both these (if / else) follow a pretty similar pattern (gr.Block -> gr.Row -> gr.Column), perhaps there's a way to simplify these to avoid some of the duplication?
But perhaps I'd just feel better if the logic (i.e the DeID mode and the regular NER+L mode) were just in their own separate methods that were called here.

The other thing to note is that there's quite a bit of nesting here (6 layers deep). Perhaps we can mitigate that a little? Perhaps we could split out some parts to separate methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Preview changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants