Skip to content

Conversation

@adampal
Copy link

@adampal adampal commented Aug 27, 2025

This PR adds the ability to edit an EDF file or create a new one from scratch and write it out to disk.

You can load an existing EDF file and change signal names or values then write the file back out.

Or you can create a brand new EDF file and add signals and signal values directly.

Please note - this was written entirely by Claude 3.5 and Claude 4 using Cursor AI.
I only reviewed the code briefly for maintainability.
It is thoroughly tested though and it does work as advertised.

I need this functionality for my app, but wanted to contribute it back to the source if it's useful for anyone else.

I've added some example files to the repo that can act as documentation on how to use the new functionality.

If this is something you want to add to the gem, we can try to get it cleaned up and into a state that you're happy to accept. Otherwise, I'm happy to just host my own version for my needs and keep it separate.

Thanks for creating this gem, it's been really helpful!

adampal added 13 commits August 23, 2025 17:20
- Add and configure RuboCop for code style enforcement
- Fix code style issues across the codebase
- Improve method naming to follow Ruby conventions
- Fix line length and formatting issues
- Freeze mutable constants
- Improve test coverage to 89.76%
This change improves the API for creating new EDF files by:

- Adding support for in-memory EDF creation without temporary files

- Introducing Edf.create for a cleaner initialization API

- Adding automatic calculation of data records and signal counts

- Adding comprehensive test coverage for the new API

- Including example script for creating EDF files from scratch

The new API allows for more intuitive EDF creation without requiring temporary files.

Test coverage improved to 90.95%
This change adds support for handling large EDF files efficiently:

- Add streaming mode for writing large signals

- Add memory-efficient preview mode for reading

- Add batch processing to minimize memory usage

- Add example showing how to handle 3.2M values

Performance improvements:

- Write 6MB file (3.2M values) in <1 second

- Constant memory usage regardless of file size

- Efficient preview mode for verification

Example usage:
…ds example script for loading PPG data from zip file 2. Fixes signal value loading to handle all values, not just preview 3. Improves data record handling in EDF loading
…e scripts for large file handling 2. Add utility scripts for data generation and inspection 3. Update .gitignore to exclude example output and data files
… values from JSON file 2. Add sample JSON file for testing 3. Fix data record handling for small datasets 4. Add detailed signal verification output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant