|
1 | 1 | # Feather RDF Mapper |
2 | 2 |
|
3 | | -A simple mapper to map and convert .feather data files into RDF triples in a specified ontology, specifically in the N-Triples format. |
| 3 | +A robust CLI tool to map and convert `.feather` data files into RDF triples (N-Triples format) based on a specified ontology. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Flexible Input**: Process a single `.feather` file or an entire directory recursively. |
| 8 | +- **Metric Filtering**: Filter for specific metrics (e.g., `environment.temperature`, `org.dyamand.types.health.SpO2`). |
| 9 | +- **Resampling**: Support for resampling data at a specified rate (in seconds). |
| 10 | +- **Event Limiting**: Limit the number of processed events for quick testing. |
| 11 | +- **Modern Packaging**: Uses `pyproject.toml` for easy installation and dependency management. |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +It is highly recommended to use a virtual environment. |
| 16 | + |
| 17 | +```bash |
| 18 | +# Clone the repository |
| 19 | +git clone <repo-url> |
| 20 | +cd stream-aggregator-evaluation-mapper |
| 21 | + |
| 22 | +# Install the package in editable mode |
| 23 | +pip install -e . |
| 24 | +``` |
| 25 | + |
| 26 | +This will install all necessary dependencies and provide the `feather-mapper` command globally in your environment. |
4 | 27 |
|
5 | 28 | ## Usage |
6 | 29 |
|
7 | | -Note: It is highly advised to use a venv with the required packages installed, as described in the [requirements](./requirements.txt) file. |
| 30 | +You can run the mapper using the installed `feather-mapper` command: |
| 31 | + |
| 32 | +```bash |
| 33 | +feather-mapper -i <input_path> -o <output_file> [options] |
| 34 | +``` |
| 35 | + |
| 36 | +Alternatively, you can still run it as a script: |
| 37 | + |
| 38 | +```bash |
| 39 | +python3 mapper/cli.py -i <input_path> -o <output_file> [options] |
| 40 | +``` |
| 41 | + |
| 42 | +### Arguments |
| 43 | + |
| 44 | +- `-i`, `--input`: (Required) Path to a single `.feather` file or a directory containing `.feather` files. |
| 45 | +- `-o`, `--output`: (Required) Path to the output `.nt` (RDF) file. |
| 46 | +- `-m`, `--metrics`: (Optional) Space-separated list of metrics to filter by. |
| 47 | +- `-n`, `--limit`: (Optional) Maximum number of total events to process. |
| 48 | +- `-s`, `--sample-rate`: (Optional) Resampling rate in seconds. |
| 49 | + |
| 50 | +### Examples |
| 51 | + |
| 52 | +**Process a single file for specific metrics:** |
| 53 | +```bash |
| 54 | +feather-mapper -i data/participant6.feather -o output/results.nt -m environment.temperature wearable.skt |
| 55 | +``` |
| 56 | + |
| 57 | +**Process a directory with resampling and an event limit:** |
| 58 | +```bash |
| 59 | +feather-mapper -i /path/to/dataset/ -o output/spo2_data.nt -m org.dyamand.types.health.SpO2 -n 1000 -s 2.0 |
| 60 | +``` |
| 61 | + |
| 62 | +## Testing |
| 63 | + |
| 64 | +To run the unit tests: |
8 | 65 |
|
9 | | -- Specify the name of the .feather file and the .nt file in the `mapper.py` file inside the mapper folder. |
10 | | -- Run the file as a script with, |
11 | 66 | ```bash |
12 | | -python3 mapper.py |
| 67 | +python3 -m unittest discover mapper/tests |
13 | 68 | ``` |
14 | | -- The .nt file will be created. |
15 | 69 |
|
16 | 70 | ## License |
17 | 71 |
|
18 | | -This code is copyrighted by [Ghent University - imec](https://www.ugent.be/ea/idlab/en) and |
19 | | -released under the [MIT Licence](./LICENCE) |
| 72 | +This code is copyrighted by [Ghent University - imec](https://www.ugent.be/ea/idlab/en) and released under the [MIT Licence](./LICENCE). |
20 | 73 |
|
21 | 74 | ## Contact |
22 | 75 |
|
23 | | -For any questions, please contact [Kush](mailto:kushagrasingh.bisen@ugent.be). |
| 76 | +For any questions, please contact [Kush](mailto:kushagrasingh.bisen@ugent.be). |
0 commit comments