From 22f86d0ea260ace0a263d3e35efe44f15c497c17 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Mon, 3 May 2021 15:06:45 -0500 Subject: [PATCH] bugfix: date pasing --- healthcareio/x12/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/healthcareio/x12/__init__.py b/healthcareio/x12/__init__.py index 4f0ad0f..56a53f6 100644 --- a/healthcareio/x12/__init__.py +++ b/healthcareio/x12/__init__.py @@ -286,8 +286,15 @@ class Parser (Process): value = row[index] if 'cast' in config and key in config['cast'] and value.strip() != '' : - if config['cast'][key] in ['float','int'] and (value.isnumeric() or (len(value.split('.')) == 1) and value.replace('.','').isnumeric() ): - value = eval(config['cast'][key])(value) + if config['cast'][key] in ['float','int']: + try: + value = eval(config['cast'][key])(value) + except Exception as e: + pass + # + # Sometimes shit hits the fan when the anchor is missing + # This is typical but using the hardened function helps circumvent this (SV2,SV3) + # elif hasattr(handler,config['cast'][key]): pointer = getattr(handler,config['cast'][key])