# Biomedical Full Text to RAG Chunks: Europe PMC (`amygraphics/biomedical-full-text-rag`) Actor

Search PubMed and Europe PMC by query, DOI, PMID or URL. Extract licensed full text to Markdown and tokenized RAG chunks, with tables, citations, annotations and optional metadata fallback.

- **URL**: https://apify.com/amygraphics/biomedical-full-text-rag.md
- **Developed by:** [Zakaria el bouami](https://apify.com/amygraphics) (community)
- **Categories:** Developer tools, Education, MCP servers
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.53 / 1,000 delivered article records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Biomedical Full Text & RAG — Europe PMC

Search Europe PMC biomedical literature or resolve PMID, PMCID and DOI identifiers or URLs. Export eligible full text as section-aware chunks and Markdown with citation, attribution and licence details. Choose character chunks or **cl100k_base** token chunks (default 512 tokens / 50 overlap in token mode). No API key.

### Coverage and pricing

**Per delivered article record**, full text or metadata-only: Free $0.00071; Bronze $0.00065; Silver $0.00059; Gold, Platinum and Diamond $0.00053, plus **$0.00005 per start per GB of memory** (at least once). All chunks and selected extras for the record are included. Errors, skipped records and the summary row have no article event. Use Apify's maximum run charge to cap events. Platform usage may be billed separately depending on pricing settings and plan.

- `contentMode: "fulltext"` (default, backward compatible) returns only eligible articles with extractable body XML and article-level CC BY, CC BY-SA or CC0 links.
- `contentMode: "auto"` attempts eligible full text and falls back to **metadata only**, including source links and rights/status fields, when full text is unavailable or its licence is unsupported. Metadata-only rows are billed as article records too. When a source fetch fails, the row reports `source_error`.
- `contentMode: "metadata"` returns metadata only without fetching full text.
- Abstracts from the licensed JATS article are included if available for full-text records. **Abstracts for metadata-only rows are not redistributed**, including for CC BY-NC, CC BY-ND and unknown licences; follow the source link and assess rights independently. Access does not itself grant redistribution rights. Metadata fallback is not a full text or abstract fallback.

### Input examples

```json
{"query":"CRISPR cancer","contentMode":"auto","fromDate":"2023-01-01","sort":"newest","maxResults":5,"maxCandidates":30,"chunkMode":"tokens","tokensPerChunk":512,"tokenOverlap":50,"includeTables":true,"includeFigures":true,"includeReferences":true,"includeCitations":true,"includeAnnotations":true}
```

```json
{"identifiers":["https://pmc.ncbi.nlm.nih.gov/articles/PMC10767826/","https://pubmed.ncbi.nlm.nih.gov/37994696/","https://doi.org/10.1093/nar/gkad1085"],"contentMode":"auto","maxResults":3,"maxCandidates":10}
```

Identifiers and query can be combined; identifiers resolve first and are deduplicated within the run. Date and sort filters apply to query search, **not identifier lookups**. Query accepts Europe PMC search syntax. A candidate scan limit of at most 200 and delivery limit of at most 50 bound results; the summary row reports errors, skips and truncation. Use a new run for more results: there is no resume cursor export.

### Output

Full-text rows have `contentKind: "full_text"`, sectioned `markdown`, `markdownWithFrontMatter`, SHA-256 hash, license, source, metadata, abstract when present, and `chunks[]`. In character mode chunks have normalized character section offsets. Token mode uses `cl100k_base`, with token count and offsets **within the original section**; overlap can shrink at Unicode boundaries, and different sections are not overlapped. Markdown is best-effort from JATS, not a PDF conversion; image and supplementary files are not included.

Optional table cells (up to 50 tables), figure captions (up to 50; not image files), references (up to 500), citing papers (first 20 indexed), and text-mined biomedical entities (first response, up to 100 terms). Automated annotations can be wrong or incomplete. MathML, inline formatting, nested markup, tables and reference parsing may be incomplete; TeX formulas are kept where supplied. Author ORCIDs and affiliations, MeSH, chemicals, grants, citation counts and other metadata are present only when provided by the source.

The Europe PMC publication type `Retracted Publication` is skipped by default. A missing retraction flag does **not** prove an article is not retracted; independently verify. Preprints are flagged when identified and may not be peer-reviewed. No medical advice.

### Scheduled change tracking

Set `onlyNew: true` and a `watchName` to remember delivered IDs in a named key-value store, and set an Apify schedule yourself. The first run delivers current matches; later runs suppress remembered records. Source errors are not remembered so they can be retried later. Changing the query, identifiers, content mode, dates or sort creates a separate watch. Seen data persists until the named store is deleted; **do not run the same watch concurrently**. Bounded scanning, ranking changes, result limits, deduplication and failure between delivery and state save can cause missed or duplicate results; this is not an exhaustive alerting service. Any future correction to a previously delivered paper is not automatically delivered.

### Rights and attribution

[Europe PMC](https://europepmc.org/RestfulWebService) and its [Annotations API](https://europepmc.org/AnnotationsApi) are the sources. Full-text XML must contain a supported machine-readable licence; article-level CC BY requires attribution and changes to be indicated, and CC BY-SA may require sharing adaptations under the same licence. Tables, figures and other third-party material can have separate rights, even when the article is CC licensed. Check each article and its rights before reuse. Respect the [Europe PMC copyright notice](https://europepmc.org/Copyright) and [EMBL-EBI terms](https://www.ebi.ac.uk/about/terms-of-use). Source availability and indexing can change. This is not legal advice.

# Actor input Schema

## `query` (type: `string`):

Europe PMC keywords or field syntax. Content mode determines whether metadata-only records can be returned.

## `pmcids` (type: `array`):

Optional PMC IDs, for example PMC10767826. Can be combined with query.

## `maxResults` (type: `integer`):

Maximum delivered article rows.

## `maxCandidates` (type: `integer`):

Some sources lack supported licenses or full text. At least maxResults; maximum 200.

## `chunkSize` (type: `integer`):

Target maximum characters per chunk; sections are kept separate.

## `chunkOverlap` (type: `integer`):

Number of characters repeated between adjacent chunks.

## `identifiers` (type: `array`):

PMIDs, PMCIDs, DOIs, or PubMed, PMC and doi.org URLs. Exact match; can be combined with query.

## `includeAnnotations` (type: `boolean`):

Optional text-mined entities from Europe PMC: genes, diseases and other annotated terms; first response only and may be incomplete.

## `includeTables` (type: `boolean`):

Optional table rows and captions from JATS XML. Merged cells are flagged. Third-party rights may apply.

## `includeReferences` (type: `boolean`):

Optional bibliographic titles, DOI and PMID references, up to 500.

## `includeRetracted` (type: `boolean`):

Normally skip records Europe PMC labels Retracted Publication. A missing flag does not prove reliability.

## `includeCitations` (type: `boolean`):

Fetch up to 20 papers that Europe PMC indexes as citing this paper, with total and truncation. Source coverage is not complete.

## `includeFigures` (type: `boolean`):

Extract up to 50 captions and labels, not image files. Figure content may have separate third-party rights.

## `contentMode` (type: `string`):

Full text only (default), auto with metadata fallback, or metadata only. Restricted or unknown-licence abstracts and full texts are not redistributed.

## `fromDate` (type: `string`):

Optional inclusive YYYY-MM-DD for search query results; identifier lookups are not date-filtered.

## `toDate` (type: `string`):

Optional inclusive YYYY-MM-DD for search query results; identifier lookups are not date-filtered.

## `sort` (type: `string`):

Sort query results by relevance, newest, or indexed citations; identifier lookups are resolved first.

## `chunkMode` (type: `string`):

Characters (existing behavior) or cl100k_base tokens. Token chunks are section-aware.

## `tokensPerChunk` (type: `integer`):

Used in token mode. UTF-8 boundaries may make a chunk shorter.

## `tokenOverlap` (type: `integer`):

Used in token mode. Must be less than half the token size; multibyte characters can reduce overlap slightly.

## `onlyNew` (type: `boolean`):

Use a named watch to skip previously delivered articles. First run delivers current results; schedule the Actor yourself. Not safe for concurrent runs of the same watch.

## `watchName` (type: `string`):

Required with onlyNew; letters, numbers, dash or underscore, up to 64 characters. Changing query, IDs, mode, date or sort creates a different watch.

## Actor input object example

```json
{
  "query": "CRISPR cancer",
  "maxResults": 5,
  "maxCandidates": 30,
  "chunkSize": 1800,
  "chunkOverlap": 150,
  "includeAnnotations": false,
  "includeTables": false,
  "includeReferences": false,
  "includeRetracted": false,
  "includeCitations": false,
  "includeFigures": false,
  "contentMode": "fulltext",
  "sort": "relevance",
  "chunkMode": "characters",
  "tokensPerChunk": 512,
  "tokenOverlap": 50,
  "onlyNew": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "CRISPR cancer"
};

// Run the Actor and wait for it to finish
const run = await client.actor("amygraphics/biomedical-full-text-rag").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "query": "CRISPR cancer" }

# Run the Actor and wait for it to finish
run = client.actor("amygraphics/biomedical-full-text-rag").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "CRISPR cancer"
}' |
apify call amygraphics/biomedical-full-text-rag --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,amygraphics/biomedical-full-text-rag"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/UxBtKZ06djNHO1r2B/builds/upxJ7hmSzsCDTkpED/openapi.json
