# nhp-prep
This is a CLI Tool that has been created to pre-process historical data that has been collected
in multiple instances. This includes data collected at Seneca Zoo and Mellon Institute.
## Requirements
This package **_requires Python 3._**
## Installing
To install this CLI tool you can run the below command
```bash
pip3 install nhp-prep
```
## Updating
If you already have this tool installed, you can update it to the latest stable release by using the following command:
```bash
pip3 install -U nhp-prep
```
Alternatively, you clone this repo and then run this command from **_within_** the repository folder
```bash
python3 setup.py install
```
Another way to install this solution is by running the following command from **_within_** the repository folder:
```bash
pip install -e .
```
Both the above commands would install the package globally and `nhp-prep` will be available on your system.
## How to use
There are multiple instances in which you can use this tool.
```bash
nhp-prep COMMAND [OPTIONS]
```
There are four use-cases (commands) in which you can use this tool:
1. Mapping columns from prior to current format (`reorder-columns`)
```bash
nhp-prep reorder-columns -i <directory_with_files_to_reorder_columns_OR_unique_CSV_file> -o <output_directory> -r <file_with_reference_columns>
```
2. Rename the files to follow current standard (`rename`)
```bash
nhp-prep rename -i <directory_files_to_rename> -o <output_directory>
```
The current format for the file is: `YYYY-MM-DD_HHmmh_<experiment_name>_<Subject_name>_<Researcher_name_or_initials>_data.csv`
3. Timestamp estimation trials from historical data files based on column <X> (`timestamp-estimate`)
```bash
nhp-prep timestamp-estimate -i <directory_with_files_OR_unique_CSV_file> -o <output_directory>
```
### **Since v0.3.0**
Since the previous 3 steps are common across the different datasets collected, the dev team decided to merge them into one single command (`preparation-steps`):
```bash
nhp-prep preparation-steps -i <input_directory> -o <output_directory>
```
**_The previous command will run sequentially the steps 1 to 3. The only command left outside of the bundle is the #4 since that is only applicable for the Baboons' data and requires the additional reference file._**
4. Renaming of Subject according to logs file (needs the file) (`sub-rename`)
```bash
nhp-prep sub-rename -r <file_with_columns_and_reference_subject_names> -i <directory_with_files_OR_unique_CSV_file> -o <output_directory>
```
5. Merge multiple CSV files into a single file. The input should be a directory and so is the output
```bash
nhp-prep merge-csv -i <directory_with_files_OR_unique_CSV_file> -o <output_directory>
```
6. You can perform a data cleaning process by using the merged-csv file from step #5 based on hardcoded rules, such as the name of the Experiment, the Date or the Researcher name as well.
```bash
nhp-prep data-cleaning -i <merged_csv_file> -o <output_directory>
```
## Using the help sub-command
You could also run `nhp-prep --help` to see the available commands and their corresponding usage.
If you want to know all the options available for an specific command, run the following:
```bash
nhp-prep COMMAND --help
```
Example:
```bash
nhp-prep sub-rename --help
```
## Feedback
Please feel free to leave feedback in issues/PRs.
Raw data
{
"_id": null,
"home_page": "https://caoslab.psy.cmu.edu:32443/monkeylab/preprocessing-scripts",
"name": "nhp-prep",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "nhp-prep, caoslab, cmu, pre-processing",
"author": "Hugo Angulo, Zijun Zhao",
"author_email": "hugoanda@andrew.cmu.edu, zijunzha@andrew.cmu.edu",
"download_url": "https://files.pythonhosted.org/packages/af/66/aaa293a8c511cb6bb594da191d798934c3f69fd6bd6c4b3ba88e01721ffa/nhp-prep-1.0.2.tar.gz",
"platform": null,
"description": "# nhp-prep\n\nThis is a CLI Tool that has been created to pre-process historical data that has been collected\nin multiple instances. This includes data collected at Seneca Zoo and Mellon Institute.\n\n## Requirements\n\nThis package **_requires Python 3._**\n\n## Installing\n\nTo install this CLI tool you can run the below command\n\n```bash\npip3 install nhp-prep\n```\n\n## Updating\n\nIf you already have this tool installed, you can update it to the latest stable release by using the following command:\n\n```bash\npip3 install -U nhp-prep\n```\n\nAlternatively, you clone this repo and then run this command from **_within_** the repository folder\n\n```bash\npython3 setup.py install\n```\n\nAnother way to install this solution is by running the following command from **_within_** the repository folder:\n\n```bash\npip install -e .\n```\n\nBoth the above commands would install the package globally and `nhp-prep` will be available on your system.\n\n## How to use\n\nThere are multiple instances in which you can use this tool.\n\n```bash\nnhp-prep COMMAND [OPTIONS]\n```\n\nThere are four use-cases (commands) in which you can use this tool:\n\n1. Mapping columns from prior to current format (`reorder-columns`)\n\n```bash\nnhp-prep reorder-columns -i <directory_with_files_to_reorder_columns_OR_unique_CSV_file> -o <output_directory> -r <file_with_reference_columns>\n```\n\n2. Rename the files to follow current standard (`rename`)\n\n```bash\nnhp-prep rename -i <directory_files_to_rename> -o <output_directory>\n```\n\nThe current format for the file is: `YYYY-MM-DD_HHmmh_<experiment_name>_<Subject_name>_<Researcher_name_or_initials>_data.csv`\n\n3. Timestamp estimation trials from historical data files based on column <X> (`timestamp-estimate`)\n\n```bash\nnhp-prep timestamp-estimate -i <directory_with_files_OR_unique_CSV_file> -o <output_directory>\n```\n\n### **Since v0.3.0**\n\nSince the previous 3 steps are common across the different datasets collected, the dev team decided to merge them into one single command (`preparation-steps`):\n\n```bash\nnhp-prep preparation-steps -i <input_directory> -o <output_directory>\n```\n\n**_The previous command will run sequentially the steps 1 to 3. The only command left outside of the bundle is the #4 since that is only applicable for the Baboons' data and requires the additional reference file._**\n\n4. Renaming of Subject according to logs file (needs the file) (`sub-rename`)\n\n```bash\nnhp-prep sub-rename -r <file_with_columns_and_reference_subject_names> -i <directory_with_files_OR_unique_CSV_file> -o <output_directory>\n```\n\n5. Merge multiple CSV files into a single file. The input should be a directory and so is the output\n\n```bash\nnhp-prep merge-csv -i <directory_with_files_OR_unique_CSV_file> -o <output_directory>\n```\n\n6. You can perform a data cleaning process by using the merged-csv file from step #5 based on hardcoded rules, such as the name of the Experiment, the Date or the Researcher name as well.\n\n```bash\nnhp-prep data-cleaning -i <merged_csv_file> -o <output_directory>\n```\n\n## Using the help sub-command\n\nYou could also run `nhp-prep --help` to see the available commands and their corresponding usage.\n\nIf you want to know all the options available for an specific command, run the following:\n\n```bash\nnhp-prep COMMAND --help\n```\n\nExample:\n\n```bash\nnhp-prep sub-rename --help\n```\n\n## Feedback\n\nPlease feel free to leave feedback in issues/PRs.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Pre-processing data tool for NHP Lab @ CMU",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://caoslab.psy.cmu.edu:32443/monkeylab/preprocessing-scripts"
},
"split_keywords": [
"nhp-prep",
" caoslab",
" cmu",
" pre-processing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58f48b6424ac4b186c59af4541e65fe5117e0383be8fdeb5497f31f2fdabcd15",
"md5": "ac057cc31e296f0e5c80a20fcd1c08ea",
"sha256": "55c800313b5ac9d07f9c3106aeecb5d9b917e15926c783b19ad1bc73ce2287a8"
},
"downloads": -1,
"filename": "nhp_prep-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ac057cc31e296f0e5c80a20fcd1c08ea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21761,
"upload_time": "2024-09-07T15:04:57",
"upload_time_iso_8601": "2024-09-07T15:04:57.712948Z",
"url": "https://files.pythonhosted.org/packages/58/f4/8b6424ac4b186c59af4541e65fe5117e0383be8fdeb5497f31f2fdabcd15/nhp_prep-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "af66aaa293a8c511cb6bb594da191d798934c3f69fd6bd6c4b3ba88e01721ffa",
"md5": "3d5e3c598359755801f1c7fc7e9c650d",
"sha256": "843d007406bbe3583e7a4bab33761c1d822669f158d513f69baec1aa5ac61642"
},
"downloads": -1,
"filename": "nhp-prep-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "3d5e3c598359755801f1c7fc7e9c650d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 19422,
"upload_time": "2024-09-07T15:04:59",
"upload_time_iso_8601": "2024-09-07T15:04:59.386598Z",
"url": "https://files.pythonhosted.org/packages/af/66/aaa293a8c511cb6bb594da191d798934c3f69fd6bd6c4b3ba88e01721ffa/nhp-prep-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-07 15:04:59",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "nhp-prep"
}