pub struct MedrxivClient { /* private fields */ }Expand description
Client for medRxiv.org preprint API
Provides methods to search for medical and health sciences preprints, filter by specialty, and convert results to SemanticVector format.
§Categories
- Cardiovascular Medicine
- Infectious Diseases
- Oncology
- Public Health
- Epidemiology
- Psychiatry
- and many more…
§Rate Limiting
The client automatically enforces a rate limit of ~1 request per second. Includes retry logic for transient failures.
Implementations§
Source§impl MedrxivClient
impl MedrxivClient
Sourcepub fn with_embedding_dim(embedding_dim: usize) -> Self
pub fn with_embedding_dim(embedding_dim: usize) -> Self
Create a new medRxiv API client with custom embedding dimension
§Arguments
embedding_dim- Dimension for text embeddings (default: 384)
Sourcepub async fn search_recent(
&self,
days: u64,
limit: usize,
) -> Result<Vec<SemanticVector>>
pub async fn search_recent( &self, days: u64, limit: usize, ) -> Result<Vec<SemanticVector>>
Sourcepub async fn search_by_date_range(
&self,
start_date: NaiveDate,
end_date: NaiveDate,
limit: Option<usize>,
) -> Result<Vec<SemanticVector>>
pub async fn search_by_date_range( &self, start_date: NaiveDate, end_date: NaiveDate, limit: Option<usize>, ) -> Result<Vec<SemanticVector>>
Search preprints by date range
§Arguments
start_date- Start date (inclusive)end_date- End date (inclusive)limit- Optional maximum number of results
§Example
ⓘ
use chrono::NaiveDate;
let start = NaiveDate::from_ymd_opt(2024, 1, 1).unwrap();
let end = NaiveDate::from_ymd_opt(2024, 12, 31).unwrap();
let papers = client.search_by_date_range(start, end, Some(200)).await?;Sourcepub async fn search_covid(&self, limit: usize) -> Result<Vec<SemanticVector>>
pub async fn search_covid(&self, limit: usize) -> Result<Vec<SemanticVector>>
Sourcepub async fn search_clinical(&self, limit: usize) -> Result<Vec<SemanticVector>>
pub async fn search_clinical(&self, limit: usize) -> Result<Vec<SemanticVector>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MedrxivClient
impl !RefUnwindSafe for MedrxivClient
impl Send for MedrxivClient
impl Sync for MedrxivClient
impl Unpin for MedrxivClient
impl !UnwindSafe for MedrxivClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more