UTHSCSA-CIRD/datafinisher

DFMeta file handler

Closed this issue · 1 comments

bokov commented

Implement the following logic, maybe at the start of DFMeta.init() but maybe in a separate function (pseudocode):

Accept inhandle
  if inhandle is None: 
    try: get the header and meta from those respective args
    except: valueError
  else:
    if inhandle is str and len(inhandle)>0:
      if file exists str: inhandle = filehandle(inhandle);  intype = 'file'
      elif URI resource exists str: inhandle = urihandle(inhandle); intype = 'uri'
      elif valid DB connection str: inhandle = dbopen(inhandle); intype = 'db'
      else: valueError
    # now inhandle should be an actual handle to some resource
    if intype in ('file','uri'):
      if filetype(intype) == 'tsv/csv': parse out headers and meta
      elif filetype(intype) == 'sqlite': pass to datafinisher and then read its output file (update inhandle)
      # future supported formats here
      else: valueError
    # datafinisher cannot yet read connections, only db files
    elif intype == 'db': pass to datafinisher and then read its output file (update inhandle)??
    else: valueError

Now, header, meta, and inhandle are used to init DFMeta. inhandle is optional at init as long as the other two are provided somehow.

bokov commented

Done! Merged into integration and master