Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Spacy hard dependency on forte medical ontology #96

Merged

Conversation

Piyush13y
Copy link
Collaborator

@Piyush13y Piyush13y commented Mar 3, 2022

This PR fixes #95.

Description of changes

SpacyProcessor now can be run with the umls_link processor config, without a hard dependency on Forte.
The future scope is to have all medical related ontologies in the Forte-medicine repo, so the default config has been set as so. However, until we reach that point, one can run SpacyProcessor with umls_link config in Forte too, using customized ontology types by passing them as config.

Possible influences of this PR.

No side-effects, ensures consistency and disambiguity in the long run.

@Piyush13y Piyush13y requested a review from hunterhector March 3, 2022 03:37
@Piyush13y Piyush13y changed the title Remove Spacy dependency on forte medical ontology Remove Spacy hard dependency on forte medical ontology Mar 3, 2022
src/spacy/fortex/spacy/spacy_processors.py Outdated Show resolved Hide resolved

entity.umls_entities.append(umls)
setattr(entity, "umls_entities", umls_entries)
Copy link
Member

Choose a reason for hiding this comment

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

I think we cannot do setattr here since the list in forte entries are not normal python lists (https://github.com/asyml/forte/blob/master/ftx/onto/clinical.py#L69). This is because we actually need to store reference instead of the actual content. So we should probably do something like getattr(entity, "umls_entities").append(umls_entry)) (Need to try it out to see if it works).

Copy link
Member

Choose a reason for hiding this comment

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

i also realize the test case didn't test this part: https://github.com/asyml/forte-wrappers/blob/main/tests/wrappers/spacy_processors_test.py, maybe we should add a small test here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have tested the current code, and it does work as expected. I see the umls_entities list populated properly. Maybe because Flist and native lists, both are mutable sequences, we are able to append to Flist through setattr too. I can try using and testing getattr(entity, "umls_entities").append(umls_entry)) as well.

I will add the missing test case for this use case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added "umls_link" working to the existing test cases. Other tests run within seconds, but this one goes on for a very long time on my local machine. And I don't think tests are enabled in forte-wrapper's CI pipeline?

src/spacy/fortex/spacy/spacy_processors.py Outdated Show resolved Hide resolved
src/spacy/fortex/spacy/spacy_processors.py Outdated Show resolved Hide resolved
src/spacy/fortex/spacy/spacy_processors.py Outdated Show resolved Hide resolved
hunterhector
hunterhector previously approved these changes Mar 4, 2022
@Piyush13y Piyush13y requested a review from hunterhector March 11, 2022 23:34
@hunterhector hunterhector merged commit 1af6a3d into asyml:main Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpacyProcessor's hard dependency on Forte's medical ontologies
2 participants