Skip to content

Commit

Permalink
NiFi scripts: added big ann file gen util.
Browse files Browse the repository at this point in the history
  • Loading branch information
vladd-bit committed Jul 24, 2024
1 parent 0a7b98f commit ffea6e8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nifi/user-scripts/tests/generate_big_ann_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import json

f_path = "../../../data/cogstack-cohort/medical_reports_anns_medcat_medmen__*.json"


def chunk(input_list: list, num_slices: int):
for i in range(0, len(input_list), num_slices):
yield input_list[i:i + num_slices]


contents = None

add_records = 400000

first_annotation = contents[0]

for i in range(add_records):
contents.append(first_annotation)

export_path = "../../../data/medical_reports_anns_medcat_medmen__test_big.json"

with open(export_path, mode="w+") as f:
f.write(json.dumps(contents))

0 comments on commit ffea6e8

Please sign in to comment.