You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
2.4 KiB
Python
49 lines
2.4 KiB
Python
import transport
|
|
import info
|
|
from multiprocessing import Process
|
|
import pandas as pd
|
|
from io import StringIO
|
|
import requests
|
|
import cms
|
|
import os
|
|
|
|
@cms.Plugin(mimetype='application/json')
|
|
def about (**_args):
|
|
return {'license':info.__license__,'author':transport.__app_name__, 'version':transport.__version__, 'supported':transport.supported().to_html(index=False,col_space=0,justify='left').replace("\n","").replace('border="1"','')}
|
|
#
|
|
# loading notebooks from github
|
|
@cms.Plugin(mimetype='application/json')
|
|
def _data (**_args) :
|
|
_csv = f"""provider,label,doc,url,notebook
|
|
etl,ETL,"Built-in ETL CLI program",https://healthcareio.the-phi.com/data-transport,etl.ipynb
|
|
mongodb,MongoDB,"mongodb is a NoSQL database developed by mongodb",https://mongodb.com,mongodb.ipynb
|
|
mysql,MySQL,"mysql is a relational database developed and maintained by Oracle",https://www.mysql.com,mysql.ipynb
|
|
postgresql,PostgreSQL,"postgresql is an object - relational database developed and maintained by PostgreSQL Global Development Group",https://www.postgresql.com,postgresql.ipynb
|
|
mssqlserver,MS SQL Server,"SQL Server a relational database server developed by Microsoft",https://www.microsoft.com,mssqlserver.ipynb
|
|
sqlite,sqlite,"sqlite is portable relational database",https://www.sqlite.com,sqlite.ipynb
|
|
s3,AWS S3,"AWS Simple Storage Service",https://www.aws.amazon.com/s3,s3.ipynb
|
|
"""
|
|
_df = pd.read_csv(StringIO(_csv))
|
|
return _df.drop_duplicates().to_dict(orient='records')
|
|
# MEM_PRODUCT_FILE = StringIO(f"""_,community,enterprise
|
|
# NoSQL,1,1
|
|
# RDBMS/SQL,1,1
|
|
# Cloud databases,1,1
|
|
# Other (MQTT; Files; https),1,1
|
|
# Warehouse,1,1
|
|
# """)
|
|
@cms.Plugin(mimetype="text/html")
|
|
def product(**_args):
|
|
_config = _args['config']
|
|
path = os.sep.join([_config['layout']['location'],_config['layout']['root'],'_assets','data','products.csv'])
|
|
_df = pd.read_csv(path)
|
|
|
|
return _df.to_html(index=0).replace(">",">").replace("<","<").replace("no",'<i class="fa-solid fa-times" style="color:red"></i>').replace("yes",'<i class="fa-solid fa-check" style="color:green"></i>')
|
|
|
|
@cms.Plugin(mimetype="application/json")
|
|
def registry (**_args):
|
|
if not transport.registry.isloaded() :
|
|
transport.registry.load()
|
|
_repo = transport.registry.DATA
|
|
_data = [{'label':key,'provider':_repo[key]['provider'],'plugins':([] if 'plugins' not in _repo[key] else _repo[key]['plugins'])} for key in _repo if 'provider' in _repo[key]]
|
|
return _data |