ecg-records 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ecg_records-0.1.0/CHANGELOG.md +61 -0
- ecg_records-0.1.0/LICENSE +202 -0
- ecg_records-0.1.0/MANIFEST.in +6 -0
- ecg_records-0.1.0/NOTICE +7 -0
- ecg_records-0.1.0/PKG-INFO +168 -0
- ecg_records-0.1.0/README.md +268 -0
- ecg_records-0.1.0/README.package.md +122 -0
- ecg_records-0.1.0/ecg_records.egg-info/PKG-INFO +168 -0
- ecg_records-0.1.0/ecg_records.egg-info/SOURCES.txt +148 -0
- ecg_records-0.1.0/ecg_records.egg-info/dependency_links.txt +1 -0
- ecg_records-0.1.0/ecg_records.egg-info/entry_points.txt +2 -0
- ecg_records-0.1.0/ecg_records.egg-info/requires.txt +22 -0
- ecg_records-0.1.0/ecg_records.egg-info/top_level.txt +1 -0
- ecg_records-0.1.0/ecgfeat/__init__.py +152 -0
- ecg_records-0.1.0/ecgfeat/__main__.py +5 -0
- ecg_records-0.1.0/ecgfeat/_deprecated.py +81 -0
- ecg_records-0.1.0/ecgfeat/_engine/__init__.py +5 -0
- ecg_records-0.1.0/ecgfeat/_engine/atrial/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/_engine/atrial/core.py +2430 -0
- ecg_records-0.1.0/ecgfeat/_engine/atrial/p_morphology.py +176 -0
- ecg_records-0.1.0/ecgfeat/_engine/atrial/p_wave.py +2443 -0
- ecg_records-0.1.0/ecgfeat/_engine/atrial/validation.py +114 -0
- ecg_records-0.1.0/ecgfeat/_engine/beats/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/_engine/beats/families.py +138 -0
- ecg_records-0.1.0/ecgfeat/_engine/beats/grouping.py +213 -0
- ecg_records-0.1.0/ecgfeat/_engine/beats/representative.py +267 -0
- ecg_records-0.1.0/ecgfeat/_engine/delineation/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/_engine/delineation/candidates.py +153 -0
- ecg_records-0.1.0/ecgfeat/_engine/delineation/core.py +8219 -0
- ecg_records-0.1.0/ecgfeat/_engine/delineation/r_localization.py +156 -0
- ecg_records-0.1.0/ecgfeat/_engine/delineation/refinement.py +126 -0
- ecg_records-0.1.0/ecgfeat/_engine/delineation/repolarization.py +625 -0
- ecg_records-0.1.0/ecgfeat/_engine/delineation/t_refinement.py +1521 -0
- ecg_records-0.1.0/ecgfeat/_engine/delineation/wave_localization.py +599 -0
- ecg_records-0.1.0/ecgfeat/_engine/detection/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/_engine/detection/adaptive_qrs.py +118 -0
- ecg_records-0.1.0/ecgfeat/_engine/detection/qrs.py +354 -0
- ecg_records-0.1.0/ecgfeat/_engine/foundation/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/_engine/foundation/kalman.py +91 -0
- ecg_records-0.1.0/ecgfeat/_engine/foundation/models.py +834 -0
- ecg_records-0.1.0/ecgfeat/_engine/foundation/numeric.py +30 -0
- ecg_records-0.1.0/ecgfeat/_engine/foundation/thresholds.py +55 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/calibration.py +85 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/dispersion.py +50 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/features.py +5258 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/paths.py +133 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/profiles/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/profiles/glasgow.py +382 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/profiles/twelve_sl.py +510 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/rhythm.py +767 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/st_baseline.py +171 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/st_localization.py +797 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/u_wave.py +262 -0
- ecg_records-0.1.0/ecgfeat/_engine/measurement/vector_axis.py +159 -0
- ecg_records-0.1.0/ecgfeat/_engine/preprocess.py +140 -0
- ecg_records-0.1.0/ecgfeat/_engine/quality/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/_engine/quality/acquisition.py +341 -0
- ecg_records-0.1.0/ecgfeat/_engine/quality/signal.py +1669 -0
- ecg_records-0.1.0/ecgfeat/_kalman.py +10 -0
- ecg_records-0.1.0/ecgfeat/_moved.py +109 -0
- ecg_records-0.1.0/ecgfeat/acquisition_qc.py +10 -0
- ecg_records-0.1.0/ecgfeat/adaptive_qrs.py +10 -0
- ecg_records-0.1.0/ecgfeat/api.py +36 -0
- ecg_records-0.1.0/ecgfeat/atrial.py +10 -0
- ecg_records-0.1.0/ecgfeat/atrial_validation.py +10 -0
- ecg_records-0.1.0/ecgfeat/boundary_refinement.py +10 -0
- ecg_records-0.1.0/ecgfeat/calibration.py +10 -0
- ecg_records-0.1.0/ecgfeat/classical_candidates.py +10 -0
- ecg_records-0.1.0/ecgfeat/cli.py +291 -0
- ecg_records-0.1.0/ecgfeat/compat/__init__.py +28 -0
- ecg_records-0.1.0/ecgfeat/compat/_api_v0_legacy_orchestration.py +3170 -0
- ecg_records-0.1.0/ecgfeat/compat/_interpretation.py +40 -0
- ecg_records-0.1.0/ecgfeat/compat/api_v0.py +136 -0
- ecg_records-0.1.0/ecgfeat/compat/export_v0.py +2676 -0
- ecg_records-0.1.0/ecgfeat/compat/interpretation_hooks.py +51 -0
- ecg_records-0.1.0/ecgfeat/compat/measurements_v0.py +13 -0
- ecg_records-0.1.0/ecgfeat/compat/models_v0.py +45 -0
- ecg_records-0.1.0/ecgfeat/config.py +201 -0
- ecg_records-0.1.0/ecgfeat/delineate.py +10 -0
- ecg_records-0.1.0/ecgfeat/dispersion.py +10 -0
- ecg_records-0.1.0/ecgfeat/errors.py +97 -0
- ecg_records-0.1.0/ecgfeat/export.py +42 -0
- ecg_records-0.1.0/ecgfeat/family_representative.py +10 -0
- ecg_records-0.1.0/ecgfeat/features.py +10 -0
- ecg_records-0.1.0/ecgfeat/glasgow_measurements.py +10 -0
- ecg_records-0.1.0/ecgfeat/grouping.py +10 -0
- ecg_records-0.1.0/ecgfeat/io.py +229 -0
- ecg_records-0.1.0/ecgfeat/measurement_paths.py +10 -0
- ecg_records-0.1.0/ecgfeat/models.py +13 -0
- ecg_records-0.1.0/ecgfeat/numeric.py +10 -0
- ecg_records-0.1.0/ecgfeat/p_morphology.py +10 -0
- ecg_records-0.1.0/ecgfeat/p_wave_engine.py +10 -0
- ecg_records-0.1.0/ecgfeat/pipeline/__init__.py +8 -0
- ecg_records-0.1.0/ecgfeat/pipeline/context.py +272 -0
- ecg_records-0.1.0/ecgfeat/pipeline/extractor.py +411 -0
- ecg_records-0.1.0/ecgfeat/pipeline/policies/__init__.py +11 -0
- ecg_records-0.1.0/ecgfeat/pipeline/policies/_events.py +52 -0
- ecg_records-0.1.0/ecgfeat/pipeline/policies/applicability.py +194 -0
- ecg_records-0.1.0/ecgfeat/pipeline/policies/lead_integrity.py +118 -0
- ecg_records-0.1.0/ecgfeat/pipeline/policies/pacing.py +1549 -0
- ecg_records-0.1.0/ecgfeat/pipeline/policies/qt.py +338 -0
- ecg_records-0.1.0/ecgfeat/pipeline/record_builder.py +386 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/__init__.py +1 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/atrial.py +177 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/beats.py +367 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/delineation.py +183 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/finalize.py +402 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/input.py +477 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/measurement.py +795 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/quality.py +118 -0
- ecg_records-0.1.0/ecgfeat/pipeline/stages/ventricular.py +296 -0
- ecg_records-0.1.0/ecgfeat/preprocess.py +10 -0
- ecg_records-0.1.0/ecgfeat/py.typed +1 -0
- ecg_records-0.1.0/ecgfeat/qrs.py +10 -0
- ecg_records-0.1.0/ecgfeat/quality.py +10 -0
- ecg_records-0.1.0/ecgfeat/r_localization.py +10 -0
- ecg_records-0.1.0/ecgfeat/record/__init__.py +88 -0
- ecg_records-0.1.0/ecgfeat/record/availability.py +71 -0
- ecg_records-0.1.0/ecgfeat/record/contract.py +174 -0
- ecg_records-0.1.0/ecgfeat/record/model.py +280 -0
- ecg_records-0.1.0/ecgfeat/record/provenance.py +103 -0
- ecg_records-0.1.0/ecgfeat/record/query.py +403 -0
- ecg_records-0.1.0/ecgfeat/record/registry.py +76 -0
- ecg_records-0.1.0/ecgfeat/record/serialize.py +277 -0
- ecg_records-0.1.0/ecgfeat/record/sidecar.py +244 -0
- ecg_records-0.1.0/ecgfeat/record/validation.py +68 -0
- ecg_records-0.1.0/ecgfeat/refinement.py +53 -0
- ecg_records-0.1.0/ecgfeat/repolarization.py +10 -0
- ecg_records-0.1.0/ecgfeat/representative.py +10 -0
- ecg_records-0.1.0/ecgfeat/rhythm_rules.py +11 -0
- ecg_records-0.1.0/ecgfeat/schemas/ecg-record/1.0/schema.json +927 -0
- ecg_records-0.1.0/ecgfeat/schemas/ecg-record/1.0/validation-evidence.json +468 -0
- ecg_records-0.1.0/ecgfeat/st_baseline.py +10 -0
- ecg_records-0.1.0/ecgfeat/st_localization.py +10 -0
- ecg_records-0.1.0/ecgfeat/t_wave_refinement.py +10 -0
- ecg_records-0.1.0/ecgfeat/twelve_sl.py +10 -0
- ecg_records-0.1.0/ecgfeat/u_wave.py +10 -0
- ecg_records-0.1.0/ecgfeat/validation.py +26 -0
- ecg_records-0.1.0/ecgfeat/vector_axis.py +10 -0
- ecg_records-0.1.0/ecgfeat/visualize.py +29 -0
- ecg_records-0.1.0/ecgfeat/viz/__init__.py +70 -0
- ecg_records-0.1.0/ecgfeat/viz/_inputs.py +337 -0
- ecg_records-0.1.0/ecgfeat/viz/_style.py +58 -0
- ecg_records-0.1.0/ecgfeat/viz/errors.py +23 -0
- ecg_records-0.1.0/ecgfeat/viz/legacy.py +284 -0
- ecg_records-0.1.0/ecgfeat/viz/plots.py +508 -0
- ecg_records-0.1.0/ecgfeat/wave_localization.py +10 -0
- ecg_records-0.1.0/pyproject.toml +62 -0
- ecg_records-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog — ecg-records
|
|
2
|
+
|
|
3
|
+
All notable changes to the `ecg-records` distribution (import name `ecgfeat`).
|
|
4
|
+
The ECG Record *schema* is versioned separately (see `schema_version` in every
|
|
5
|
+
record); this file tracks the package.
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-09-24
|
|
10
|
+
|
|
11
|
+
First release of the redesigned library (previously the unpublished
|
|
12
|
+
`ecgfeat-dxl-inspired` 0.1.0 working tree).
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **ECG Record** (schema `1.0.0`): `ecg_record`, `ecg_prepare` / `ecg_measure` /
|
|
16
|
+
`ecg_emit`, `load_record`, `validate_record`, `dumps_record`, `query_measurement`,
|
|
17
|
+
`query_many`, `select_measurements`, `resolve_address`, `iter_leads`, `iter_beats`,
|
|
18
|
+
profiles `summary` / `all` / `debug`, canonical addresses
|
|
19
|
+
`ecg-record:<record_id>@<schema_version>#<RFC 6901 pointer>`, and three explicit
|
|
20
|
+
absence states (plain null, `unmeasurable(reason)`, `not_applicable(reason)`,
|
|
21
|
+
with a lossless per-field default state).
|
|
22
|
+
- Packaged JSON Schema and validation-evidence registry
|
|
23
|
+
(`ecgfeat/schemas/ecg-record/1.0/`); strict reading rejects validation claims
|
|
24
|
+
above the registry. Every published field is `unvalidated` in this release.
|
|
25
|
+
- Verified NPZ sidecar for dense matrices (`serialize_record(..., sidecar_uri=...)`,
|
|
26
|
+
CLI `measure --sidecar`), deterministic bytes, SHA-256 and identity bound.
|
|
27
|
+
- `ecg-record` command line: `measure`, `validate`, `query`, `resolve`, `select`, `batch`.
|
|
28
|
+
- Record-based plotting in `ecgfeat.viz`: `plot_record`, `plot_beat`,
|
|
29
|
+
`plot_beat_all_leads`, `plot_representative_beat`, `plot_quality_summary`, all
|
|
30
|
+
taking `(signal, record)` and returning `(Figure, axes)` through the
|
|
31
|
+
object-oriented Matplotlib API; the signal is checked against the record's
|
|
32
|
+
raw-signal SHA-256. `import ecgfeat` never imports Matplotlib.
|
|
33
|
+
- Extras: `viz` (Matplotlib, for `ecgfeat.viz`), `interpret` (installs `ecginterpret`),
|
|
34
|
+
`performance` (Numba), `wfdb`.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
- Extraction runs as an explicit staged pipeline (input, quality, ventricular,
|
|
38
|
+
beats, delineation, atrial, measurement, finalize) with pacing, QT,
|
|
39
|
+
applicability and lead-integrity policy objects. Measurements are unchanged:
|
|
40
|
+
legacy output is byte-identical to the pre-migration baseline on 1,063 golden
|
|
41
|
+
records from seven public datasets.
|
|
42
|
+
- Engine modules are private (`ecgfeat._engine`); interpretation moved to the
|
|
43
|
+
`ecginterpret` distribution; the legacy `ECGFeatures` plots moved to
|
|
44
|
+
`ecgfeat.viz.legacy`.
|
|
45
|
+
- Published records never contain an impossible fiducial order or a negative
|
|
46
|
+
interval: such cells are `unmeasurable(fiducial_order_violation)` /
|
|
47
|
+
`unmeasurable(negative_interval)` instead of failing the whole record.
|
|
48
|
+
|
|
49
|
+
### Deprecated
|
|
50
|
+
- `ecgfeat.ECGFeatureExtractor` / `ecgfeat.api`, `ecgfeat.to_dict` and the
|
|
51
|
+
`ecgfeat.export` entry points, top-level `interpret`, `plot_*`,
|
|
52
|
+
`ecgfeat.visualize`, `load_wfdb_mat`, `parse_wfdb_header`, and the old
|
|
53
|
+
private module paths.
|
|
54
|
+
They warn on use and are removed no earlier than 0.3.0; `ecgfeat.compat`
|
|
55
|
+
is the explicit legacy contract meanwhile.
|
|
56
|
+
|
|
57
|
+
### Known limitations
|
|
58
|
+
- No published field has an approved evidence manifest yet (all `unvalidated`).
|
|
59
|
+
- P-wave delineation is the weakest endpoint in the repository benchmarks.
|
|
60
|
+
- ECG Record 1.0 publishes a compact subset of the engine's measurements;
|
|
61
|
+
`ecginterpret.interpret_record` therefore needs the raw signal.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
ecg_records-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ecg-records
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Versioned ECG Record extraction, measurement and plotting (research and engineering software; not a medical device)
|
|
5
|
+
Author: humansys-lab
|
|
6
|
+
Maintainer: humansys-lab
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/humansys-lab/ECG-feature-extraction-
|
|
9
|
+
Project-URL: Repository, https://github.com/humansys-lab/ECG-feature-extraction-
|
|
10
|
+
Project-URL: Issues, https://github.com/humansys-lab/ECG-feature-extraction-/issues
|
|
11
|
+
Project-URL: Documentation, https://github.com/humansys-lab/ECG-feature-extraction-/tree/main/docs/site
|
|
12
|
+
Project-URL: Changelog, https://github.com/humansys-lab/ECG-feature-extraction-/blob/main/feature_extraction/CHANGELOG.md
|
|
13
|
+
Keywords: ecg,electrocardiography,signal-processing,delineation,physionet,visualization
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: <3.14,>=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
License-File: NOTICE
|
|
28
|
+
Requires-Dist: numpy<3,>=1.26
|
|
29
|
+
Requires-Dist: scipy<2,>=1.11
|
|
30
|
+
Provides-Extra: viz
|
|
31
|
+
Requires-Dist: matplotlib<4,>=3.7; extra == "viz"
|
|
32
|
+
Provides-Extra: interpret
|
|
33
|
+
Requires-Dist: ecginterpret<1,>=0.1; extra == "interpret"
|
|
34
|
+
Provides-Extra: performance
|
|
35
|
+
Requires-Dist: numba<0.67,>=0.59; extra == "performance"
|
|
36
|
+
Provides-Extra: wfdb
|
|
37
|
+
Requires-Dist: wfdb<5,>=4.1; extra == "wfdb"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: build<2,>=1.2; extra == "dev"
|
|
40
|
+
Requires-Dist: hypothesis<7,>=6.100; extra == "dev"
|
|
41
|
+
Requires-Dist: import-linter<3,>=2; extra == "dev"
|
|
42
|
+
Requires-Dist: jsonschema<5,>=4.22; extra == "dev"
|
|
43
|
+
Requires-Dist: pytest<10,>=8; extra == "dev"
|
|
44
|
+
Requires-Dist: twine<7,>=5; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# ecg-records
|
|
48
|
+
|
|
49
|
+
`ecg-records` measures 12-lead (or 1–8-channel) ECG signals and emits a small,
|
|
50
|
+
versioned JSON document, the **ECG Record**: fiducials, intervals,
|
|
51
|
+
amplitudes, areas, quality and provenance in raw-sample coordinates, with
|
|
52
|
+
explicit units, an explicit reason for every missing value, a stable address
|
|
53
|
+
for every value, and a per-field validation status. The Python import name is
|
|
54
|
+
`ecgfeat`.
|
|
55
|
+
|
|
56
|
+
> This software is research and engineering software. It is not a medical
|
|
57
|
+
> device and is not intended to diagnose, treat, cure, or prevent disease.
|
|
58
|
+
> Outputs require independent validation for the intended use and must not be
|
|
59
|
+
> used as a substitute for professional medical judgment.
|
|
60
|
+
|
|
61
|
+
The measurement pipeline (signal quality, multilead QRS detection, beat
|
|
62
|
+
grouping, representative beats, delineation) is inspired by publicly
|
|
63
|
+
documented 12-lead measurement practice. It is not a reproduction of any
|
|
64
|
+
proprietary product.
|
|
65
|
+
|
|
66
|
+
## Install
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install ecg-records # measurements and ECG Records (NumPy, SciPy)
|
|
70
|
+
pip install "ecg-records[performance]" # optional Numba acceleration
|
|
71
|
+
pip install "ecg-records[wfdb]" # WFDB readers
|
|
72
|
+
pip install "ecg-records[viz]" # plotting with ecgfeat.viz (adds Matplotlib)
|
|
73
|
+
pip install "ecg-records[interpret]" # rule-based interpretation (ecginterpret)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Python 3.10–3.13. The core package depends only on NumPy and SciPy.
|
|
77
|
+
|
|
78
|
+
## Measure
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import numpy as np
|
|
82
|
+
from ecgfeat import ecg_record, dumps_record
|
|
83
|
+
|
|
84
|
+
leads = ["I", "II", "III", "aVR", "aVL", "aVF", "V1", "V2", "V3", "V4", "V5", "V6"]
|
|
85
|
+
signal = np.load("ecg.npy") # shape (12, n_samples), channel-major, millivolts
|
|
86
|
+
record = ecg_record(signal, sampling_rate=500, lead_names=leads) # profile="summary"
|
|
87
|
+
with open("ecg.record.json", "wb") as handle:
|
|
88
|
+
handle.write(dumps_record(record))
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Rows must be named explicitly; for fewer than 12 channels pass
|
|
92
|
+
`input_mode="limited"` (axis and formal QT are then `not_applicable`, raw
|
|
93
|
+
measurements stay available). Profiles: `summary` (default; under 24,000 bytes
|
|
94
|
+
for a 10 s, 12-lead, 10-beat record), `all` (every published measurement) and
|
|
95
|
+
`debug`. Dense matrices can move to a verified NPZ sidecar with
|
|
96
|
+
`serialize_record(record, sidecar_uri="ecg.dense.npz")`.
|
|
97
|
+
|
|
98
|
+
## Read and query
|
|
99
|
+
|
|
100
|
+
Reading records needs no NumPy, SciPy or plotting code:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from ecgfeat import load_record, query_measurement, resolve_address
|
|
104
|
+
|
|
105
|
+
record = load_record("ecg.record.json") # strict validation by default
|
|
106
|
+
qrs = query_measurement(record, "qrs_duration_ms", lead="V1", beat=3)
|
|
107
|
+
qrs.value, qrs.unit, qrs.absence, qrs.validation.tier, str(qrs.address)
|
|
108
|
+
# absence: None (measured), NullAbsence, UnmeasurableAbsence(reason) or NotApplicableAbsence(reason)
|
|
109
|
+
|
|
110
|
+
address = f"ecg-record:{record.record_id}@{record.schema_version}#/measurements/global/heart_rate_bpm/values"
|
|
111
|
+
resolve_address(record, address).value
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Addresses follow `ecg-record:<record_id>@<schema_version>#<RFC 6901 pointer>`.
|
|
115
|
+
The JSON Schema and the validation-evidence registry ship in the package
|
|
116
|
+
(`ecgfeat/schemas/ecg-record/1.0/`).
|
|
117
|
+
|
|
118
|
+
## Plot
|
|
119
|
+
|
|
120
|
+
Plotting ships in this package as `ecgfeat.viz`; only Matplotlib is optional
|
|
121
|
+
(`pip install "ecg-records[viz]"`). `import ecgfeat` never imports Matplotlib,
|
|
122
|
+
and `pyplot` is never used.
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from ecgfeat.viz import plot_beat, plot_record
|
|
126
|
+
|
|
127
|
+
fig, axes = plot_record(signal, record, leads=["II", "V1", "V5"],
|
|
128
|
+
start_s=1.0, end_s=4.0, annotations="all")
|
|
129
|
+
fig.savefig("record.png", dpi=150)
|
|
130
|
+
fig, ax = plot_beat(signal, record, beat=3, lead="II")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`plot_beat_all_leads`, `plot_representative_beat` and `plot_quality_summary`
|
|
134
|
+
work the same way. Every function takes `(signal, record)` and returns
|
|
135
|
+
`(figure, axes)`. `signal` must be the exact array that produced the record:
|
|
136
|
+
its SHA-256 is checked against `/artifacts/raw_signal/sha256`, and a mismatch
|
|
137
|
+
raises `ecgfeat.viz.VisualizationInputError` (an `ECGInputError`). Pass
|
|
138
|
+
`figure=` to draw into an existing `Figure` or `SubFigure`. Every added artist
|
|
139
|
+
carries a `gid` starting with `ecgfeat.viz:`.
|
|
140
|
+
|
|
141
|
+
## Command line
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
ecg-record measure signal.npy --sampling-rate 500 --lead-names I II III aVR aVL aVF V1 V2 V3 V4 V5 V6 -o rec.json
|
|
145
|
+
ecg-record validate rec.json
|
|
146
|
+
ecg-record query rec.json qrs_duration_ms --lead V1 --beat 3
|
|
147
|
+
ecg-record batch manifest.jsonl --output-dir out --jobs 4
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Validation status
|
|
151
|
+
|
|
152
|
+
Every published field carries a validation status taken from the shipped
|
|
153
|
+
validation-evidence registry. In schema 1.0.0 **every field is
|
|
154
|
+
`unvalidated`**: benchmark history exists for several endpoints, but no field
|
|
155
|
+
has an approved evidence manifest yet, and a status can only be raised by
|
|
156
|
+
citing one. The four-class ST morphology is deliberately not published (it was
|
|
157
|
+
never validated and is anti-correlated with ischemia).
|
|
158
|
+
|
|
159
|
+
## Versions and compatibility
|
|
160
|
+
|
|
161
|
+
- The package version and the ECG Record schema version are independent. This
|
|
162
|
+
release writes schema `1.0.0` and reads schema major `1`, tolerating
|
|
163
|
+
additive fields from later minors.
|
|
164
|
+
- Legacy APIs (`ECGFeatureExtractor`, `to_dict`, `interpret`, `plot_*`,
|
|
165
|
+
`ecgfeat.visualize`, the legacy result dataclasses) remain for a
|
|
166
|
+
compatibility window. Legacy
|
|
167
|
+
functions emit `ECGDeprecationWarning` on use; `ecgfeat.compat` provides the
|
|
168
|
+
exact legacy contract without warnings. Removal is no earlier than 0.3.0.
|