Skip to content

Commit 7dced30

Browse files
authored
Merge pull request #29 from adelavega/enh/meta
ENH: Add meta-analysis command
2 parents 8a91f4d + 2754c82 commit 7dced30

7 files changed

Lines changed: 381 additions & 1 deletion

File tree

autonima.egg-info/PKG-INFO

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Requires-Dist: mypy>=1.0; extra == "dev"
4343
Requires-Dist: pre-commit>=3.0; extra == "dev"
4444
Provides-Extra: llm
4545
Requires-Dist: openai>=1.0; extra == "llm"
46+
Provides-Extra: readability
47+
Requires-Dist: readabilipy>=0.2.0; extra == "readability"
48+
Provides-Extra: meta
49+
Requires-Dist: nimare>=0.1.0; extra == "meta"
4650
Dynamic: author
4751
Dynamic: classifier
4852
Dynamic: description
@@ -90,6 +94,12 @@ Autonima enables end-to-end automation of systematic review steps:
9094
* Produces a final set of included studies for meta-analysis.
9195
* Uses function calling with Pydantic schemas for structured output.
9296

97+
5. **Enhanced HTML Cleaning**
98+
99+
* Uses Mozilla's Readability algorithm via `readabilipy` to extract clean text content from HTML.
100+
* Falls back to basic HTML cleaning when `readabilipy` is not available.
101+
* Install with `pip install -e .[readability]` (requires Node.js).
102+
93103
---
94104

95105
## 📊 Benchmarking
@@ -127,6 +137,11 @@ cd autonima
127137
# install
128138
pip install -e .
129139

140+
# install with enhanced HTML cleaning (requires Node.js)
141+
pip install -e .[readability]
142+
143+
> Note: The enhanced HTML cleaning feature requires Node.js to be installed on your system.
144+
130145
# run an example review pipeline
131146
python examples/run_pipeline.py --config examples/sample_config.yaml
132147
```

autonima.egg-info/SOURCES.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ autonima/__init__.py
44
autonima/__main__.py
55
autonima/cli.py
66
autonima/config.py
7+
autonima/meta.py
78
autonima/pipeline.py
89
autonima/utils.py
910
autonima.egg-info/PKG-INFO
@@ -12,6 +13,14 @@ autonima.egg-info/dependency_links.txt
1213
autonima.egg-info/entry_points.txt
1314
autonima.egg-info/requires.txt
1415
autonima.egg-info/top_level.txt
16+
autonima/coordinates/__init__.py
17+
autonima/coordinates/nimads_models.py
18+
autonima/coordinates/openai_client.py
19+
autonima/coordinates/parser.py
20+
autonima/coordinates/processor.py
21+
autonima/coordinates/schema.py
22+
autonima/llm/__init__.py
23+
autonima/llm/client.py
1524
autonima/models/__init__.py
1625
autonima/models/types.py
1726
autonima/retrieval/__init__.py

autonima.egg-info/requires.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ pre-commit>=3.0
2121

2222
[llm]
2323
openai>=1.0
24+
25+
[meta]
26+
nimare>=0.1.0
27+
28+
[readability]
29+
readabilipy>=0.2.0

autonima/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
# Import LLM module components
3434
from .llm.client import GenericLLMClient
3535

36+
# Import meta-analysis module components
37+
try:
38+
from .meta import run_meta_analyses
39+
HAS_META = True
40+
except ImportError:
41+
HAS_META = False
42+
3643
__all__ = [
3744
"AutonimaPipeline",
3845
"PipelineConfig",
@@ -45,4 +52,7 @@
4552
"parse_tables",
4653
"CoordinateParsingClient",
4754
"GenericLLMClient"
48-
]
55+
]
56+
57+
if HAS_META:
58+
__all__.append("run_meta_analyses")

autonima/cli.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,95 @@ def validate(config: str, output_folder: str, debug: bool):
216216
sys.exit(1)
217217

218218

219+
@click.command()
220+
@click.argument('output_folder', type=click.Path(exists=True))
221+
@click.option('--estimator',
222+
type=click.Choice(['ale', 'mkdadensity', 'kda']),
223+
default='mkdadensity',
224+
help='CBMA estimator to use (default: mkdadensity)')
225+
@click.option('--estimator-args',
226+
type=str,
227+
default='{}',
228+
help='JSON string of arguments for the estimator (default: {})')
229+
@click.option('--corrector',
230+
type=click.Choice(['fdr', 'montecarlo', 'bonferroni']),
231+
default='fdr',
232+
help='Corrector to use (default: fdr)')
233+
@click.option('--corrector-args',
234+
type=str,
235+
default='{}',
236+
help='JSON string of arguments for the corrector (default: {})')
237+
@click.option('--debug', is_flag=True,
238+
help='Enable debug mode with post-mortem debugging on errors')
239+
def meta(output_folder: str, estimator: str, estimator_args: str,
240+
corrector: str, corrector_args: str, debug: bool):
241+
"""
242+
Run meta-analyses on Autonima output using NiMARE.
243+
244+
This command runs coordinate-based meta-analyses on the results
245+
from an Autonima systematic review pipeline.
246+
247+
Arguments:
248+
OUTPUT_FOLDER Output folder containing NiMADS files
249+
250+
Options:
251+
--estimator CBMA estimator to use (ale, mkdadensity, kda)
252+
--estimator-args JSON string of arguments for the estimator
253+
--corrector Corrector to use (fdr, montecarlo, bonferroni)
254+
--corrector-args JSON string of arguments for the corrector
255+
256+
Examples:
257+
autonima meta results/outputs
258+
autonima meta results/outputs --estimator ale --corrector montecarlo
259+
autonima meta results/outputs --estimator-args '{"n_iters": 1000}' --corrector-args '{"alpha": 0.01}'
260+
"""
261+
try:
262+
import json
263+
from pathlib import Path
264+
265+
# Try to import NiMARE dependencies
266+
try:
267+
from .meta import run_meta_analyses
268+
except ImportError as e:
269+
log_error_with_debug(
270+
logger,
271+
"NiMARE is not installed. Please install with: pip install autonima[meta]"
272+
)
273+
if debug:
274+
import pdb
275+
pdb.post_mortem()
276+
sys.exit(1)
277+
278+
# Parse estimator and corrector arguments
279+
try:
280+
estimator_args_dict = json.loads(estimator_args)
281+
corrector_args_dict = json.loads(corrector_args)
282+
except json.JSONDecodeError as e:
283+
log_error_with_debug(logger, f"Error parsing JSON arguments: {e}")
284+
if debug:
285+
import pdb
286+
pdb.post_mortem()
287+
sys.exit(1)
288+
289+
# Run meta-analyses
290+
results = run_meta_analyses(
291+
output_folder,
292+
estimator_name=estimator,
293+
estimator_args=estimator_args_dict,
294+
corrector_name=corrector,
295+
corrector_args=corrector_args_dict
296+
)
297+
298+
print(f"Completed meta-analyses for {len(results)} columns")
299+
300+
except Exception as e:
301+
log_error_with_debug(logger, f"Meta-analysis execution failed: {e}")
302+
if debug:
303+
import pdb
304+
pdb.post_mortem()
305+
sys.exit(1)
306+
307+
219308
@click.command()
220309
def create_sample_config():
221310
"""
@@ -261,6 +350,7 @@ def cli():
261350
cli.add_command(run)
262351
cli.add_command(validate)
263352
cli.add_command(create_sample_config)
353+
cli.add_command(meta)
264354

265355

266356
def main():

0 commit comments

Comments
 (0)