Skip to content

Commit 1d2d37c

Browse files
authored
Merge pull request #79 from vmenger/update-dependencies
Update dependencies
2 parents 4c70a5f + 35c7ea3 commit 1d2d37c

26 files changed

+472
-582
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 2.0.2 (2023-03-28)
9+
10+
### Changed
11+
- upgraded dependencies, including `markdown-it-py` which had a vulnerability
12+
813
## 2.0.1 (2022-12-09)
914

1015
### Changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ Before starting, some things to consider:
3333
## Releasing
3434
* Readthedocs has a webhook connected to pushes on the main branch. It will trigger and update automatically.
3535
* Create a [release on github](https://github.com/vmenger/docdeid/releases/new), create a tag with the right version, manually copy and paste from the changelog
36-
* Trigger the build pipeline manually to release to PyPi
36+
* Build pipeline and release to PyPi trigger automatically on release
3737

3838
Any other questions/issues not covered here? Please just get in touch!

deduce/backwards_compat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
class _BackwardsCompat:
18-
1918
deduce_model = None
2019

2120
@classmethod

deduce/deduce.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ class _AnnotatorFactory:
116116
"""Responsible for creating annotators, based on config."""
117117

118118
def __init__(self) -> None:
119-
120119
self.annotator_creators = {
121120
"token_pattern": self._get_token_pattern_annotator,
122121
"annotation_context": self._get_annotation_context_pattern_annotator,

deduce/pattern/name.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ class PrefixWithNamePattern(TokenPatternWithLookup):
1616
"""Matches prefixes followed by a titlecase word."""
1717

1818
def token_precondition(self, token: dd.Token) -> bool:
19-
2019
return token.next() is not None
2120

2221
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
23-
2422
if (
2523
token.text.lower() in self._lookup_sets["prefixes"]
2624
and token.next().text[0].isupper()
@@ -36,11 +34,9 @@ class InterfixWithNamePattern(TokenPatternWithLookup):
3634
"""Matches interfixes followed by an interfix surname."""
3735

3836
def token_precondition(self, token: dd.Token) -> bool:
39-
4037
return token.next() is not None
4138

4239
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
43-
4440
if (
4541
token.text.lower() in self._lookup_sets["interfixes"]
4642
and token.next().text in self._lookup_sets["interfix_surnames"]
@@ -56,11 +52,9 @@ class InitialWithCapitalPattern(TokenPatternWithLookup):
5652
"""Matches an initial followed by an titlecase word with at least 3 characters."""
5753

5854
def token_precondition(self, token: dd.Token) -> bool:
59-
6055
return token.next() is not None
6156

6257
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
63-
6458
if (
6559
token.text[0].isupper()
6660
and len(token) == 1
@@ -78,7 +72,6 @@ class InitiaalInterfixCapitalPattern(TokenPatternWithLookup):
7872
"""Matches an initial, followed by an interfix, followed by a titlecase word."""
7973

8074
def token_precondition(self, token: dd.Token) -> bool:
81-
8275
return (token.previous() is not None) and (token.next() is not None)
8376

8477
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
@@ -98,7 +91,6 @@ class FirstNameLookupPattern(TokenPatternWithLookup):
9891
"""Matches first names, based on lookup."""
9992

10093
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
101-
10294
if token.text in self._lookup_sets["first_names"] and token.text not in self._lookup_sets["whitelist"]:
10395

10496
return token, token
@@ -110,7 +102,6 @@ class SurnameLookupPattern(TokenPatternWithLookup):
110102
"""Matches surnames, based on lookup."""
111103

112104
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
113-
114105
if token.text in self._lookup_sets["surnames"] and token.text not in self._lookup_sets["whitelist"]:
115106

116107
return token, token

deduce/pattern/name_context.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,9 @@ class InterfixContextPattern(AnnotationContextPatternWithLookupSet):
4545
"""Matches an annotated name or initial, followed by an interfix, followed by a titlecase word."""
4646

4747
def annotation_precondition(self, annotation: dd.Annotation) -> bool:
48-
4948
return annotation.end_token.next() is not None and annotation.end_token.next(2) is not None
5049

5150
def match(self, annotation: dd.Annotation) -> Optional[tuple[dd.Token, dd.Token]]:
52-
5351
if (
5452
utils.any_in_text(["initia", "naam"], annotation.tag)
5553
and annotation.end_token.next().text in self._lookup_sets["interfixes"]
@@ -65,11 +63,9 @@ class InitialsContextPattern(AnnotationContextPatternWithLookupSet):
6563
"""Matches an annotated achternaam, interfix or initial, preceded by either an initial or a titlecase word."""
6664

6765
def annotation_precondition(self, annotation: dd.Annotation) -> bool:
68-
6966
return annotation.start_token.previous() is not None
7067

7168
def match(self, annotation: dd.Annotation) -> Optional[tuple[dd.Token, dd.Token]]:
72-
7369
previous_token_is_initial = (
7470
len(annotation.start_token.previous().text) == 1 and annotation.start_token.previous().text[0].isupper()
7571
)
@@ -95,11 +91,9 @@ class InitialNameContextPattern(AnnotationContextPatternWithLookupSet):
9591
characters."""
9692

9793
def annotation_precondition(self, annotation: dd.Annotation) -> bool:
98-
9994
return annotation.end_token.next() is not None
10095

10196
def match(self, annotation: dd.Annotation) -> Optional[tuple[dd.Token, dd.Token]]:
102-
10397
if (
10498
utils.any_in_text(["initia", "voornaam", "roepnaam", "prefix"], annotation.tag)
10599
and len(annotation.end_token.next().text) > 3
@@ -116,11 +110,9 @@ class NexusContextPattern(AnnotationContextPattern):
116110
"""Matches any annotated name, followed by "en", followed by a titlecase word."""
117111

118112
def annotation_precondition(self, annotation: dd.Annotation) -> bool:
119-
120113
return annotation.end_token.next() is not None and annotation.end_token.next(2) is not None
121114

122115
def match(self, annotation: dd.Annotation) -> Optional[tuple[dd.Token, dd.Token]]:
123-
124116
if annotation.end_token.next().text == "en" and annotation.end_token.next(2).text[0].isupper():
125117

126118
return annotation.start_token, annotation.end_token.next(2)

deduce/pattern/name_patient.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ class PersonFirstNamePattern(dd.TokenPattern):
1010
metadata, with a max edit distance of 1."""
1111

1212
def doc_precondition(self, doc: dd.Document) -> bool:
13-
1413
patient = doc.metadata["patient"]
1514
return (patient is not None) and (patient.first_names is not None)
1615

1716
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
18-
1917
for first_name in metadata["patient"].first_names:
2018

2119
if str_match(token.text, first_name) or (
@@ -36,12 +34,10 @@ class PersonInitialFromNamePattern(dd.TokenPattern):
3634
"""
3735

3836
def doc_precondition(self, doc: dd.Document) -> bool:
39-
4037
patient = doc.metadata["patient"]
4138
return (patient is not None) and (patient.first_names is not None)
4239

4340
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
44-
4541
for _, first_name in enumerate(metadata["patient"].first_names):
4642

4743
if str_match(token.text, first_name[0]):
@@ -60,12 +56,10 @@ class PersonInitialsPattern(dd.TokenPattern):
6056
"""Matches the patients initials, as defined in the "patient" Person in the document metadata."""
6157

6258
def doc_precondition(self, doc: dd.Document) -> bool:
63-
6459
patient = doc.metadata["patient"]
6560
return (patient is not None) and (patient.initials is not None)
6661

6762
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
68-
6963
if str_match(token.text, metadata["patient"].initials):
7064
return token, token
7165

@@ -85,7 +79,6 @@ def __init__(self, tokenizer: dd.Tokenizer, *args, **kwargs) -> None:
8579
super().__init__(*args, **kwargs)
8680

8781
def doc_precondition(self, doc: dd.Document) -> bool:
88-
8982
patient = doc.metadata["patient"]
9083

9184
if (patient is None) or (patient.surname is None):
@@ -96,7 +89,6 @@ def doc_precondition(self, doc: dd.Document) -> bool:
9689
return True
9790

9891
def match(self, token: dd.Token, metadata: dd.MetaData) -> Optional[tuple[dd.Token, dd.Token]]:
99-
10092
surname_pattern = metadata["surname_pattern"]
10193
surname_token = surname_pattern[0]
10294
start_token = token

deduce/process/annotation_processing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def __init__(self) -> None:
6767
)
6868

6969
def process_annotations(self, annotations: dd.AnnotationSet, text: str) -> dd.AnnotationSet:
70-
7170
new_annotations = self._overlap_resolver.process_annotations(annotations, text=text)
7271

7372
return dd.AnnotationSet(

deduce/process/annotator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def _annotate_context(self, annotations: list[dd.Annotation], doc: dd.Document)
107107
return next_annotations
108108

109109
def annotate(self, doc: dd.Document) -> list[dd.Annotation]:
110-
111110
context_annotations = self.get_matching_tag_annotations(list(doc.annotations))
112111
doc.annotations.difference_update(context_annotations)
113112

deduce/process/redact.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class DeduceRedactor(dd.process.SimpleRedactor):
1212
"""
1313

1414
def redact(self, text: str, annotations: dd.AnnotationSet) -> str:
15-
1615
annotations_to_intext_replacement = {}
1716

1817
for tag, annotation_group in self._group_annotations_by_tag(annotations).items():

0 commit comments

Comments
 (0)