<commit_before>rmas_adapter
============

A basic framework for building RMAS adapters

This package will create for you a skeleton rmas adapter, it will know how to connect to
and poll an rmas bus for events, and when an event is detected, it can be configured to
send the payload of those events to the event handlers that you specify.

Installation
============

Either clone from github: [git://github.com/UoK-Psychology/rmas_adapter.git](git://github.com/UoK-Psychology/rmas_adapter.git) then do 

`python setup.py install`

or:

`pip install RMASAdapter`

Configuring
===========

To create your adapter skeleton, you will need to run the `rmas_adapter_admin.py` script
as follows:

```
python rmas_adapter_admin.py create --name <adapter name> 
									--target <directory to generate code into>(optional)
```


When this command has run, it will have created the adapter skeleton in a directory with the
same name as the `--name` argument. This adapter skeleton contains:

* runner.py - Use this to start your adapter running
* settings.py - Basic settings for the adapter, and configuration point for adding your functionality

The settings file must contain valid settings for:

RMAS\_BUS\_WSDL : the url to the RMAS ESB  
POLL\_INTERVAL : the number of milliseconds to wait between polling

If you want your adapter to do anything then you will need to also specify:

RMAS_EVENTS: this configures the events that you want your adapter to respond to and  looks like:
[('<RMAS_EVENT_NAME>,'path.to.handler.package'),]

Your handler package must specify a module called handler.py, which should have a function that has
the following signature:

```
def handle_event(payload):<commit_msg>renamed the EVENTS setting<commit_after>rmas_adapter
============

A basic framework for building RMAS adapters

This package will create for you a skeleton rmas adapter, it will know how to connect to
and poll an rmas bus for events, and when an event is detected, it can be configured to
send the payload of those events to the event handlers that you specify.

Installation
============

Either clone from github: [git://github.com/UoK-Psychology/rmas_adapter.git](git://github.com/UoK-Psychology/rmas_adapter.git) then do 

`python setup.py install`

or:

`pip install RMASAdapter`

Configuring
===========

To create your adapter skeleton, you will need to run the `rmas_adapter_admin.py` script
as follows:

```
python rmas_adapter_admin.py create --name <adapter name> 
									--target <directory to generate code into>(optional)
```


When this command has run, it will have created the adapter skeleton in a directory with the
same name as the `--name` argument. This adapter skeleton contains:

* runner.py - Use this to start your adapter running
* settings.py - Basic settings for the adapter, and configuration point for adding your functionality

The settings file must contain valid settings for:

RMAS\_BUS\_WSDL : the url to the RMAS ESB  
POLL\_INTERVAL : the number of milliseconds to wait between polling

If you want your adapter to do anything then you will need to also specify:

EVENTS: this configures the events that you want your adapter to respond to and  looks like:
`[('<RMAS_EVENT_NAME>,'path.to.handler.package'),]`

Your handler package must specify a module called handler.py, which should have a function that has
the following signature:

```
def handle_event(payload):
{'fraction_non_alphanumeric': 0.08108108108108109, 'fraction_numerical': 0.0, 'mean_word_length': 4.563725490196078, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2780922', 'n_tokens_mistral': 970, 'n_tokens_neox': 900, 'n_words': 450}