<commit_before># PhenoTipsBot
**PhenoTipsBot** is a Python framework for manipulating patient data on a
PhenoTips server. Patient records are represented as
[Python dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries),
with each key corresponding to a [PatientClass](https://playground.phenotips.org/bin/PhenoTips/PatientClass)
property and each value being a string. Values are not validated during insertion.

import-csv.py an example program that demonstrates using this framework to
create new patient records from a spreadsheet.

PhenoTipsBot uses a combination of the
[PhenoTips REST API](https://phenotips.org/DevGuide/RESTfulAPI), the
[XWiki REST API](http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI),
and [PhantomJS](http://phantomjs.org/) because the PhenoTips REST API cannot
manipulate studies, pedigrees, or custom properties that have been added to the
PatientClass. PhenoTips 1.2.2 or later is required.

PhenoTipsBot depends on the
[Python requests library](http://docs.python-requests.org/en/latest/), but this
can be easily installed with `sudo pip install requests`.

## Reference
### PhenoTipsBot(base_url, username, password)
Constructs a PhenoTipsBot instance with the specified parameters. The base URL
should include the protocol but no trailing slash. Any changes made to the
server will be logged under the provided username.

### create(patient_obj, study, pedigree)
Creates a new patient page and returns the patient ID (e.g. 'P000123'). If
patient_obj, study, or pedigree is given, set, set_study, or set_pedigree is
also called.

### export_pedigree_ped(patient_id, id_generation='external')<commit_msg>Mention Selenium dependency in the README<commit_after># PhenoTipsBot
**PhenoTipsBot** is a Python framework for manipulating patient data on a
PhenoTips server. Patient records are represented as
[Python dictionaries](https://docs.python.org/3/tutorial/datastructures.html#dictionaries),
with each key corresponding to a [PatientClass](https://playground.phenotips.org/bin/PhenoTips/PatientClass)
property and each value being a string. Values are not validated during insertion.

import-csv.py an example program that demonstrates using this framework to
create new patient records from a spreadsheet.

PhenoTipsBot uses a combination of the
[PhenoTips REST API](https://phenotips.org/DevGuide/RESTfulAPI), the
[XWiki REST API](http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI),
and [PhantomJS](http://phantomjs.org/) because the PhenoTips REST API cannot
manipulate studies, pedigrees, or custom properties that have been added to the
PatientClass. PhenoTips 1.2.2 or later is required.

PhenoTipsBot depends on the
[Python Selenium bindings](https://selenium-python.readthedocs.org/) and the
[Python requests library](http://docs.python-requests.org/en/latest/), but these
can be easily installed with `sudo apt-get install python-selenium` and
`sudo pip install requests`.

## Reference
### PhenoTipsBot(base_url, username, password)
Constructs a PhenoTipsBot instance with the specified parameters. The base URL
should include the protocol but no trailing slash. Any changes made to the
server will be logged under the provided username.

### create(patient_obj, study, pedigree)
Creates a new patient page and returns the patient ID (e.g. 'P000123'). If
patient_obj, study, or pedigree is given, set, set_study, or set_pedigree is
also called.

### export_pedigree_ped(patient_id, id_generation='external')
{'fraction_non_alphanumeric': 0.08402164625462831, 'fraction_numerical': 0.005696382796923953, 'mean_word_length': 5.651515151515151, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 7, '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': '5718693', 'n_tokens_mistral': 1089, 'n_tokens_neox': 996, 'n_words': 384}