File size: 547 Bytes
4709571
 
 
 
 
b493a01
4709571
 
 
 
 
 
b493a01
 
 
 
 
 
4709571
 
b493a01
4709571
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)