Go to file
2024-06-25 18:49:28 +07:00
static Fixes 2024-06-25 18:49:28 +07:00
main.py Fixes 2024-06-25 18:49:28 +07:00
README.md Fixes 2024-06-25 18:49:28 +07:00
requirements.txt First commit 2024-06-25 18:24:27 +07:00

Compress ECG byte

Instructions

After downloading the source code, ensure you have Python and Python Flask installed. Then, run python main.py and navigate to localhost:8888.

Design Considerations and Key Decisions

After doing some initial research, I learned there's no standardized format for ECG files. Therefore, there's nothing special we can do in terms of optimizing our compression algorithm for specific headers, special data structures, etc.

The project would require both a frontend and backend component. The frontend only required a simple web interface to upload the file and display information about the resulting compressed file.

For the backend, I went with Python Flask because it is the Python framework I have had the most experience with. When a user uploads a file, the backend will save the uploaded file to a specific input folder and immediately compress it into a separate output folder. Each file would be associated with a unique id (UUIDv4 for it's randomness) to prevent filename clashes.

This application could benefit from multithreading if there was enough load and big enough files as each file can be independently processed, but that is out of scope for this project.

Compression Algorithm

I chose to go with a simple Huffman Coding algorithm because it is a true and tested algorithm. The only difficult part was deciding whether to make each node 3-bytes or 1-byte, but it was much better to go with 1-byte because it only has 256 possible combinations.