Skip to content

Commit

Permalink
Merge pull request #7 from con/pr02_ocr_accuracy
Browse files Browse the repository at this point in the history
OCR accuracy tool for screen_data
  • Loading branch information
vmdocua authored Oct 27, 2023
2 parents de8dbb9 + 7de5b17 commit 556df91
Show file tree
Hide file tree
Showing 37 changed files with 781 additions and 384 deletions.
2 changes: 2 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[codespell]
skip = package-lock.json,build
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
venv
.git
dist
certs
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
build/
.coverage*
.dir-locals.el
dist/
*.egg-info
.env.*
!.env.local
.flake8
.idea/
.mypy_cache/
*.pid
*.pyc
.python-version
services
*.sqbpro
*.swp
.tox/
venv
venvs
certs
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

# - repo: https://github.com/psf/black
# rev: 23.3.0
# hooks:
# - id: black

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
# B008 Do not perform function calls in argument defaults.
# A003 class attribute "id" is shadowing a python builtin
args: ["-j8", "--ignore=B008,A003", "--max-line-length=89"]
additional_dependencies:
- flake8-bugbear
- flake8-builtins
# - flake8-unused-arguments

exclude: '.codespellrc'

default_language_version:
python: python3.11
2 changes: 1 addition & 1 deletion data/s_007.json → data/model/s_007.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "model007",
"description": "Model One",
"image_path": "data/s_007.png",
"image_path": "data/model/s_007.png",
"screen_type": "patient-registration",
"form": {
"id": "form1",
Expand Down
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion data/s_010.json → data/model/s_010.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "model010",
"description": "Dot Cockpit Program Editor Screen",
"image_path": "data/s_010.png",
"image_path": "data/model/s_010.png",
"screen_type": "dot-cockpit-editor",
"form": {
"id": "form1",
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion data/s_011.json → data/model/s_011.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "model011",
"description": "List item renderer",
"image_path": "data/s_011.png",
"image_path": "data/model/s_011.png",
"screen_type": "dot-cockpit-editor-list_1",
"form": {
"id": "form1",
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
28 changes: 28 additions & 0 deletions data/screen_data/patient-registration-001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"type": "patient-registration",
"data": {
"last_name": "SID000XXX",
"first_name": null,
"title": null,
"patient_id": "SID000XXX",
"date_of_birth": "1/1/1990",
"sex": "Other",
"age": "28",
"age_unit": "Years",
"height": "5",
"height_unit": "ft",
"weight": "103",
"weight_unit": "lbs",
"metric": null,
"additional_info": null,
"accession_no": "A000XXX",
"request_id": null,
"patient_position": "Head First - Supine",
"institution_name": null,
"performing_physician": null,
"operator": null,
"referring_physician": null,
"requesting_physician": null,
"admission_id": null
}
}
Binary file added data/screen_data/patient-registration-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions data/screen_data/patient-registration-002.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"type": "patient-registration",
"data": {
"last_name": "O0O0o0o0O0O",
"first_name": "First Name GHJKL;:'\"|",
"title": null,
"patient_id": "0123456789QWERTYUIOP{}ASDF",
"date_of_birth": "1/2/1922",
"sex": "Male",
"age": "101",
"age_unit": "Years",
"height": "100.00",
"height_unit": "cm",
"weight": "100.00",
"weight_unit": "kg",
"metric": "Y",
"additional_info": "Additional info we do not care",
"accession_no": "1234567890 OOO",
"request_id": null,
"patient_position": "Head First - Supine",
"institution_name": "dartmouth_brain_imaging_cente",
"performing_physician": "Marvin Maechler",
"operator": "Mary Kieseler",
"referring_physician": "Kraemer",
"requesting_physician": "requesting-phys2",
"admission_id": "qwertyuiopasdfghjklzxcvbnm"
}
}
Binary file added data/screen_data/patient-registration-002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions data/screen_data/patient-registration-003.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"type": "patient-registration",
"data": {
"last_name": "Oo0Olaf lllllllla",
"first_name": "X20948297%|",
"title": null,
"patient_id": null,
"date_of_birth": null,
"sex": null,
"age": null,
"age_unit": "Years",
"height": null,
"height_unit": "ft",
"weight": null,
"weight_unit": "lbs",
"metric": null,
"additional_info": null,
"accession_no": null,
"request_id": null,
"patient_position": null,
"institution_name": null,
"performing_physician": null,
"operator": null,
"referring_physician": null,
"requesting_physician": null,
"admission_id": null
}
}
Binary file added data/screen_data/patient-registration-003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions data/screen_data/patient-registration-004.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"type": "patient-registration",
"data": {
"last_name": "Oo0Olaf lllllllla",
"first_name": "X20948297%",
"title": null,
"patient_id": "23.08.17-15:06:15-DST-1.3.12.2.11(",
"date_of_birth": "2/2/2222",
"sex": null,
"age": null,
"age_unit": "Years",
"height": null,
"height_unit": "ft",
"weight": null,
"weight_unit": "lbs",
"metric": null,
"additional_info": null,
"accession_no": "Henlo :3",
"request_id": null,
"patient_position": null,
"institution_name": null,
"performing_physician": null,
"operator": null,
"referring_physician": null,
"requesting_physician": null,
"admission_id": null
}
}
Binary file added data/screen_data/patient-registration-004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions data/screen_data/patient-registration-005.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"type": "patient-registration",
"data": {
"last_name": "Oo0Olaf lllllllla",
"first_name": "X20948297%",
"title": null,
"patient_id": "23.08.17-15:06:15-DST-1.3.12.2.11(",
"date_of_birth": "11/17/2021",
"sex": "Male",
"age": "21",
"age_unit": "Months",
"height": "8",
"height_unit": "ft",
"weight": null,
"weight_unit": "lbs",
"metric": null,
"additional_info": null,
"accession_no": "Henlo :3",
"request_id": null,
"patient_position": null,
"institution_name": null,
"performing_physician": null,
"operator": null,
"referring_physician": null,
"requesting_physician": null,
"admission_id": null
}
}
Binary file added data/screen_data/patient-registration-005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions noisseur.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

[noisseur]
MODEL_LIST=
data/s_007.json
data/s_010.json
data/s_011.json
data/model/s_007.json
data/model/s_010.json
data/model/s_011.json


# --tessdata-dir /usr/share/tesseract-ocr/4.00/tessdata
Expand Down
2 changes: 1 addition & 1 deletion noisseur/app/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def ocr_screen():
def test_font():
logger.debug("test_font")

image = Image.open(os.path.join(AppConfig.instance.ROOT_PATH, "data/s_009.png"))
image = Image.open(os.path.join(AppConfig.instance.ROOT_PATH, "data/sample/s_009.png"))
image = image.convert("RGB")
width, height = image.size

Expand Down
12 changes: 6 additions & 6 deletions noisseur/app/web/templates/test/home.j2
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<table>
<tr>
<td class=flabel>Image:</td>
<td><input name="path" style="width:800px;" type="text" value="data/s_001.png" /></td>
<td><input name="path" style="width:800px;" type="text" value="data/sample/s_001.png" /></td>
</tr>
<tr>
<td>Image Processor Chain:<br>
Expand All @@ -77,7 +77,7 @@
<table>
<tr>
<td class=flabel>Image:</td>
<td><input name="path" style="width:800px;" type="text" value="data/s_001.png" /></td>
<td><input name="path" style="width:800px;" type="text" value="data/sample/s_001.png" /></td>
</tr>
<tr>
<td>Image Processor Chain:<br>
Expand All @@ -97,7 +97,7 @@
<table>
<tr>
<td class=flabel>Image:</td>
<td><input name="path" style="width:800px;" type="text" value="data/s_001.png" /></td>
<td><input name="path" style="width:800px;" type="text" value="data/sample/s_001.png" /></td>
</tr>
<tr>
<td>Image Processor Chain:<br>
Expand All @@ -117,7 +117,7 @@
<table>
<tr>
<td class=flabel>Image:</td>
<td><input name="path" type="text" value="data/s_001.png" /></td>
<td><input name="path" type="text" value="data/sample/s_001.png" /></td>
</tr>
<tr>
<td class=flabel>Image Processor Chain:</td>
Expand All @@ -136,7 +136,7 @@
<table>
<tr>
<td class=flabel>Image:</td>
<td><input name="path" style="width:800px;" type="text" value="data/s_001.png" /></td>
<td><input name="path" style="width:800px;" type="text" value="data/sample/s_001.png" /></td>
</tr>
<tr>
<td></td>
Expand All @@ -151,7 +151,7 @@
<table>
<tr>
<td class=flabel>Image:</td>
<td><input name="path" style="width:800px;" type="text" value="data/s_001.png" /></td>
<td><input name="path" style="width:800px;" type="text" value="data/sample/s_001.png" /></td>
</tr>
<tr>
<td>Image Processor Chain:<br>
Expand Down
12 changes: 6 additions & 6 deletions noisseur/model_prototype.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def generate_model_007():
model.id = "model007"
model.screen_type = "patient-registration"
model.description = "Model One"
model.image_path = "data/s_007.png"
model.image_path = "data/model/s_007.png"

form = Form()
form.id = "form1"
Expand Down Expand Up @@ -536,7 +536,7 @@ def generate_model_007():
logger.debug("json=\n")
logger.debug(s)

with open(os.path.join(AppConfig.instance.ROOT_PATH, "data/s_007.json"), 'w') as f:
with open(os.path.join(AppConfig.instance.ROOT_PATH, "data/model/s_007.json"), 'w') as f:
f.write(s)

model2 = Model.from_json(s)
Expand All @@ -547,7 +547,7 @@ def generate_model_010():
model.id = "model010"
model.screen_type = "dot-cockpit-editor"
model.description = "Dot Cockpit Program Editor Screen"
model.image_path = "data/s_010.png"
model.image_path = "data/model/s_010.png"

form = Form()
form.id = "form1"
Expand Down Expand Up @@ -581,7 +581,7 @@ def generate_model_010():
logger.debug("json=\n")
logger.debug(s)

with open(os.path.join(AppConfig.instance.ROOT_PATH, "data/s_010.json"), 'w') as f:
with open(os.path.join(AppConfig.instance.ROOT_PATH, "data/model/s_010.json"), 'w') as f:
f.write(s)

model2 = Model.from_json(s)
Expand All @@ -592,7 +592,7 @@ def generate_model_011():
model.id = "model011"
model.screen_type = "dot-cockpit-editor-list_1"
model.description = "List item renderer"
model.image_path = "data/s_011.png"
model.image_path = "data/model/s_011.png"

form = Form()
form.id = "form1"
Expand Down Expand Up @@ -642,7 +642,7 @@ def generate_model_011():
logger.debug("json=\n")
logger.debug(s)

with open(os.path.join(AppConfig.instance.ROOT_PATH, "data/s_011.json"), 'w') as f:
with open(os.path.join(AppConfig.instance.ROOT_PATH, "data/model/s_011.json"), 'w') as f:
f.write(s)

model2 = Model.from_json(s)
Expand Down
Loading

0 comments on commit 556df91

Please sign in to comment.