-
Notifications
You must be signed in to change notification settings - Fork 105
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
snomed refset processing update #294
Conversation
medcat/utils/preprocess_snomed.py
Outdated
while len(stack) != 0: | ||
# remove the last element from the stack | ||
current_snomed = stack.pop() | ||
current_snomed_parent = pt2ch.get(current_snomed, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the LHS be named as *_children
rather than *_parent
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks will change.
medcat/utils/preprocess_snomed.py
Outdated
Retrieves all the children of a given SNOMED CT ID (SCTID) from a given parent-to-child mapping (pt2ch) via the "IS A" relationship. | ||
pt2ch can be found in a MedCAT model in the additional info via the call: cat.cdb.addl_info['pt2ch'] | ||
|
||
Parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is different from Google-style docstrings used at other places so pls check if the existing doc-gen will honour this.
|
||
def map_snomed2opcs4(self) -> pd.DataFrame: | ||
"""Map SNOMED to OPSC4. | ||
def map_snomed2opcs4(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing return type hint.
snomed2opcs4df = self._map_snomed2refset()[1] | ||
return self._refset_df2dict(snomed2opcs4df) | ||
|
||
def _check_path_and_release(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing return type hint.
medcat/utils/preprocess_snomed.py
Outdated
This function takes a SNOMED refset DataFrame as an input and converts it into a dictionary. | ||
The DataFrame should contain the columns 'referencedComponentId','mapTarget','mapGroup','mapPriority','mapRule','mapAdvice'. | ||
|
||
Parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, pls check if the existing doc-gen will honour this.
'mapAdvice': row['mapAdvice']} for _, row in group.iterrows()]).to_dict() | ||
return refset_dict | ||
|
||
def _map_snomed2refset(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing return type hint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Ready for merge if everyone is okay with it |
snomed refset processing update
Main change has been to the processing of snomed refsets to the required medcat models formats.