Skip to content

Commit

Permalink
Changes suggested during review
Browse files Browse the repository at this point in the history
  • Loading branch information
pipliggins committed Aug 22, 2024
1 parent 0b47557 commit e809c1e
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions fhirflat/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def convert_resource(
resource, data, map_file, t, subject_id, date_format, timezone
):
start_time = timeit.default_timer()
o2o = True if t == "one-to-one" else False
o2o = t == "one-to-one"

if t in ["one-to-one", "one-to-many"]:
df = create_dictionary(
Expand Down Expand Up @@ -579,32 +579,19 @@ def convert_resource(
f"Errors saved to {resource.__name__.lower()}_errors.csv"
)

if parallel:
total_t = timeit.default_timer()
_ = Parallel(n_jobs=-1)(
delayed(convert_resource)(
resource,
data,
map_file,
types[resource.__name__],
subject_id,
date_format,
timezone,
)
for resource, map_file in mappings.items()
total_t = timeit.default_timer()
_ = Parallel(n_jobs=-1 if parallel else 1)(
delayed(convert_resource)(
resource,
data,
map_file,
types[resource.__name__],
subject_id,
date_format,
timezone,
)
else:
total_t = timeit.default_timer()
for resource, map_file in mappings.items():
convert_resource(
resource,
data,
map_file,
types[resource.__name__],
subject_id,
date_format,
timezone,
)
for resource, map_file in mappings.items()
)

print(f"Total time: {timeit.default_timer() - total_t}")

Expand Down

0 comments on commit e809c1e

Please sign in to comment.