compress-file/README.md

23 lines
1.5 KiB
Markdown
Raw Normal View History

2024-06-25 04: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
2024-06-25 04:49:28 -07:00
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.
2024-06-25 04:24:27 -07:00
2024-06-25 04:49:28 -07:00
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.
2024-06-25 04:24:27 -07:00
2024-06-25 04:49:28 -07:00
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.
2024-06-25 04:24:27 -07:00
2024-06-25 04:49:28 -07:00
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.
2024-06-25 04:24:27 -07:00
2024-06-25 04:49:28 -07:00
## Compression Algorithm
2024-06-25 04:24:27 -07:00
2024-06-25 04:49:28 -07:00
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.