Spaces:
Running
Running
File size: 457 Bytes
4709571 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import json
from tqdm import tqdm
import typer
def preprocess(data_path, processed_data_path):
with open(data_path) as f:
data = json.loads(f.read())
with open(processed_data_path, "w") as f:
for grant in tqdm(data["grants"]):
if any([org["name"] == "The Wellcome Trust" for org in grant["fundingOrganization"]]):
f.write(json.dumps(grant) + "\n")
if __name__ == "__main__":
typer.run(preprocess)
|