From 251f344c5b7e41ffecbe58f91123c99c8a45f5a2 Mon Sep 17 00:00:00 2001 From: mandalkam Date: Mon, 30 Sep 2024 15:25:37 +0200 Subject: [PATCH] Add progress bar --- home/fhirvalidation.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/home/fhirvalidation.py b/home/fhirvalidation.py index 1916e7c..a78ecd0 100644 --- a/home/fhirvalidation.py +++ b/home/fhirvalidation.py @@ -4,6 +4,7 @@ import pandas as pd import re import os import logging +from tqdm.auto import tqdm class Validator(): @@ -117,6 +118,13 @@ class Validator(): total = 0 logging.info(f"Found {total} resources") + if limit < total: + progressbar_total = limit + else: + progressbar_total = total + + progress_bar = tqdm(total=progressbar_total, desc="Validating") + count_entries = 0 entries = bundle_dict.get('entry') if entries: @@ -127,6 +135,8 @@ class Validator(): df_add = self.validate(resource_type, entry) df = pd.concat([df, df_add], ignore_index=True) count += 1 + progress_bar.update(1) + if (limit > 0 and count >= limit): is_limit_reached = True logging.info(