bluesearch.server.mining_server module¶
The mining server.
- class MiningServer(models_libs, connection)[source]¶
Bases:
flask.app.Flask
The BBS mining server.
- Parameters
models_libs (dict of str) – Dictionary mapping each type of extraction (‘ee’ for entities, ‘re’ for relations, ‘ae’ for attributes) to the list of paths of available models.
connection (sqlalchemy.engine.Engine) – The database connection.
- check_args_not_null(**kwargs)[source]¶
Sanity check that arguments provided are not null.
Returns False if all is good.
- static create_error_response(error_message)[source]¶
Create response if there is an error during the process.
- Parameters
error_message (str) – Error message to send if there is an issue.
- Returns
response – Response to send with the error_message in a json format.
- Return type
str
- static create_response(df_extractions, etypes_na)[source]¶
Create the response thanks to dataframe.
- Parameters
df_extractions (pd.DataFrame) – DataFrame containing all the elements extracted by text mining.
etypes_na (Iterable[str]) – Entity types found in the request CSV file for which no available model was found in the library.
- Returns
response – Response containing the dataframe converted in csv table.
- Return type
requests.response
- get_available_etypes(schema_df)[source]¶
Find entity extraction model for entity types.
- Parameters
schema_df (pd.DataFrame) – Schema of the client request.
- Returns
etypes (set[str]) – Entity types requested and available on the server.
etypes_na (set[str]) – Entity types requested but not available on the server.