Changelog#
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]#
Fixed#
ehrdata_blobs()now defaultslayertoNoneand stores the generated time series tensor in.X. Previously it always wrote to.layers["tem_data"]regardless of thelayerargument, so code that omittedlayersilently analyzed a static 2D snapshot instead of the intended 3D time series. Passlayer=explicitly to keep the tensor in a named layer instead. (#284) @sueoglu
[0.4.0]#
Added#
write_h5ed()/read_h5ed()andwrite_zarr()/read_zarr()can now persist a 3D.X/layer stored as a pydatasparse.COOtensor. Following closely the binsparse specification (per-axisindices_<dim>+valuesdatasets, afill_value, and a JSONbinsparsedescriptor). The descriptor labels dtypes with binsparse’s canonical data-type strings; boolean tensors round-trip asbint8(stored on disk asuint8). Supported specifically for the reserved 3DX/layer slots; asparse.COOin any other slot raises a clear error. (#276) @eroell
Fixed#
harmonize_missing_values()and the read-time float casting no longer choke on boolean arrays. Boolean arrays are now treated like numeric ones (nothing to harmonize/cast). (#264) @eroellmove_to_obs()now reads values from the requestedlayerinstead of always reading.X; passinglayer=previously validated the layer but silently moved.X’s values. (#279) @eroellgen_default_config()no longer fails withX must be 2-dimensionalwhen the time series lives in a 3D.X(e.g. fromphysionet2019()); the selected source is reduced to the chosentimestepbefore writing, andlayernow defaults toNone(use.X). (#271) @eroellinfer_feature_types()binary detection contained a latent bug: the integrality guard usednp.all(<generator>), which is always truthy and so never actually ran. The check is now the equivalent, correctset(col.unique()) == {0, 1}. No user-visible behaviour changes, as the disabled guard was redundant with the{0, 1}set check. (#268) @Zethsoninfer_feature_types()no longer emits a warning with a blank feature name (Feature was detected as categorical features stored numerically.) when no feature is uncertain. The warning is now only shown when at least one feature was detected as categorical stored numerically, and lists the affected feature names. (#267) @ZethsonSlicing a 3D
Xalong the time axis now also slices.X. Previously, subsetting the third axis updated.shapeand.tembut returned the parent’s full-length.X, soedata[:, :, idx].X.shapedisagreed withedata[:, :, idx].shape..Xnow applies the time-axis index exactly like a 3D layer. (#259) @eroell
Documentation#
The
EHRDataattribute reference now describes.obsm,.varm,.obspand.varpin anndata’s terms instead of showing a generic placeholder. (#263) @eroellUpdated logo with 3D
.X. Tutorials updated to use.Xcanonically. Docstring examples no longer passlayer="tem_data": the time series is kept in the default 3D.X. (#273) @eroell
[0.3.0]#
Added#
read_h5ed()andwrite_h5ed()are the new primary HDF5 I/O functions:.h5edis now ehrdata’s on-disk format, marking it distinct from anndata’s.h5ad.read_h5adandwrite_h5adremain as deprecated aliases. (#252) @eroellwrite_h5ed()andwrite_zarr()now write the ehrdata on-disk encoding 0.2.0. Because AnnData only guarantees 2D but not 3D arrays inX/layers(see scverse/anndata#2430), 3D arrays are relocated into.obsm(under reserved_ed_ondisk_X/_ed_ondisk_layers_<name>keys) and dropped fromX/layerson write, then restored on read. Backwards compatibility for reading is maintained. The recommended file extensions forhdf5are now.h5ed. (#252) @eroell
Fixed#
infer_feature_types()can handleEHRDataobjects withXasNone. (#246) @sueogluphysionet2019()no longer raises a shape mismatch on the full dataset: persons whose dynamic measurements all fall outside the observation window are now padded with missing values instead of being dropped from the time series tensor. (#251) @eroellharmonize_missing_values()no longer logs a warning for each numeric layer when it has nothing to harmonize; reading a fully numeric dataset is now quiet.(#252) @eroell
Maintenance#
ehrdata is now compatible with anndata 0.13 (unified
X/layersstorage,IndexManagerview indices, index type aliases moved toanndata.typing, and the stricter 2D-onlyX/layerson-disk rule) while remaining compatible with anndata<0.13. CI gains an integration-freecore-anndata-minlane (pinned toanndata<0.13) and a pre-release lane to catch upstream breakage early. (#252) @eroellDaskArrayimport fixed to follow anndata 0.12.16, anddaskadded to the intersphinx mapping. (#248) @sueogluCI now caches downloaded datasets used by
ehrdata.dtto reduce flaky upstream hosts (e.g. physionet.org) breaking the test and notebook workflows. (#250) @eroellDataset downloads now use pooch instead of a custom
requests-based downloader, aligning with the scverse ecosystem and providing caching out of the box. (#251) @eroellThe
tqdmdependency has been removed. (#254) @eroell
Documentation#
[0.2.1]#
Fixed#
Compatibility with
anndata>=0.12.13(#240) @eroell
[0.2.0]#
Fixed#
Modified#
infer_feature_types()considers integers from 0, …, n as numeric. It further provides a new argumentbinary_as, to steer if columns 0/1 should be considered numeric or categorical. (#231) @eroell
[0.1.2]#
Added#
from_pandas()withformat='long'provides a new keyword argumentfill_time_gapsthat fills missing timegaps in the common case of integer time steps from 0 to n_timesteps (#229) @eroell
Modified#
Fixed#
from_pandas()withformat='long'misordered entries in.X/.layerswith.obsif the input df was not sorted for the obs id keys, which is now fixed. (#228) @eroell
Documentation#
Documentation style polishing (#223) @zethson
[0.1.1]#
Added#
setup_connection()can read.parquetfiles. (#217) @eroell
Fixed#
Sliceing of
EHRDataobjects fixed when the backing object is anAnnData. (#218) @eroell
Maintenance#
More concise messages in
infer_feature_types(). (#215) @zethson
[0.1.0]#
Added#
move_to_obs()andmove_to_x()are new helpers for conveniently moving variables from central 2D arrays to the.obsfield, and vice versa. (#199) @eroellphysionet2019()as another out-of-the-box, conveniently available dataset with 40’000 ICU stays from the Physionet 2019 challenge. (#204) @eroelltime_precisionparameter ("date"or"datetime") tosetup_variables()andsetup_interval_variables()for finer temporal granularity control. (#210) @eroell
Fixed#
read_h5adfixed issues whenbacked=True. (#199) @eroellread_h5adfixed bug when.XisNoneandharmonize_missing_featuresisTrue. (#206) @eroellsetup_obs()withobservation_table="person_visit_occurrence"now supports multiple visits per patient, creating one row per visit with unique observation IDs, instead of failing with xarray conversion errors with non-unique indices. (#210) @eroellOMOP time interval boundaries now use half-open intervals
[start, end)to prevent duplicate measurements at interval boundaries. (#210) @eroell
Maintenance#
Modified#
Dataset generator function
ed.dt.ehrdata_blobsnow takesn_cat_varandn_categoriesarguments to generate categorical (integer encoded) time series data (#207) @sueogluIf
enrich_var_with_feature_info=Trueinsetup_variables()andsetup_interval_variables(),data_table_concept_idsnot included within the concept table are now mapped from their respective alternateconcept_idincluded in the concept_relationship table to retrieve the available feature information. (#205) @KilianDahmsetup_variables()andsetup_interval_variables()with use of"person"now checksbirth_datetimefor meaningful behaviour and error messages. (#210) @eroellgen_default_config()provides convenience to generate a config directly from anEHRDataobject, and should be used instead of the previousehrdata.integrations.vitessce.gen_config. (#211) @eroell
[0.0.10]#
EHRData drops the .R field, and now supports 3D data storage in any slot of .layers. See the Getting started with EHRData tutorial for an introduction to this behaviour. In the future, .X will be enabled soon for 3D data storage as well.
Maintenance#
Enhanced Getting started with EHRData (#184) @eroell
Move from zarr<3 to zarr>=3 (#185) @eroell
Fixed#
Modified#
EHRDatadrops the.Rfield in favor of using.layersfor any 3D data arrays (#184) @eroellEHRData’s shape property will always return a 3 dimensional shape. If anEHRDataobject has flat arrays only, the third dimension will be 1. (#184) @eroellThe following functions now take a
layerargument:read_csv(),from_pandas(),to_pandas(),setup_variables(),setup_interval_variables(),ehrdata_blobs(),physionet2012(). If it is let to its default,None, the.Xfield ofEHRDatais used. Since.Xis 2D in this release, in cases with 3D data, thelayerargument needs to be used. (#184) @eroellwrite_zarr()now writes anEHRDataspecific store encoding, withanndataas a substore. This change allows to useAnnDatawith its change to consolidated Zarr metadata, and better isolatesAnnData’s io. (#185) @eroellread_zarr()is adapted to read the new store encoding, and can also deal withAnnDatastores. (#185) @eroell
[0.0.9]#
Maintenance#
Fixed#
Fix order of
varcreated ined.io.omop.setup_variablesanded.io.omop.setup_interval_variables(#179) @eroell
Modified#
[0.0.8]#
Fixed#
Update duckdb imports for future (#157) @eroell
Maintenance#
[0.0.7]#
Fixed#
Fix tests and Getting Started Notebook (#155) @eroell
Maintenance#
Update duckdb imports for future (#155) @eroell
[0.0.6]#
Fixed#
Cleaned up and updated tutorial notebooks (#140) @agerardy
Added#
read_csv()Reads a csv file (#136) @eroellread_h5adReads an h5ad file (#136) @eroellread_zarr()Reads a zarr file (#136) @eroellwrite_h5adWrites an h5ad file (#136) @eroellwrite_zarr()Writes a zarr file (#136) @eroellfrom_pandas()Transform a givenDataFrameinto anEHRDataobject (#136) @eroellto_pandas()Transform anEHRDataobject into aDataFrame(#136) @eroellmimic_2_preprocessed()Loads the preprocessed MIMIC-II dataset (#136) @eroelldiabetes_130_raw()Loads the raw diabetes-130 dataset (#136) @eroelldiabetes_130_fairlearn()Loads the preprocessed diabetes-130 dataset by fairlearn (#136) @eroellinfer_feature_types()Infer feature types in anEHRDataobject (#136) @eroellfeature_type_overview()Overview of inferred feature types (#136) @eroellreplace_feature_types()Replacing inferred feature types (#136) @eroellharmonize_missing_values()Harmonize missing values in anEHRDataobject (#136) @eroell
[0.0.5]#
Fixed#
Initialize EHRData with X and layers (#132) @eroell
Added#
Modified#
Rename
.tattribute to.tem
[0.0.4]#
Fixed#
Zarr version to less than 3
[0.0.3]#
Fixed#
Added missing zarr dependency
[0.0.2]#
Added#
Expanded documentation
Improved OMOP Extraction
Support for COO sparse matrices for R
A
ed.dt.ehrdata_blobstest data generator functionReplace -1 encoded missing values with nans in physionet2012 challenge data
Breaking changes#
Renamed
rtoR
[0.0.1] - 2024-11-04#
Added#
Initial release
[Unreleased]#
Added#
Basic tool, preprocessing and plotting functions
Fixed#
tutorial notebooks updated to align with breaking changes