Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ssi-dk/microreact_integration

Python code for integrating with Microreact
https://github.com/ssi-dk/microreact_integration

Last synced: 3 days ago
JSON representation

Python code for integrating with Microreact

Awesome Lists containing this project

README

        

# README for the Microreact Integration package

## Functions in functions.py

These are the main functions meant for external use in functions.py:

- new_project
- get_project_json
- update_project

In order to use the functions, these prerequisites have to be fulfilled:

- A running instance of Microreact which can be accessed with http(s) from the location where Python is running
- An personal access token that will permit creation of projects in Microreact for a user

When a user is logged into Microreact, his/her access token will be visible at .
The calling system should have a stored copy of this token for each user.

### new_project

#### Arguments

Mandatory arguments:

- project_name: str
- tree_calcs: list
- metadata_keys: list
- metadata_values: list
- mr_access_token: str
- mr_base_url: str

Optional arguments:

- public: bool=False
- verify: bool=True

##### project_name

The name of the project as it will appear in Microreact. The project owner can later change the name from inside Microreact.

##### tree_calcs

A list of dicts (or dict-like objects like MongoDB documents) which represent the trees that should be exported to Microreact.

The dicts must contain these keys:

- method: str - this string will be used as name for the tree in Microreact
- result: str - this is the actual tree structure formatted in Newick format

##### metadata_keys

This is a list of str elements that will be used as column names in the data table in Microreact.

##### metadata_values

This should be a list of lists where each element in the outer list represents a column in the data table and the elements in each inner list
hold the actual data for that column.

##### mr_access_token

The access token for the users who will own the project in Microreact.

##### mr_base_url

The base URL for the Microreact instance.

##### public

Optional Booelan. If set to True, the created Microreact project will be public. Default is False.

##### verify

Optional Boolean. If set to False, it will not be checked if the Microreact instance has a valid SSL certificate. Default is True.

#### Return value

new_project will return a dict with the following keys:

- isOwner: wether the user is owner of the project (in fact always True)
- id: unique project id generated by Microreact
- url: project URL

### new_project_2

#### Arguments

Mandatory arguments:

- project_name: str
- metadata:url: str
- columns: list
- mr_access_token: str
- mr_base_url: str

Optional arguments:

- tree_calcs: list=list()
- hidden: list=list()
- public: bool=False
- verify: bool=True

##### project_name

The name of the project as it will appear in Microreact. The project owner can later change the name from inside Microreact.

##### metadata_url

Thie URL to fetch the metadata from.

##### columns

A list of column names to be fetched from the external resource. Only the columns listed here will actually be fetched.

##### mr_access_token

The access token for the users who will own the project in Microreact.

##### mr_base_url

The base URL for the Microreact instance.

##### tree_calcs

A list of dicts (or dict-like objects like MongoDB documents) which represent the trees that should be exported to Microreact.

The dicts must contain these keys:

- method: str - this string will be used as name for the tree in Microreact
- result: str - this is the actual tree structure formatted in Newick format

##### hidden
A list of columns that should be hidden in the Microreact project.

##### public

Optional Booelan. If set to True, the created Microreact project will be public. Default is False.

##### verify

Optional Boolean. If set to False, it will not be checked if the Microreact instance has a valid SSL certificate. Default is True.

#### Return value

new_project will return a dict with the following keys:

- isOwner: wether the user is owner of the project (in fact always True)
- id: unique project id generated by Microreact
- url: project URL