|
34 | 34 |
|
35 | 35 | Would you like to convert the inverted abstract to plaintext?""" |
36 | 36 |
|
| 37 | +MIN_INCLUSIONS = 5 |
| 38 | + |
37 | 39 |
|
38 | 40 | def main(): |
39 | 41 | if os.getenv("SYNERGY_PATH") == "development": |
@@ -73,7 +75,7 @@ def info(): |
73 | 75 | parser.print_usage() |
74 | 76 |
|
75 | 77 |
|
76 | | -def _count_filtered_records(dataset): |
| 78 | +def _count_records(dataset): |
77 | 79 | n_records, n_included = 0, 0 |
78 | 80 | for _, label in dataset.iter(validate=False): |
79 | 81 | n_records += 1 |
@@ -108,7 +110,7 @@ def _write_review_metadata(datasets, counts, active_vars, output_path): |
108 | 110 | for dataset in datasets: |
109 | 111 | n_records, n_included = counts[dataset.name] |
110 | 112 |
|
111 | | - if n_included < 3: |
| 113 | + if n_included < MIN_INCLUSIONS: |
112 | 114 | continue |
113 | 115 |
|
114 | 116 | pub_work = WorkModel.model_validate(dataset.metadata["publication"]) |
@@ -207,19 +209,19 @@ def build_dataset(argv): |
207 | 209 | if args.dataset is not None: |
208 | 210 | datasets = [Dataset(name) for name in args.dataset] |
209 | 211 | for dataset in datasets: |
210 | | - n_records, n_included = _count_filtered_records(dataset) |
| 212 | + n_records, n_included = _count_records(dataset) |
211 | 213 | counts[dataset.name] = (n_records, n_included) |
212 | | - if n_included < 3: |
| 214 | + if n_included < MIN_INCLUSIONS: |
213 | 215 | continue |
214 | 216 | dataset.to_frame(args.vars).to_csv( |
215 | 217 | Path(args.output, f"{dataset.name}.csv"), index=False |
216 | 218 | ) |
217 | 219 | else: |
218 | 220 | datasets = list(iter_datasets()) |
219 | 221 | for dataset in tqdm(datasets): |
220 | | - n_records, n_included = _count_filtered_records(dataset) |
| 222 | + n_records, n_included = _count_records(dataset) |
221 | 223 | counts[dataset.name] = (n_records, n_included) |
222 | | - if n_included < 3: |
| 224 | + if n_included < MIN_INCLUSIONS: |
223 | 225 | continue |
224 | 226 | dataset.to_frame(args.vars).to_csv( |
225 | 227 | Path(args.output, f"{dataset.name}.csv"), index=False |
|
0 commit comments