v2.0 upgrade #10

Merged
steve merged 26 commits from v2.0 into master 2024-02-09 16:00:08 +00:00
1 changed files with 32 additions and 3 deletions
Showing only changes of commit adcddf0654 - Show all commits

View File

@ -33,12 +33,16 @@ import time
from healthcareio import x12 from healthcareio import x12
from healthcareio.x12.parser import X12Parser from healthcareio.x12.parser import X12Parser
import requests import requests
import pandas as pd
import numpy as np
# import healthcareio # import healthcareio
# import healthcareio.x12.util # import healthcareio.x12.util
# from healthcareio.x12.parser import X12Parser # from healthcareio.x12.parser import X12Parser
app = typer.Typer() app = typer.Typer()
CONFIG_FOLDER = os.sep.join([os.environ['HOME'],'.healthcareio']) CONFIG_FOLDER = os.sep.join([os.environ['HOME'],'.healthcareio'])
HOST = "https://healthcareio.the-phi.com" if 'PARSER_HOST_URL' not in os.environ else os.environ['PARSER_HOST_URL']
@app.command(name='init') @app.command(name='init')
def config(email:str,provider:str='sqlite') : def config(email:str,provider:str='sqlite') :
"""\b """\b
@ -49,6 +53,7 @@ def config(email:str,provider:str='sqlite') :
:provider data store provider (visit https://hiplab.mc.vanderbilt.edu/git/hiplab/data-transport.git) :provider data store provider (visit https://hiplab.mc.vanderbilt.edu/git/hiplab/data-transport.git)
""" """
_db = "healthcareio" _db = "healthcareio"
global CONFIG_FOLDER
# _PATH = os.sep.join([os.environ['HOME'],'.healthcareio']) # _PATH = os.sep.join([os.environ['HOME'],'.healthcareio'])
if not os.path.exists(CONFIG_FOLDER) : if not os.path.exists(CONFIG_FOLDER) :
@ -75,8 +80,9 @@ def config(email:str,provider:str='sqlite') :
# This would also allow us to allow the users to be informed of new versions # This would also allow us to allow the users to be informed of new versions
# #
try: try:
host = "https://healthcareio.the-phi.com" if 'PARSER_HOST_URL' not in os.environ else os.environ['PARSER_HOST'] global HOST
url = f"{host}/api/users/signup" # HOST = "https://healthcareio.the-phi.com" if 'PARSER_HOST_URL' not in os.environ else os.environ['PARSER_HOST']
url = f"{HOST}/api/users/signup"
_body = {"email":email,"version":meta.__version__} _body = {"email":email,"version":meta.__version__}
_headers = {"content-type":"application/json"} _headers = {"content-type":"application/json"}
resp = requests.post(url,headers=_headers,data=json.dumps(_body)) resp = requests.post(url,headers=_headers,data=json.dumps(_body))
@ -94,7 +100,7 @@ def config(email:str,provider:str='sqlite') :
The generatted configuration file found at {CONFIG_FOLDER} The generatted configuration file found at {CONFIG_FOLDER}
The database provider is {provider} The database provider is {provider}
visit {host} to learn more about the features, visit {HOST} to learn more about the features,
""" """
@ -140,6 +146,29 @@ def parse (claim_folder:str,plugin_folder:str = None,config_path:str = None):
print ("...................... FINISHED .........................") print ("...................... FINISHED .........................")
# #
# #
@app.command()
def check():
"""
This function checks for the version running against the current version
"""
_info = [meta.__version__,None]
url = f'{HOST}/api/store/version'
try:
resp= requests.post(url)
_info[1] = resp.text if resp.status_code == 200 else "NA"
except Exception as e:
_info[1] = "NA"
pass
if _info[1] == "NA" :
_msg = "Unavailable server (unreachable)"
else:
_msg = ""
print ()
_info =pd.DataFrame(_info,columns=["versions"],index=["Yours","Current"])
print (_info)
print (_msg)
@app.command(name="export") @app.command(name="export")
def publish (file_type:str,path:str): def publish (file_type:str,path:str):