Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/ChaokunHong/MetaScreener
/ functions
Functions
1,057 in github.com/ChaokunHong/MetaScreener
⨍
Functions
1,057
◇
Types & classes
214
↓ 88 callers
Function
_make_metric
Create a metric dict with point, ci_lower, ci_upper.
tests/unit/test_generate_tables.py:28
↓ 40 callers
Method
run
Run the full criteria wizard pipeline. Args: input_mode: How the user provides input (text, topic, yaml, examples). w
src/metascreener/criteria/wizard.py:75
↓ 39 callers
Function
_make_output
( decision: Decision = Decision.INCLUDE, score: float = 0.9, confidence: float = 0.9, model_id
tests/unit/test_layer2_rules.py:29
↓ 30 callers
Method
check
Check whether this rule is violated. Args: record: The literature record being screened. criteria: The review criteri
src/metascreener/module1_screening/layer2/rules/base.py:28
↓ 28 callers
Function
_make_output
Create a ModelOutput with given score, confidence, and decision.
tests/unit/test_layer3_aggregator.py:13
↓ 22 callers
Function
read_records
Read literature records from a file, auto-detecting format by extension. Args: path: Path to the input file. Returns: List o
src/metascreener/io/readers.py:21
↓ 21 callers
Function
_make_output
Create a ModelOutput helper.
tests/unit/test_layer4_router.py:14
↓ 17 callers
Function
normalize_record
Normalise a raw record dict from any format into a Record. Args: raw: Raw key-value pairs from a format-specific parser. format_t
src/metascreener/io/parsers.py:65
↓ 16 callers
Function
compute_screening_metrics
Compute screening performance metrics from decisions vs ground truth. INCLUDE is treated as the positive class and EXCLUDE as negative. HUMAN
src/metascreener/evaluation/metrics.py:30
↓ 16 callers
Function
load_extraction_form
Load and validate an extraction form from a YAML file. Args: path: Path to the YAML extraction form. Returns: Validated Extr
src/metascreener/module2_extraction/form_schema.py:64
↓ 15 callers
Method
load
Load ReviewCriteria from YAML, auto-detecting legacy format. If the file contains the legacy ``PICOCriteria`` format (identified by t
src/metascreener/criteria/schema.py:40
↓ 14 callers
Function
_make_detector_adapter
Create a mock adapter that returns framework detection results.
tests/unit/test_criteria_wizard.py:40
↓ 14 callers
Function
write_records
Write Record list to file. Auto-detect format from extension if not given. Args: records: List of Record objects to write. path:
src/metascreener/io/writers.py:32
↓ 13 callers
Function
_make_mock_adapter
Create a mock adapter with a given extraction response.
tests/unit/test_extractor.py:14
↓ 13 callers
Method
evaluate_screening
Compute all screening metrics with bootstrap CIs. Args: decisions: List of ScreeningDecision objects. gold_labels: Go
src/metascreener/evaluation/calibrator.py:47
↓ 13 callers
Method
get_overall_judgement
Compute overall RoB judgement from per-domain judgements. Applies the Cochrane RoB 2 worst-case rule: - Any HIGH in any domain yields
src/metascreener/module3_quality/tools/rob2.py:310
↓ 13 callers
Method
route
Route to a final decision and tier. Args: model_outputs: LLM outputs from Layer 1. rule_result: Rule check result fro
src/metascreener/module1_screening/layer4/router.py:44
↓ 13 callers
Method
save
Save a wizard session to disk. Args: session: The session to persist. Returns: Path to the saved session fil
src/metascreener/criteria/session.py:36
↓ 13 callers
Function
validate_extraction
Validate extracted fields against the form schema. Checks: 1. Required fields are present. 2. Field values match declared types. 3. N
src/metascreener/module2_extraction/validator.py:30
↓ 12 callers
Function
_make_form
Create a minimal ExtractionForm.
tests/unit/test_extraction_validator.py:15
↓ 12 callers
Method
aggregate
Aggregate model outputs into a final score and confidence. Applies the CCA formula and computes ensemble confidence from Shannon entr
src/metascreener/module1_screening/layer3/aggregator.py:55
↓ 12 callers
Method
build_criteria_section
Render PCC-specific criteria section. Args: criteria: Review criteria with PCC elements. Returns: Formatted
src/metascreener/module1_screening/layer1/prompts/ta_pcc_v1.py:12
↓ 12 callers
Method
extract
Extract structured data from text using all backends. Args: text: Full text of the paper (from PDF). form: Extraction
src/metascreener/module2_extraction/extractor.py:58
↓ 12 callers
Method
screen_single
Screen a single record through the full HCN pipeline. Args: record: The literature record to screen. criteria: Review
src/metascreener/module1_screening/ta_screener.py:60
↓ 11 callers
Method
_apply_user_feedback
Parse and apply user feedback to a criteria element. Supports simple add/remove commands: - ``+term`` or ``add: term`` → appends to i
src/metascreener/criteria/wizard.py:317
↓ 11 callers
Function
_make_mock_adapter
Create a mock adapter with a criteria generation response.
tests/unit/test_criteria_wizard.py:14
↓ 11 callers
Method
merge
Merge multiple model outputs into a single ReviewCriteria. Args: model_outputs: List of parsed JSON dicts from each model.
src/metascreener/criteria/consensus.py:24
↓ 10 callers
Function
_make_criteria
Helper to create ReviewCriteria with defaults.
tests/unit/test_criteria_validator.py:12
↓ 10 callers
Function
_make_metric
Create a metric dict with point, ci_lower, ci_upper.
tests/unit/test_generate_figures.py:22
↓ 10 callers
Function
build_rob_prompt
Build a RoB assessment prompt from tool schema and paper text. Generates prompts dynamically based on the tool schema, so the same function w
src/metascreener/module3_quality/prompts/rob_v1.py:22
↓ 10 callers
Function
strip_code_fences
Remove markdown code fences from LLM response text. Handles both complete (````...````) and unclosed fences, as well as fences with language
src/metascreener/llm/base.py:111
↓ 9 callers
Function
_clean_rules
RuleCheckResult with no violations.
tests/unit/test_layer4_router.py:33
↓ 9 callers
Function
_make_model_output
Helper to create a ModelOutput.
tests/unit/test_evaluation_calibrator.py:15
↓ 9 callers
Function
_make_output
Create a ModelOutput helper.
tests/unit/test_layer4_threshold.py:14
↓ 9 callers
Method
assess
Assess risk of bias using a specified tool. Args: text: Full text of the paper. tool_name: Tool identifier ('rob2', '
src/metascreener/module3_quality/assessor.py:57
↓ 9 callers
Method
fit
Fit the Platt calibrator on validation scores. Args: scores: Raw model scores in [0, 1]. labels: Binary labels (0 = i
src/metascreener/module1_screening/layer3/calibration.py:34
↓ 9 callers
Method
get_severity_rank
Return numeric severity rank for ROBINS-I judgements. ROBINS-I uses a 4-level severity scale: LOW (0), MODERATE (1), SERIOUS (2), CRI
src/metascreener/module3_quality/tools/robins_i.py:384
↓ 8 callers
Function
_make_decisions
Helper to create ScreeningDecision objects.
tests/unit/test_evaluation_calibrator.py:30
↓ 8 callers
Function
chunk_text
Split text into overlapping chunks sized for LLM context windows. Splits on paragraph boundaries (double newline). Falls back to character-le
src/metascreener/module2_extraction/pdf_chunker.py:24
↓ 8 callers
Method
complete
Send a prompt and return the raw text response. Public wrapper around ``_call_api`` for general-purpose LLM calls (e.g., criteria gen
src/metascreener/llm/base.py:199
↓ 8 callers
Function
hash_prompt
Compute SHA256 hash of a prompt for audit trail. Args: prompt: The prompt string to hash. Returns: 64-character hex string (
src/metascreener/llm/base.py:99
↓ 8 callers
Function
load_gold_labels
Load gold-standard labels from a CSV file. Expects columns: ``record_id`` (or any column containing "id") and one of ``label``, ``included``,
validation/common.py:34
↓ 8 callers
Function
load_model_config
Load model configuration from a YAML file. Args: path: Path to the YAML configuration file. Returns: MetaScreenerConfig with
src/metascreener/config.py:81
↓ 7 callers
Function
_base_layout
Merge base layout with caller-supplied overrides.
src/metascreener/evaluation/visualizer.py:71
↓ 7 callers
Function
_make_detector_adapter
Create a mock framework detector adapter.
tests/integration/test_criteria_workflow.py:85
↓ 7 callers
Function
_make_gen_adapter
Create a mock generation adapter.
tests/integration/test_criteria_workflow.py:17
↓ 7 callers
Method
calibrate
Calibrate a single score. Args: score: Raw model score in [0, 1]. Returns: Calibrated probability in [0, 1].
src/metascreener/module1_screening/layer3/calibration.py:57
↓ 7 callers
Function
compute_metrics_with_ci
Compute screening metrics with bootstrap 95% confidence intervals. Converts binary predictions (0/1) to Decision enums, computes screening me
validation/common.py:233
↓ 7 callers
Function
create_ablation_chart
Create a grouped bar chart for the ablation study. Reads exp4_ablation_study.json and plots sensitivity and specificity as grouped bars for e
validation/analysis/generate_figures.py:213
↓ 7 callers
Function
create_forest_plot
Create a forest plot of sensitivity across benchmark datasets. Reads exp2_cohen_benchmark.json, extracts per-topic sensitivity point estimate
validation/analysis/generate_figures.py:85
↓ 7 callers
Method
detect
Detect the appropriate framework for the given input. When ``override_framework`` is provided the LLM call is skipped entirely and th
src/metascreener/criteria/framework_detector.py:50
↓ 7 callers
Method
detect_language
Detect the primary language of text using Unicode heuristics. Uses character-class ratios to distinguish CJK-family languages from La
src/metascreener/criteria/preprocessor.py:111
↓ 7 callers
Method
from_pico_criteria
Migrate a legacy ``PICOCriteria`` to the new ``ReviewCriteria`` format. Maps PICO-specific fields into the generic ``elements`` dictionary
src/metascreener/core/models.py:434
↓ 7 callers
Function
get_tool_schema
Get a tool schema instance by name. Args: tool_name: One of 'rob2', 'robins_i', 'quadas2'. Returns: Instantiated tool schema
src/metascreener/module3_quality/tools/__init__.py:23
↓ 7 callers
Method
load
Load a session by ID. Args: session_id: The session identifier. Returns: The session if found, None otherwis
src/metascreener/criteria/session.py:55
↓ 7 callers
Function
save_results
Save experiment results as JSON with metadata. The output file includes a ``_metadata`` key with timestamp, seed, version, and experiment nam
validation/common.py:103
↓ 6 callers
Function
build_detect_framework_prompt
Build prompt to detect which SR framework fits the user's input. Args: user_input: User-provided text (topic description or criteria text
src/metascreener/criteria/prompts/detect_framework_v1.py:11
↓ 6 callers
Function
build_parse_text_prompt
Build prompt to parse free-text criteria into structured elements. Args: criteria_text: User-provided criteria description. frame
src/metascreener/criteria/prompts/parse_text_v1.py:11
↓ 6 callers
Method
call_with_prompt
Call LLM with a pre-built prompt and parse the response. Handles both ``element_assessment`` and ``pico_assessment`` keys in the LLM
src/metascreener/llm/base.py:214
↓ 6 callers
Method
clean_text
Remove noise from raw text input. Processing steps: 1. Remove form feed characters. 2. Remove control characters (kee
src/metascreener/criteria/preprocessor.py:36
↓ 6 callers
Function
format_lancet
Format a metric with CI in Lancet Digital Health style. Uses middle dot (U+00B7) instead of decimal period and en dash (U+2013) for CI ranges
src/metascreener/evaluation/metrics.py:281
↓ 6 callers
Function
plot_roc_curve
Plot a Receiver Operating Characteristic curve. Args: auroc_result: AUROC computation result with FPR/TPR data points. Returns:
src/metascreener/evaluation/visualizer.py:83
↓ 6 callers
Function
plot_score_distribution
Plot overlapping histograms of inclusion scores by true label. Args: scores: Predicted inclusion scores for each record. labels:
src/metascreener/evaluation/visualizer.py:213
↓ 6 callers
Function
run_ablation
Run the full ablation study across all 6 configurations. Loads the dataset, creates backends, runs each configuration (single-model, ensemble
validation/experiments/exp4_ablation_study.py:183
↓ 6 callers
Function
run_cost_analysis
Run cost and time analysis on a dataset. Screens each record individually, measuring wall-clock time and estimating token usage and API cost
validation/experiments/exp7_cost_time.py:160
↓ 6 callers
Method
save
Save ReviewCriteria to a YAML file. Args: criteria: The criteria to serialize. path: Target file path.
src/metascreener/criteria/schema.py:24
↓ 6 callers
Function
setup_mock_backends
Create 4 mock LLM backends with distinct model IDs. Each backend returns INCLUDE with confidence 0.85 and score 0.80. Model IDs: mock-qwen3,
validation/common.py:152
↓ 6 callers
Method
validate_rules
Run rule-based validation checks (Layer 1, no LLM cost). Checks for: - Date range contradictions (date_from > date_to). - Inc
src/metascreener/criteria/validator.py:54
↓ 5 callers
Function
_make_output
( decision: Decision = Decision.INCLUDE, pico_assessment: dict[str, PICOAssessment] | None = None, )
tests/unit/test_layer2_engine.py:15
↓ 5 callers
Function
_str_or_none
Convert value to str or None. Args: value: Any value. Returns: String or None if empty.
src/metascreener/io/parsers.py:215
↓ 5 callers
Method
assess_auto
Assess risk of bias with auto-selected tool based on study type. Args: text: Full text of the paper. study_type: Stud
src/metascreener/module3_quality/assessor.py:78
↓ 5 callers
Function
bootstrap_ci
Compute bootstrap confidence interval for a metric function. Args: metric_fn: Function that takes a tuple of parallel arrays and
src/metascreener/evaluation/metrics.py:225
↓ 5 callers
Function
build_generate_from_topic_prompt
Build prompt to generate review criteria from a topic description. Args: topic: Research topic or question. framework: Framework
src/metascreener/criteria/prompts/generate_from_topic_v1.py:11
↓ 5 callers
Method
build_prompt
Build a framework-specific screening prompt. Args: record: The literature record to screen. criteria: Review criteria
src/metascreener/module1_screening/layer1/prompts/__init__.py:32
↓ 5 callers
Function
build_screening_prompt
Build the standardized screening prompt for a record. Args: record: The literature record to screen. criteria: The PICO inclusion
src/metascreener/llm/base.py:21
↓ 5 callers
Function
build_validate_quality_prompt
Build prompt to assess quality of review criteria. Args: criteria_json: JSON string of the ReviewCriteria to assess. Returns:
src/metascreener/criteria/prompts/validate_quality_v1.py:11
↓ 5 callers
Method
check
Run all rules and produce a RuleCheckResult. Automatically converts ``PICOCriteria`` to ``ReviewCriteria`` for backward compatibility
src/metascreener/module1_screening/layer2/rule_engine.py:37
↓ 5 callers
Method
generate
Generate an extraction form from a research topic. Args: topic: Research topic description. seed: Reproducibility see
src/metascreener/module2_extraction/form_wizard.py:78
↓ 5 callers
Function
generate_table2_cohen
Generate Table 2: Cohen 2006 Benchmark Results. Args: results_dir: Path to the directory containing experiment results. Returns:
validation/analysis/generate_tables.py:186
↓ 5 callers
Function
get_tool_for_study_type
Auto-select the appropriate RoB tool based on study type. Args: study_type: The study design classification. Returns: Instan
src/metascreener/module3_quality/tools/__init__.py:44
↓ 5 callers
Method
infer
Run all backends with a framework-specific prompt. Args: record: The literature record to screen. criteria: Review cr
src/metascreener/module1_screening/layer1/inference.py:35
↓ 5 callers
Method
load_latest
Load the most recently modified session. Returns: The latest session if any exist, None otherwise.
src/metascreener/criteria/session.py:70
↓ 5 callers
Method
optimize
Optimize thresholds via grid search. Each validation_data entry is a tuple of (model_outputs, final_score, ensemble_confidence) for o
src/metascreener/module1_screening/layer4/threshold_optimizer.py:55
↓ 5 callers
Function
parse_llm_response
Parse and validate JSON response from an LLM. Args: raw_response: Raw string response from the LLM API. model_id: Model identifie
src/metascreener/llm/base.py:139
↓ 5 callers
Function
plot_calibration_curve
Plot a calibration reliability diagram. Args: cal_metrics: Calibration metrics containing per-bin data and ECE. Returns: A P
src/metascreener/evaluation/visualizer.py:148
↓ 5 callers
Function
render_element
Render a single criteria element as prompt lines. Args: label: The display label for the element (e.g., "POPULATION"). element: T
src/metascreener/module1_screening/layer1/prompts/ta_common.py:92
↓ 5 callers
Function
run_single_topic
Run the HCN screening pipeline on a single Cohen topic. Loads the topic CSV, screens all records via TAScreener, converts decisions to binary
validation/experiments/exp2_cohen_benchmark.py:108
↓ 5 callers
Method
screen_batch
Screen a batch of records sequentially. Args: records: Records to screen. criteria: Review criteria (shared across al
src/metascreener/module1_screening/ta_screener.py:116
↓ 4 callers
Method
_call_api
( self, prompt: str, seed: int, )
tests/unit/test_llm_base.py:14
↓ 4 callers
Function
_load_results
Load experiment results JSON from the results directory. Args: results_dir: Path to the directory containing result JSON files. e
validation/analysis/generate_tables.py:60
↓ 4 callers
Function
build_infer_from_examples_prompt
Build prompt to infer review criteria from labeled example papers. Args: examples: List of dicts with 'title', 'abstract', and 'label' ke
src/metascreener/criteria/prompts/infer_from_examples_v1.py:11
↓ 4 callers
Function
build_refine_element_prompt
Build prompt to refine a criteria element based on user feedback. Args: element_name: Name of the element being refined. current_
src/metascreener/criteria/prompts/refine_element_v1.py:11
↓ 4 callers
Method
calibrate
Calibrate a single score. Args: score: Raw model score in [0, 1]. Returns: Calibrated probability in [0, 1].
src/metascreener/module1_screening/layer3/calibration.py:143
↓ 4 callers
Method
cleanup
Remove sessions older than max_age_days. Args: max_age_days: Maximum age in days before cleanup. Returns: Nu
src/metascreener/criteria/session.py:99
↓ 4 callers
Method
close
Close the underlying HTTP client.
src/metascreener/llm/adapters/openrouter.py:142
↓ 4 callers
Function
compute_auroc
Compute Area Under the ROC Curve with curve data points. Args: scores: Predicted probability scores (higher = more likely positive).
src/metascreener/evaluation/metrics.py:111
↓ 4 callers
Function
compute_calibration_metrics
Compute calibration quality metrics with per-bin data. Args: scores: Predicted probability scores in [0, 1]. labels: Binary groun
src/metascreener/evaluation/metrics.py:142
↓ 4 callers
Function
extract_text_from_pdf
Extract full text from a PDF file using PyMuPDF. Args: path: Path to the PDF file. Returns: Extracted text content. Empty st
src/metascreener/io/pdf_parser.py:13
↓ 4 callers
Method
generate_from_topic
Generate criteria from a research topic (Mode B). Args: topic: Research topic description. framework: SR framework to
src/metascreener/criteria/generator.py:54
↓ 4 callers
Method
get_weights
Return weights for given model IDs. If fitted, returns learned weights. If unfitted, returns equal weights that sum to 1. Ar
src/metascreener/module1_screening/layer3/weight_optimizer.py:34
next →
1–100 of 1,057, ranked by callers