No project description provided
Project description
visualacuity
License
This software is available under the GNU General Public License v3.0. See the LICENSE file for more info.
How it works
Much of the behavior for visualacuity is documented in the following spreadsheets, (which are also used for testing
the software):
testing/test_cases_conversions.tsvdemonstrates how the various methods of visual acuity measurements are converted into Snellen equivalents and LogMAR values.testing/test_cases_parsing.tsvexpresses the rules and limitations of converting plain-text values into structured objects
Installation
pip install visualacuity
Example Scripts
Prerequisites
For the example scripts, we'll need to install a few more Python packages: pip install pandas tqdm
Data
Prepare a CSV file with your data. Each row is a "visit," and each column is a field from your EHR. Plus columns will be automatically merged. Example data: (document - no pinhole)
Correction: * Corrected / CC - ... * Uncorrected / SC - ...
Example:
| Distance Corrected Left Eye | Distance Corrected Left Eye +/- | Distance Corrected Right Eye | Distance Corrected Right Eye +/- |
|---|---|---|---|
| 20/20 | +1 | 20/40 | -2 |
| CF | HM |
Data Quality Report [source: data_quality.py]
python -m visualacuity.cli.examples.data_quality "mydata.csv" "reports/data_quality.csv"
Near / Total Loss Report [source: near_total_loss.py]
python -m visualacuity.cli.examples.near_total_loss "mydata.csv" "reports/near_total_loss.csv"
Plus / Minus Values Report [source: plus_minus.py]
python -m visualacuity.cli.examples.plus_minus "mydata.csv" "reports/plus_minus.csv"
Unexpected Patterns Report [source: unexpected_patterns.py]
python -m visualacuity.cli.examples.unexpected_patterns "mydata.csv" "reports/unexpected_patterns.csv"
Visit Stats Report [source: visit_stats.py]
python -m visualacuity.cli.examples.visit_stats "mydata.csv" "reports/visit_stats.csv"
VA Distribution Report [source: va_distribution.py]
python -m visualacuity.cli.examples.va_distribution "mydata.csv" "reports/va_distribution.csv" --plot-file "reports/va_distribution.pdf"
Example Usage
import visualacuity
from visualacuity import *
#############
# Basic usage
parsed = visualacuity.parse_visit({
"Left Eye Distance SC": "20/30 -1",
"Right Eye Near CC": "J5",
})
assert parsed == {
"Left Eye Distance SC": VisitNote(
text="20/30 -1",
extracted_value="20/30",
plus_letters=[-1],
laterality=OS,
distance_of_measurement=DISTANCE,
correction=SC,
va_format=SNELLEN,
snellen_equivalent=(20, 30),
log_mar_base=0.17609125905568127,
log_mar_base_plus_letters=0.20107900637734125
),
"Right Eye Near CC": VisitNote(
text="J5",
extracted_value="J5",
laterality=OD,
distance_of_measurement=NEAR,
correction=CC,
va_format=JAEGER,
snellen_equivalent=(20, 40),
log_mar_base=0.3010299956639812,
log_mar_base_plus_letters=0.3010299956639812,
),
}
###########################
# "Plus" columns are merged
visit_data = {
"Both Eyes Near CC": "20/20",
"Both Eyes Near CC Plus": "+2"
}
parsed = visualacuity.parse_visit(visit_data)
assert parsed == {
"Both Eyes Near CC": VisitNote(
text="20/20",
text_plus="+2",
laterality=OU,
distance_of_measurement=NEAR,
correction=CC,
va_format=SNELLEN,
plus_letters=[+2],
extracted_value="20/20",
snellen_equivalent=(20, 20),
log_mar_base=0.0,
log_mar_base_plus_letters=-0.041646245536099975
)
}
Contributing
How to publish to PyPi
- Bump version in src/visualacuity-python/Cargo.toml
- Commit that file and all other changes to
mainorstaging - Push
mainorstagingbranch to github - Check status on GitHub Actions
- If the build is successful, tag the repo with the new version, e.g.:
git tag "python-0.1.0a5"- Prepend
test-to publish to TestPyPi (e.g.test-python-0.1.0a5).
- Prepend
- Push with
--tags, e.g.:git push --tags - Check status on GitHub Actions
- Test new install. (Note: sometimes it doesn't work on the first try — caching or something)
- TestPyPi:
pip install --index-url https://test.pypi.org/legacy/ visualacuity==0.1.0a5 - PyPi:
pip install visualacuity==0.1.0a5
- TestPyPi:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file visualacuity-0.1.0a9.tar.gz.
File metadata
- Download URL: visualacuity-0.1.0a9.tar.gz
- Upload date:
- Size: 50.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c8b119a7302e600f34b038740fdc5dc781ae1e846658c233dbb2733314866c9
|
|
| MD5 |
73268afdf3b2941fb0bfa6fa9a27855b
|
|
| BLAKE2b-256 |
0916a79effd473026b635996e2053e14a1f0106e5749d61e8f9a0ef563bf36c4
|
File details
Details for the file visualacuity-0.1.0a9-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: visualacuity-0.1.0a9-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 970.2 kB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e13a6019eb0e380825246e2684795ff93a2b4ca4bed59c6d04cad9c51cbd129f
|
|
| MD5 |
0f2c5fa75f0a376411a55f21cd024df9
|
|
| BLAKE2b-256 |
ef58fe1c87ea5572106e2a29dfadae11b6cc7edb047fd0acb17a2c2f5ffd64c6
|
File details
Details for the file visualacuity-0.1.0a9-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: visualacuity-0.1.0a9-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.7+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8910a39925166614e66ff1d1c3b114abd0ba73da9e05a68efc3adf09640af177
|
|
| MD5 |
6c74c0f12e7d50754be7db54b97bc36b
|
|
| BLAKE2b-256 |
7585d491abaf81783f999150c49d1d29398540ae224dc3077d81c4ecc733572c
|
File details
Details for the file visualacuity-0.1.0a9-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: visualacuity-0.1.0a9-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c278b4c8397fc498e344a9efaab265d5ff29c769d876b46067010088c39d676
|
|
| MD5 |
be053820b13c623bc4b0d4d06d746b05
|
|
| BLAKE2b-256 |
b05194000a3579179ec6e7210d4c57260a6670e82dcd4b99b148355b448e6be2
|
File details
Details for the file visualacuity-0.1.0a9-cp37-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: visualacuity-0.1.0a9-cp37-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09839148e7be577864f1cb7309b5e1874e32c38d76a1a773ebcd1e94ce087ad1
|
|
| MD5 |
f8caa86803de57608bea76e3764d67dd
|
|
| BLAKE2b-256 |
a8122926a7e02e126722608fd7670c523db4f7ebc356b5acbc8630c14bd9cb65
|