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.tsv
demonstrates how the various methods of visual acuity measurements are converted into Snellen equivalents and LogMAR values.testing/test_cases_parsing.tsv
expresses 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
main
orstaging
- Push
main
orstaging
branch 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
File details
Details for the file visualacuity-0.1.0a8.tar.gz
.
File metadata
- Download URL: visualacuity-0.1.0a8.tar.gz
- Upload date:
- Size: 50.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9094f8e19e6b94ea557b2e67ffa3fa7e00ba3c46bf3a7cf91af2385363522686 |
|
MD5 | 64addca748e01b403dbfb13fb3b21080 |
|
BLAKE2b-256 | 59b3470522fdfe13a312881b5603318c27f8711fb8ebd863af089401c04e30bf |
File details
Details for the file visualacuity-0.1.0a8-cp37-abi3-win_amd64.whl
.
File metadata
- Download URL: visualacuity-0.1.0a8-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 970.1 kB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f60adab0cd8ce9fa19117cf31c634f11083d1816e078876d7c25e3f746f4dde |
|
MD5 | 16cd02099ee6b50215749fbfa5a609ce |
|
BLAKE2b-256 | 6a5368ce4c3cb2697cb3799d360c37d010109044bf806553d0c0e3e746df9dd0 |
File details
Details for the file visualacuity-0.1.0a8-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: visualacuity-0.1.0a8-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.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93616fbf83148ee2d1532324720f11b9771a226bbe681674f8812b08a25aef83 |
|
MD5 | 0e4f4f971c256809c73dcf0f612a1ea1 |
|
BLAKE2b-256 | 13cf1b349d36386f60831bacba301403bcf050a9b6c40bd42c6dd44cbe198c97 |
File details
Details for the file visualacuity-0.1.0a8-cp37-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: visualacuity-0.1.0a8-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.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ab059f3a6a4e3aad9762a907e7708c7c079409b4c771eaeccf6b2aa0b4379c0 |
|
MD5 | fbfc73b756c0299b2df3a5100b2e342b |
|
BLAKE2b-256 | 12e32524cd61f1359354f1233bfc17a654b2f45557c3285f5d6bf5d2cd8416bc |
File details
Details for the file visualacuity-0.1.0a8-cp37-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: visualacuity-0.1.0a8-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.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c53645de409d39c40def008250e760d5f7528973062a22c4c5a7c682460f54cf |
|
MD5 | 05596ebf59916bf021875256f6ee142a |
|
BLAKE2b-256 | 07c8ef5689c1499f8e3fea4e901147272b384bb304f70200de2dea477540774d |