From 1801e3a85d9a447d564d3259648bdb427dfd6b07 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Sun, 26 Jun 2022 12:12:32 -0500 Subject: [PATCH] bug fix: export uses newer data-transport --- healthcareio/export/export.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/healthcareio/export/export.py b/healthcareio/export/export.py index ea74064..5382ba7 100644 --- a/healthcareio/export/export.py +++ b/healthcareio/export/export.py @@ -191,6 +191,7 @@ def init_sql(**_args): _config = jsonmerge.merge(_config,CUSTOM_CONFIG[TYPE]) # _info = meta(_config) + _projectSQLite = [] #-- sqlite projection for field_name in _info['main'] : _projectSQLite += ["json_extract(data,'$."+field_name+"') "+field_name] @@ -211,12 +212,17 @@ def init_sql(**_args): SQL = "SELECT DISTINCT :fields FROM "+TABLE_NAME+", json_each(data) x, json_each(x.value) i where x.key = ':table'" SQL = SQL.replace(":table",table).replace(":fields",",".join(project)) r += [{"table":table,"read":{"sql":SQL},"sql":create(table=table,key='claim_id',fields=fields)}] + return r def init(**_args): - if 'provider' in CONFIG['store'] and CONFIG['store']['provider'] == 'sqlite' : - return init_sql(**_args) - else: + # if 'provider' in CONFIG['store'] and CONFIG['store']['provider'] == 'sqlite' : + # return init_sql(**_args) + # else: + # return init_mongo(**_args) + if ('provider' in CONFIG['store'] and CONFIG['store']['provider'] == 'mongo') or ('type' in CONFIG['store'] and 'mongo' in CONFIG['store']['type']): return init_mongo(**_args) + else: + return init_sql(**_args) def init_mongo (**_args) : """ This function is intended to determine the number of tables to be created, as well as their type. @@ -330,6 +336,7 @@ class Factory: job_args = init(type=X12_TYPE) #-- getting the queries that will generate the objects we are interested in # print (json.dumps(job_args)) _jobs = [] + for row in job_args: # _store = json.loads(json.dumps(wstore)) _store = copy.deepcopy(wstore)