Index: cloud_sync.py =================================================================== diff -u -r7c2ce42783d5475b483af47e22a089f4b032b7c1 -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloud_sync.py (.../cloud_sync.py) (revision 7c2ce42783d5475b483af47e22a089f4b032b7c1) +++ cloud_sync.py (.../cloud_sync.py) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -20,7 +20,7 @@ from cloudsync.utils.heartbeat import HeartBeatProvider from cloudsync.handlers.error import Error -VERSION = "0.4.6" +VERSION = "0.4.7" arguments = sys.argv log_level = int(arguments[1]) @@ -69,7 +69,7 @@ g_config = helpers_read_config(OPERATION_CONFIG_FILE_PATH) CONFIG_PATH = OPERATION_CONFIG_FILE_PATH - reachability_provider = ReachabilityProvider(logger=app.logger) + reachability_provider = ReachabilityProvider(logger=app.logger, url_reachability=g_config[CONFIG_KEBORMED][CONFIG_KEBORMED_REACHABILITY_URL]) g_utils.add_reachability_provider(reachability_provider=reachability_provider) Index: cloudsync/config/config.json =================================================================== diff -u -rcc7bbd932684e69aa456c114596625546630903e -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloudsync/config/config.json (.../config.json) (revision cc7bbd932684e69aa456c114596625546630903e) +++ cloudsync/config/config.json (.../config.json) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -4,6 +4,7 @@ "url_mft": "http://172.31.99.117:3000", "url_dcs": "https://device-api.diality.staging.kebormed.com", "url_device_identity": "https://device-identity.diality.staging.kebormed.com/auth/realms/Main/protocol/openid-connect/token", + "url_reachability": "https://healthcheck.diality.staging.kebormed.com/", "dia_org_id": 1 }, "device": { Index: cloudsync/config/config_INT.json =================================================================== diff -u -r3b80d8631090f72584ae2a309efcea2d20b4f62e -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloudsync/config/config_INT.json (.../config_INT.json) (revision 3b80d8631090f72584ae2a309efcea2d20b4f62e) +++ cloudsync/config/config_INT.json (.../config_INT.json) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -4,6 +4,7 @@ "url_mft": "", "url_dcs": "https://device-api.diality.integration.kebormed.com", "url_device_identity": "https://device-identity.diality.integration.kebormed.com:31400/auth/realms/Main/protocol/openid-connect/token", + "url_reachability": "https://healthcheck.diality.integration.kebormed.com/", "dia_org_id": 1 }, "device": { Index: cloudsync/config/config_QA.json =================================================================== diff -u -r3b80d8631090f72584ae2a309efcea2d20b4f62e -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloudsync/config/config_QA.json (.../config_QA.json) (revision 3b80d8631090f72584ae2a309efcea2d20b4f62e) +++ cloudsync/config/config_QA.json (.../config_QA.json) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -4,6 +4,7 @@ "url_mft": "", "url_dcs": "https://device-api.diality.qa.kebormed.com", "url_device_identity": "https://device-identity.diality.qa.kebormed.com:31400/auth/realms/Main/protocol/openid-connect/token", + "url_reachability": "https://healthcheck.diality.qa.kebormed.com/", "dia_org_id": 1 }, "device": { Index: cloudsync/config/config_STAGING.json =================================================================== diff -u -rcc7bbd932684e69aa456c114596625546630903e -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloudsync/config/config_STAGING.json (.../config_STAGING.json) (revision cc7bbd932684e69aa456c114596625546630903e) +++ cloudsync/config/config_STAGING.json (.../config_STAGING.json) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -4,6 +4,7 @@ "url_mft": "", "url_dcs": "https://device-api.diality.staging.kebormed.com", "url_device_identity": "https://device-identity.diality.staging.kebormed.com/auth/realms/Main/protocol/openid-connect/token", + "url_reachability": "https://healthcheck.diality.staging.kebormed.com/", "dia_org_id": 1 }, "device": { Index: cloudsync/config/treatment_report_template.json =================================================================== diff -u -rae065dc96f33fc1946785ee833356dae959be2d9 -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloudsync/config/treatment_report_template.json (.../treatment_report_template.json) (revision ae065dc96f33fc1946785ee833356dae959be2d9) +++ cloudsync/config/treatment_report_template.json (.../treatment_report_template.json) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -23,10 +23,10 @@ "dialysateTemp": 0, "dialyzerModel": "", "heparinType": "", - "heparinConcentration": 0, - "heparinBolus": 0, - "heparinRate": 0, - "heparinStopBeforeTreatmentEnd": 0 + "heparinConcentration": "", + "heparinBolus": "", + "heparinRate": "", + "heparinStopBeforeTreatmentEnd": "" }, "time": { "start": 0, @@ -46,7 +46,7 @@ "finalTargetUltrafiltrationRate": 0, "actualUltrafiltrationRate": 0, "salineBolusVolumeGiven": 0, - "heparinDelivered": 0 + "heparinDelivered": "" }, "diagnostics": { "waterSampleTestResult": "" Index: cloudsync/utils/globals.py =================================================================== diff -u -rae065dc96f33fc1946785ee833356dae959be2d9 -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloudsync/utils/globals.py (.../globals.py) (revision ae065dc96f33fc1946785ee833356dae959be2d9) +++ cloudsync/utils/globals.py (.../globals.py) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -20,6 +20,7 @@ CONFIG_KEBORMED_DCS_URL = "url_dcs" CONFIG_KEBORMED_IDP_CLIENT_SECRET = "idp_client_secret" CONFIG_KEBORMED_DEVICE_IDENTITY_URL = "url_device_identity" +CONFIG_KEBORMED_REACHABILITY_URL = "url_reachability" CONFIG_KEBORMED_DIA_ORG_ID = "dia_org_id" # CONFIG @@ -127,3 +128,4 @@ # TIME CONSTANTS S_MS_CONVERSION_FACTOR = 1000 + Index: cloudsync/utils/helpers.py =================================================================== diff -u -rae065dc96f33fc1946785ee833356dae959be2d9 -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloudsync/utils/helpers.py (.../helpers.py) (revision ae065dc96f33fc1946785ee833356dae959be2d9) +++ cloudsync/utils/helpers.py (.../helpers.py) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -366,15 +366,13 @@ elif line.startswith(HEPARIN_TYPE): treatment_data['data']['treatment']['parameters']['heparinType'] = line.split(',')[1] elif line.startswith(HEPARIN_CONCENTRATION): - treatment_data['data']['treatment']['parameters']['heparinConcentration'] = float( - line.split(',')[1]) + treatment_data['data']['treatment']['parameters']['heparinConcentration'] = line.split(',')[1] elif line.startswith(HEPARIN_BOLUS_VOLUME): - treatment_data['data']['treatment']['parameters']['heparinBolus'] = float(line.split(',')[1]) + treatment_data['data']['treatment']['parameters']['heparinBolus'] = line.split(',')[1] elif line.startswith(HEPARIN_DISPENSE_RATE): - treatment_data['data']['treatment']['parameters']['heparinRate'] = float(line.split(',')[1]) + treatment_data['data']['treatment']['parameters']['heparinRate'] = line.split(',')[1] elif line.startswith(HEPARIN_STOP): - treatment_data['data']['treatment']['parameters']['heparinStopBeforeTreatmentEnd'] = int( - line.split(',')[1]) + treatment_data['data']['treatment']['parameters']['heparinStopBeforeTreatmentEnd'] = line.split(',')[1] elif line.startswith(TREATMENT_START_DATE_TIME): element = datetime.datetime.strptime(line.split(',')[1], "%Y/%m/%d %H:%M") timestamp = datetime.datetime.timestamp(element) @@ -408,7 +406,7 @@ elif line.startswith(SALINE_BOLUS_VOLUME): treatment_data['data']['deviceTreatmentData']['salineBolusVolumeGiven'] = float(line.split(',')[1]) elif line.startswith(HEPARIN_DELIVERED_VOLUME): - treatment_data['data']['deviceTreatmentData']['heparinDelivered'] = float(line.split(',')[1]) + treatment_data['data']['deviceTreatmentData']['heparinDelivered'] = line.split(',')[1] elif line.startswith(WATER_SAMPLE_TEST_RESULT): treatment_data['data']['diagnostics']['waterSampleTestResult'] = line.split(',')[1] counter += 1 Index: cloudsync/utils/reachability.py =================================================================== diff -u -re2b5bba1ace2613e8cd3ca6d997756b1b61d77a4 -r212c40f5d16ccbf9eefa244fad747e9abda61b60 --- cloudsync/utils/reachability.py (.../reachability.py) (revision e2b5bba1ace2613e8cd3ca6d997756b1b61d77a4) +++ cloudsync/utils/reachability.py (.../reachability.py) (revision 212c40f5d16ccbf9eefa244fad747e9abda61b60) @@ -8,16 +8,17 @@ import requests -REACHABILITY_URL = "https://healthcheck.diality.staging.kebormed.com/" +# REACHABILITY PARAMETERS REACHABILITY_CHECK_PAUSE = 5 REACHABILITY_CYCLES = 3 REACHABILITY_CYCLE_PAUSE = 10 class ReachabilityProvider: - def __init__(self, logger: Logger): + def __init__(self, logger: Logger, url_reachability): self.logger = logger + self.url_reachability = url_reachability self.reachability = False self.thread = Thread(target=self.reachability_test, daemon=True) self.thread.start() @@ -28,11 +29,11 @@ """ while True: headers = { - 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36', + 'User-Agent': USER_AGENT, } try: - response = requests.get(url=REACHABILITY_URL, headers=headers) + response = requests.get(url=self.url_reachability, headers=headers) status_code = response.status_code except requests.exceptions.RequestException: status_code = INTERNAL_SERVER_ERROR