Skip to content

Commit cd63dad

Browse files
v0.1.8, get_start_end -> get_next_word and slugify meta_cols
1 parent b6b1c91 commit cd63dad

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

payment_parser/helpers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ def slugify(value):
2020
return re.sub(r'[-\s]+', '_', value).strip('-_')
2121

2222

23-
def get_start_end(search_key, block):
23+
def get_next_word(search_key, block):
2424
"""
25-
Searches for the start and end location of search_key in block.
25+
Searches for the next word after search_key in block.
2626
2727
Args:
2828
search_key: the string segement to return index of
2929
block: the blob containing search_key and likely other text
3030
Returns:
31-
(start, end)
31+
The string following search_key in block
3232
"""
3333
search_result = ""
3434
if bool(re.search(search_key, block)):
@@ -265,9 +265,9 @@ def parse_doc(file, output_dir, split_term, verbose):
265265
if is_table_empty == 1:
266266
print("***** No data found in block above.")
267267
continue
268-
block_meta = {"REPORT": report_id}
268+
block_meta = {"report": report_id}
269269
for meta_column in meta_cols:
270-
block_meta[meta_column] = get_start_end(meta_column, block)
270+
block_meta[slugify(meta_column)] = get_next_word(meta_column, block).strip()
271271
raw_result = parse_block_table_data(table_type, report_type, block, verbose)
272272
cleaned_result = {}
273273
for key in raw_result.keys():

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33

44

5-
VERSION = '0.1.7'
5+
VERSION = '0.1.8'
66
DESCRIPTION = 'Python Script for Parsing Payments File.'
77
this_directory = Path(__file__).parent
88
long_description = (this_directory / "README.md").read_text()

0 commit comments

Comments
 (0)