Skip to content

Commit

Permalink
Merge pull request #16 from SironaMedical/AIE-2957-add-flake8
Browse files Browse the repository at this point in the history
AIE-2957 add flake8 checking
  • Loading branch information
jclerman authored Apr 11, 2024
2 parents 3e43307 + 7e607c7 commit 0af1913
Show file tree
Hide file tree
Showing 52 changed files with 128 additions and 215 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
ignore = E203, E266, E501, W503, B028, D100, D101, D102, D103, D104
max-line-length = 120
14 changes: 13 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/psf/black
rev: 22.8.0
rev: 23.9.1
hooks:
- id: black
language_version: python3
Expand All @@ -11,3 +11,15 @@ repos:
hooks:
- id: isort
args: [ --profile, black ]

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
language: python
additional_dependencies: [flake8-bugbear, flake8-comprehensions, flake8-print, flake8-docstrings]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
4 changes: 0 additions & 4 deletions data/i2b2_anno/110-01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,3 @@ DD: **/**/**
DT: **/**/**
DV: **/**/**
Approved but not reviewed by Attending Provider




5 changes: 0 additions & 5 deletions data/i2b2_anno/110-02.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ P: Follow up with Dr. ***** in 3 months.


GPP/******/*******





4 changes: 0 additions & 4 deletions data/i2b2_anno/110-03.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,3 @@ GI prophylaxis: Zantac

_______________________
**** ****, MD, EHMS pager *****




3 changes: 0 additions & 3 deletions data/i2b2_anno/110-04.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,3 @@ Plan
______________________________

**** * *********, M.D.



5 changes: 0 additions & 5 deletions data/i2b2_anno/111-01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ ___________________________________ *****/*****
Dictated by: ******* ******, M.D. ****

Not reviewed by Attending Physician





4 changes: 0 additions & 4 deletions data/i2b2_notes/110-01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,3 @@ DD: 04/07/69
DT: 04/15/69
DV: 04/07/69
Approved but not reviewed by Attending Provider




5 changes: 0 additions & 5 deletions data/i2b2_notes/110-02.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ Gilbert P. Perez, M.D.


GPP/church/olinger





4 changes: 0 additions & 4 deletions data/i2b2_notes/110-03.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,3 @@ GI prophylaxis: Zantac

_______________________
Mike Ivan, MD, EHMS pager 84710




3 changes: 0 additions & 3 deletions data/i2b2_notes/110-04.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,3 @@ Plan
______________________________

Owen M Gallagher, M.D.



5 changes: 0 additions & 5 deletions data/i2b2_notes/111-01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ FILBERT BRIGHT, M.D. FB59 D:07/20/83
Dictated by: FILBERT BRIGHT, M.D. FB59

Not reviewed by Attending Physician





2 changes: 1 addition & 1 deletion data/i2b2_xml/110-01.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ DV: 04/07/69
<DATE TYPE="DATE" comment="" end="1729" id="P7" start="1721" text="04/15/69" />
<DATE TYPE="DATE" comment="" end="1742" id="P8" start="1734" text="04/07/69" />
</TAGS>
</deIdi2b2>
</deIdi2b2>
2 changes: 1 addition & 1 deletion data/i2b2_xml/110-02.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ GPP/church/olinger
<NAME TYPE="DOCTOR" comment="" end="1320" id="P6" start="1314" text="church" />
<NAME TYPE="DOCTOR" comment="" end="1328" id="P7" start="1321" text="olinger" />
</TAGS>
</deIdi2b2>
</deIdi2b2>
2 changes: 1 addition & 1 deletion data/i2b2_xml/110-03.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ Mike Ivan, MD, EHMS pager 84710
<NAME TYPE="DOCTOR" comment="" end="3592" id="P10" start="3583" text="Mike Ivan" />
<CONTACT TYPE="PHONE" comment="" end="3614" id="P12" start="3609" text="84710" />
</TAGS>
</deIdi2b2>
</deIdi2b2>
2 changes: 1 addition & 1 deletion data/i2b2_xml/110-04.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ Owen M Gallagher, M.D.
<NAME TYPE="DOCTOR" comment="" end="3877" id="P8" start="3872" text="Perez" />
<NAME TYPE="DOCTOR" comment="" end="4080" id="P9" start="4064" text="Owen M Gallagher" />
</TAGS>
</deIdi2b2>
</deIdi2b2>
2 changes: 1 addition & 1 deletion data/i2b2_xml/111-01.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ Dictated by: FILBERT BRIGHT, M.D. FB59
<NAME TYPE="DOCTOR" comment="" end="1773" id="P12" start="1759" text="FILBERT BRIGHT" />
<NAME TYPE="USERNAME" comment="" end="1787" id="P13" start="1783" text="FB59" />
</TAGS>
</deIdi2b2>
</deIdi2b2>
2 changes: 1 addition & 1 deletion data/phi/fn.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
"SILVER",
"church"
]
]
2 changes: 1 addition & 1 deletion data/phi/fp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
"Will",
"Will",
"Will"
]
]
2 changes: 1 addition & 1 deletion data/phi/summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@
"num_false_negatives": 0
}
}
}
}
2 changes: 1 addition & 1 deletion data/phi_notes_i2b2.json
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,4 @@
}
]
}
}
}
11 changes: 11 additions & 0 deletions philter_lite/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""The philter_lite package."""
from importlib import metadata

from philter_lite.coordinate_map import CoordinateMap
Expand All @@ -8,6 +9,16 @@
from .asterisk import transform_text_asterisk
from .i2b2 import transform_text_i2b2

__all__ = [
"CoordinateMap",
"Filter",
"filter_from_dict",
"load_filters",
"detect_phi",
"transform_text_asterisk",
"transform_text_i2b2",
]

_DISTRIBUTION_METADATA = metadata.metadata("philter_lite")

__author__ = _DISTRIBUTION_METADATA["Author"]
Expand Down
4 changes: 2 additions & 2 deletions philter_lite/asterisk.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from .coordinate_map import CoordinateMap, PUNCTUATION_MATCHER
from .coordinate_map import PUNCTUATION_MATCHER, CoordinateMap


def save_to_asterisk(contents, output_file):
"""Write some data to a text file, using utf-8 encoding."""
with open(output_file, "w", encoding="utf-8", errors="surrogateescape") as f:
f.write(contents)

Expand All @@ -11,7 +12,6 @@ def transform_text_asterisk(txt, include_map: CoordinateMap):
# read the text by character, any non-punc non-overlaps will be replaced
contents = []
for i in range(len(txt)):

if i < last_marker:
continue

Expand Down
1 change: 0 additions & 1 deletion philter_lite/configs/philter_delta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2245,4 +2245,3 @@ context = "left_or_right"
context_filter = "all"
notes = ""
keyword = "regex_context.initials"

Loading

0 comments on commit 0af1913

Please sign in to comment.