parent
3fc6778802
commit
3975643686
@ -1,31 +1,36 @@
|
||||
""""
|
||||
This module is designed to perform exports to a relational data stores
|
||||
__doc__ = """"
|
||||
This module is designed to perform exports to a relational data stores, We have 2 methods to infer structure possible :
|
||||
1. learn structure from the data
|
||||
2. use template: fast, but may not generalize
|
||||
Note that the There are two possible methods to perform relational exports
|
||||
"""
|
||||
import transport
|
||||
from transport import providers
|
||||
import healthcareio.x12.plugins
|
||||
# import transport
|
||||
# from transport import providers
|
||||
# # from healthcareio.x12 import plugins, util
|
||||
# print ('hello world')
|
||||
# class Mode :
|
||||
# TEMPLATE,LEARN = [0,1]
|
||||
# def build ():
|
||||
# pass
|
||||
# class Template :
|
||||
# """
|
||||
# This class is intended to generate a set of SQL Instructions to to create the tables
|
||||
# """
|
||||
# @staticmethod
|
||||
# def build (**_args):
|
||||
# """
|
||||
# This function will build SQL statements to create a table (perhaps not needed)
|
||||
# :plugins loaded plugins
|
||||
# :x12 837|835 file types
|
||||
# """
|
||||
# _plugins=_args['plugins']
|
||||
# _x12 = _args['x12']
|
||||
# _template = util.template(plugins=_plugins)[_x12]
|
||||
# _primaryKey = util.getPrimaryKey(plugins=_plugins,x12=_x12)
|
||||
# _tables = []
|
||||
# for _item in _template :
|
||||
# if _primaryKey not in _item :
|
||||
# _item[_primaryKey] = ''
|
||||
# _tables.append(_item)
|
||||
# return _tables
|
||||
|
||||
#
|
||||
# We start by loading all the plugins
|
||||
def primary_key (**_args) :
|
||||
_plugins = _args['plugins']
|
||||
for key in _plugins :
|
||||
# _lpointers =
|
||||
def init (**_args):
|
||||
if 'path' in _args :
|
||||
_path = _args['path']
|
||||
_plugins,_parents = healthcareio.x12.plugins.instance(path=_path)
|
||||
else:
|
||||
_plugins,_parents = healthcareio.x12.plugins.instance()
|
||||
for key in _plugins :
|
||||
_lpointers = _plugins[key]
|
||||
_foreign = {}
|
||||
_table = {}
|
||||
for _pointer in _lpointers :
|
||||
_meta = _pointer.meta
|
||||
if 'map' in _meta :
|
||||
_attr = list(_meta['map'].values())
|
||||
if 'field' in _meta :
|
||||
_name = _meta['field']
|
||||
_foreign[_name] = _attr
|
Loading…
Reference in new issue