# Hofund - Proto Recommendor

Python based tool which recommends the common proto messages/fields that can be used as replacements for clevertap fields.

## Requirements

If you want to install using pip, you would need - 
- python 3.9
- pip3.9

## Installation

### Using pip

To install latest version of hofund
```
pip install hofund
```

### Using brew

```
brew update
brew tap gojek/de git@source.golabs.io:asgard/lib/homebrew-tap
brew install hofund
```

## Usage    

To begin using the tool first user needs to export stencil token, this is used to contect with Stencil service. For token contact @Ramey/@Chakravarthy V P
```
export HOFUND_STENCIL_TOKEN="<token>" 
```

To check the usage
```
hofund --help
``` 

### Quickstart
The input to the tool is a csv which should contain a column that has the context for properties that needs mapping. The column name is given as input while runing the tool.

Example - We have a [sheet](https://docs.google.com/spreadsheets/d/1fuh8CJdCOSaMwGlgBeAF24FI6DS2wJj2LvDezsTmuMw/edit#gid=1702969007) that contains the common format for proto mapping. In this sheet the column `Context/Meaning` should be populated and then the sheet should be exported as a `csv`.

Run `hofund --f <csv_file> --ctx-col <context_column_name> `, you can also give parameter `--ctx-col-num <context_col_num>` as column number of the context column.

After the successful execution, the outputs are added as two columns in the same csv, column `Recommended Messages` are the recommended proto names and `Recommended Fields` are the recommended proto fields based on the given context.

## Working
The tool works on the context specified by the user. It searches all the proto definitions and the comments by each keyword in the context column. Ensure that it is concise, preferabbly in one or two words seperated by a delimeter.
For example if the context is `App version` then tool searches for all proto definitions that contains either `app` or `version` in the name or comments.

## Params
* `--ctx-keys-del ` - context delimeter, by default it's space.
* `--out-msg-col` - column name that contains the name of the recommended proto definitions, by default it's `Recommended Messages`.
* `--out-field-col` - column name that contains the field names of the recommended proto definitions, by default `Recommended Fields`.