dataesr/scientific-paragraphs-categorization huggingface dataset:
This proficiency allows transformers to effectively address NLP ambiguity by recognizing context-based representations. Pre-training on clinical documents enables BCB-CRF to capture relevant clinical knowledge and context. Fine-tuning with n2c2 and the annotated UKB prescription dataset further enhances performance by refining its representations and parameters to align with the specific task requirements. This combined approach optimally uses both pre-trained models and task-specific annotations for better clinical NLP tasks. Finally, the regular structure of prescription entries in the UKB prescription dataset greatly favours the use of transfer learning that can substantially reduce the heavy workload of the annotation tasks. PRESNER has demonstrated its effectiveness in extracting structured information from prescription entries, including drug names, strength, dosage, pharmaceutical form, and route of administration.
The pipeline also enables classification tasks such as mapping drug names to the ATC classification system and classifying prescription entries as systemic or non-systemic based on extracted route and form information. Additionally, the extracted strength and dosage data can, for example, be utilised to infer the total prescribed dose for quantitative analysis. Moving forward, our future work aims to incorporate additional functionalities, such as identifying co-medications or cleaning and imputing missing strength or dosages. It is important to acknowledge certain limitations. Some drugs may have not been recognised by the NER pipeline or mapped by the ChEMBL dictionary. After initial manual revision, 65 drug entities with a frequency greater than 100 in the current dataset but not included in the ChEMBL dictionary (e.
g. , 'co-codamol', 'valproate', or 'malarone') were added manually. Even so, drugs like insulins, hormone replacement therapies, contraceptives, and brand names for comedications may not have been consistently identified. Future enhancements could focus on improving the dictionaries or incorporating pattern-based rules to enhance the recall of the PRESNER pipeline. Although the pipeline discerns between systemic and non-systemic ATC codes, some molecules have more than one ATC code and it currently does not identify a singular ATC code for each drug product. Finally, manual validation of the extracted results for all drug products has not been done and, therefore, manual review by the users is encouraged. Looking ahead, as the UK Biobank secures access to primary care data for the remaining 35% of the cohort, we anticipate that PRESNER will prove to be a valuable resource for processing these new and extensive datasets.
Here we analysed pan-European patterns and drivers of multidecadal trends in abundance and taxonomic and functional diversity of invertebrate communities using a comprehensive dataset of 1,816 time series collected in riverine systems in 22 European countries between 1968 and 2020 (Fig. 1 ). The dataset comprises 714,698 observations of 2,648 taxa in 26,668 samples. The time series span a mean of 19. 2 years with an average of 14. 9 sampling years (minimum 8 years, maximum 32 years). We address two research questions: (1) how abundance, taxonomic diversity and functional diversity of freshwater invertebrate communities have changed over the past five decades in European streams and rivers; and (2) what environmental factors have driven these changes. Given that Europe-wide management has resulted in improvements in water quality 2,20 , we hypothesize that abundance, taxonomic diversity and functional diversity have increased, consistent with a recovery.
Reviving the recovery Using a comprehensive Europe-wide dataset, we document the recovery of freshwater invertebrate communities over the past 53 years. The taxon richness gains observed across 70% (1,269 out of 1,816) of time series are concurrent with widespread implementation of mitigation measures  8  , particularly improvements in wastewater treatment motivated by the EU Urban Waste Water Directive from 1991. However, gains in taxon richness started to decelerate around 2010, which may indicate that progress towards recovery has come to a halt at many sites, while remaining sites may reflect either predominant recovery or ongoing degradation towards the end of the study period. Most of our sites are monitored under the EU Water Framework Directive (WFD) and 60% of WFD-monitored rivers still do not reach 'good ecological status'  37.
Online content Any methods, additional references, Nature Portfolio reporting summaries, source data, extended data, supplementary information, acknowledgements, peer review information; details of author contributions and competing interests; and statements of data and code availability are available at https://doi. org/10. 1038/s41586-023-06400-1. )) of annual maximum monthly mean temperatures, mean (ppt mean) and trend (ppt sl. ) of the annual cumulative precipitation, the dam impact score (dam) and the percentage of the upstream catchment covered by urban areas and cropland on site-level long-term trend estimates for taxon richness (a), abundance (b), evenness (c) and turnover (d), and functional richness (e), redundancy (f), evenness (g) and turnover (h). n = 1,816 biologically independent sites for all metrics.
Time series We assembled a database of time series of riverine invertebrate communities following a data call targeting European ecologists and environmental managers. We included only time series that (1) included abundance estimates; (2) documented whole freshwater invertebrate communities (including all sampled macroinvertebrates, for example, Coleoptera, Crustacea, Diptera, Ephemeroptera, Hirudinea, Mollusca, Odonata, Oligochaeta, Plecoptera, Trichoptera, Tricladida); (3) identified most taxa to family, genus or species; (4) had ≥8 sampling years (not necessarily consecutive); (5) used the same sampling method and taxonomic resolution throughout the sampling period; and (6) had consistent sampling effort per site (for example, the number of samples or area sampled) in all years. Only one sampling event per year was included for each time series, where a sampling event was defined as the sample or samples collected within a single day.
For time series with multiple sampling seasons within or among years, we included only one sampling season (defined as three consecutive months), preferentially using the season with the longest time series. No time series had multiple sampling events per season. Sensitivity analyses indicated limited effects of season on trend estimates (Extended Data Fig. 10 ). We removed taxa that are not freshwater invertebrates, including terrestrial and semi-aquatic taxa, and vertebrates, in addition to freshwater invertebrates that were recorded inconsistently owing to their small size (such as mites, copepods and cladocerans). Between 13 and 516 taxa were sampled per site across all sampling years. Communities from 42% of sites were identified to species, 30% were identified to mixed (species-to-family) taxonomic levels and 28% were identified primarily to family.
In total, 2,648 taxa from 959 genera, 212 families and 47 groups (primarily orders) were recorded. We list time-series locations, durations and characteristics in Supplementary Table  2  and list the number of sites sampled per year and country in Supplementary Table  3. Our compiled time series represent different stream types and stream orders from a large geographical area of Europe. Data were collected for purposes including research projects and regulatory biomonitoring, although detailed information on the purpose is unavailable for some time series. These data were not selected randomly but were collected from available studies that met our six criteria. As these data were collected from sites exposed to varying and unquantified levels of anthropogenic impacts, we cannot rule out biases arising from unequal representation of sites exposed to different impact levels from severely impacted to least impacted.
We calculated temporal turnover as the ratio of taxa gained or lost to the total number of taxa present between two timepoints using the R package codyn  57. All other taxonomic metrics were calculated using the R package vegan  58. Functional diversity. Traits were extracted from the European databases freshwaterecology. info (v. 7. 0)  59  and DISPERSE  60. First, we downloaded trait data for all taxa. We considered biological traits that influence both a taxon's response to and its effects on its environment  61, 62. Specifically, we compiled data on 10 biological traits (with 53 trait modalities): respiration type, resistance form, dispersal type, aquatic stage, life cycle duration, reproduction type, maximum potential body size, wing form, propensity to drift and feeding type  60, 63.
For taxa with multiple aquatic life stages (primarily beetles), whenever available from the trait databases, functional roles were assigned for each life stage, otherwise adult traits were used. We included only traits for which information was available for >85% of all taxa. All traits were fuzzy coded across multiple modalities depending on the information available; for example, the trait 'maximum potential body size' contains seven modalities ranging from ≤0. 25 cm to >8 cm. Within each trait, we scaled affinities to different component modalities between 0 and 1 (summing to 1 across modalities for each taxon), so that each taxon was assigned an affinity score for each modality  64  , to recognize potential trait plasticity. We took the following steps to fill in gaps due to missing trait data.
In calculations of functional richness and divergence, we used six principal coordinate analysis axes (the dbFD 'm' argument), according to current recommendations  67. To enable calculation of functional turnover, we calculated community-weighted means of each functional trait category weighted by taxa abundance, then calculated turnover of the community-weighted means using the R package codyn, as for taxonomic temporal turnover  57, 68. We calculated abundance-weighted functional redundancy using the uniqueness function in the R package adiv  69. We calculated redundancy according to a previous report  70  : community uniqueness (U) was calculated as quadratic diversity divided by Simpson diversity and functional redundancy was calculated as 1 - U. The trait input matrix was based on Euclidean distances bound between 0 and 1 and the tolerance threshold was 10 -8.
Non-native species. Non-native species were defined as introduced species (that is, those present due to human activities, not natural range expansion) at the country level (for example, a species native to Bulgaria could be non-native in the UK). To identify non-native species, we used two databases: DAISIE  71  and the Global Alien First Record Database (GAFRD) (v. 2)  72, 73. DAISIE contains non-native species in addition to native species defined as invasive because they cause economic loss (that is, pest species). GAFRD includes only non-native species but is limited to species and countries for which the approximate year of introduction is known. From each database, we first extracted all species listed for each European country in our dataset. We determined each species' country of origin using the Global Biodiversity Information Facility  74  or peer-reviewed publications, both to eliminate native species listed in DAISIE and to check whether species listed as non-native in one European country were also non-native elsewhere (for example, a North American species marked as non-native in Germany in GAFRD would be non-native in all European countries in which it occurred).
Stream characteristics and environmental predictors Stream network. We used the MERIT Hydro 75 digital elevation model (DEM) to delineate the high-resolution Hydrography90m stream network  76. To achieve a high spatial accuracy, we used an upstream contributing area of 0. 05 km 2 as the stream channel initialization threshold using the r. watershed and r. stream. extract modules in GRASS GIS  77. We next calculated the subcatchments for each segment of the stream network, that is, the area contributing laterally to a given stream reach between two nodes, using the r. basins module. Coordinates indicating a site's location did not always occur in the delineated stream network due to spatial inaccuracy of either the DEM or the coordinates. To ensure that point occurrences matched the DEM-derived stream network and therefore the network topology, we first identified the subcatchment in which each point occurrence was located, then moved all points to the corresponding stream segments using the v.
net module within the given subcatchment. From each point, we calculated the network (as the fish swims) distance (km) using the v. net. distance module, and the Euclidean (as the crow flies) distance to all other point occurrences using the v. distance module. The distance was set to NA when sites were located in different drainage basins, and therefore not connected through the network. Environmental predictors. We calculated stream topographical and topological predictors using the MERIT Hydro DEM  76. Using the r. univar module in GRASS GIS, we computed the average elevation (m), elevation difference between the site and the upstream subcatchment (m), slope and the upstream contributing area (or flow accumulation, km 2 ) for each subcatchment. To create a proxy for dam impacts, we calculated the network distance between each site and each upstream dam using the Global Reservoir and Dam Database (v.
1. 3)  78. For dam impact score calculations, see Supplementary equation (1). We extracted monthly climatic predictors from the TerraClimate dataset  79  for 1967-2020, which covered all sites and years. For each site, we identified the sampling month and computed the mean monthly climatic value for the corresponding subcatchment. We calculated climatic predictors of cumulative annual precipitation (mm) and maximum monthly temperature (°C) for each 12 month period preceding the mean sampling month at each site. Trend values in precipitation and maximum temperature over the period covered by each time series were calculated using Bayesian models fitted using the R package brms  80. These models were similar to those used to calculate site-level biodiversity metric trends, in which a trend was estimated as the coefficient of a continuous year effect.
The TerraClimate dataset is associated with uncertainties in areas of complex terrain, but our large number of sampling sites, relatively good station coverage and the low physiographical complexity of most site locations should have minimized error in our analyses. We calculated the proportion of land cover categories in each subcatchment using the ESA CCI Land Cover time series  81  for each year from 1992 to 2018. Land cover data were available for 92% of analysed site and year combinations and for 99% of sites. We computed the entire upstream catchment for each point occurrence using the r. water. outlet module and calculated the percentage cover of each land cover category within this area. The areas of cropland and urban land were calculated as the percentage of the upstream area averaged across the sampled years at each site.
Statistical analysis Trend analysis. Temporal trends in each taxonomic (abundance, richness, Shannon's diversity, Shannon's evenness, individual-based rarefied richness and temporal turnover), functional (redundancy, richness, evenness, turnover, divergence and Rao's quadratic entropy) and community subset (taxon richness and abundance of native species, non-native species, EPT taxa and insects only) metric were assessed using a two-step approach. First, we calculated site-level trends for each metric using Bayesian linear models fitted using the R package brms  80. In these models, a biodiversity metric was the response variable and year was the continuous predictor variable of which the coefficient represented the temporal trend estimate. The form of the model was: bf(BiodiversityMetric ~ cYear + ar(time = iYear, p = 1, cov = TRUE)).
We ran linear mixed-effects models (LMM) in the brms package to synthesize site-level data and estimate overall mean trends. The LMM included site-level trend estimates as the response, and an overall intercept and two random effects (country and study identity) as predictors. These random effects accounted for data heterogeneity due to unequal numbers of sites among studies and countries. Site-level trends were normally distributed; we therefore assumed normal errors. Site-level trends were combined in a meta-analysis model to estimate the mean trend across studies, including the uncertainty (represented by the s. d. ) of the trend estimates, using brms  80. The form of the model was: brm(estimate|se(sd_trend_estimate) ~ 1 + (1|study_id) + (1|country), data = response_stan, iter = 5000, inits = 0, chains = 4, prior = c(set_prior("normal(0,3)", class = "Intercept")), control = list(adapt_delta = 0.
To optimize model fit, unweighted models were used for non-native and EPT abundance, and for EPT taxon richness. Functional turnover was fitted using beta models as values were bound between 0 and 1. The percentage change per year was calculated by back-transforming model estimates. Back-transformation calculations varied according to the originally modelled transformations of response variables (see the 'equationsToPercChangePerYr. xlsx' file in the 'plots/Fig2_DensityPlots' folder at https://github. com/Ewelti/EuroAquaticMacroInverts). We further tested a one-stage synthesis approach in which mean trends were estimated in one large mixed-effect model of the observed data, including random intercepts and slopes. Overall, these models produced similar trend results (see figure  16  in the 'Online Figures.
docx' file in the 'plots' folder at https://github. com/Ewelti/EuroAquatic-MacroInverts). Moving-window analysis. To assess how estimates of trends in abundance and taxonomic and functional diversity changed over time, we used a moving-window approach. We used a similar two-stage process as described above. For each year of the analysis, we calculated trends within a ten-year window in which all time series with ≥6 sampling years and from ≥8 countries were included. A ten-year window was chosen according to current recommendations regarding times-series length  83, 84  and six was chosen as the number of sampling years covering >50% of each ten-year period. This analysis was restricted to the period between a first moving window from 1990 to 1999, in which any time series with ≥6 sampling years was included, to a final window from 2011 to 2020.
90, max_treedepth = 12)). These models identified a linear decline in trends in taxon richness and a tendency for decline in functional richness trends over time (see figure  21  in the 'Online Figures. docx' file in the 'plots' folder at https:// github. com/Ewelti/EuroAquaticMacroInverts). We examined the proportion of sites with positive trends and how this proportion changed through time for our key biodiversity metrics of taxon richness, abundance, functional richness and functional redundancy. To do this, we used site-level moving-window trends and estimated the proportion of sites with positive trends in each year. We repeated this calculation for each posterior draw to propagate through site-level uncertainty to the overall mean proportion and estimated 80%, 90% and 95% CIs. To ensure this proportion was not driven by studies with especially large numbers of sampling sites, we weighted each site by the inverse of the number of sites in each study.
These alternative moving-window analyses found similar declines in the trend of taxon richness over time (see figures 22-25 in the 'Online Figures. docx' file in the 'plots' folder at https:// github. com/Ewelti/EuroAquaticMacroInverts). Analysis of environmental predictors. We assessed responses of biodiversity metrics to climate (both the mean and the trend over the time series' durations) and upstream land cover (as the annual mean cover value during the sampling period), dam impact score and subcatchment characteristics (Supplementary Table  5 ). We did not include upstream land-use trends as most sites exhibited low variation: cropland cover changed by a mean of -0. 002% per year ± 0. 11 s. e. m. , with no change detected at 634 sites; urban cover changed by 2. 48% per year ± 0. 14 s.
e. m. , but with no change detected at 803 sites. To examine relationships between environmental drivers and biodiversity trends, we modelled trend estimates using an LMM, incorporating trend errors as for the calculation of the overall trend, including all predictor variables as fixed effects, and study identity and country as random effects. The form of the model was: brm(estimate|se(sd) ~ Precip-Trend + TempTrend + PrecipMean + TempMean + StreamOrder + Accumulation + Elevation + Slope + Urban + Crop + DamScore + (1|study_ id) + (1|country), = response_stan, iter = 5000, chains = 4, prior = prior1, control = list(adapt_delta = 0. 90, max_treedepth = 12)). We ran models using the R package brms  80. We standardized predictor variables to unit s. d. to facilitate comparison of their relative importance.
We used regularizing horseshoe priors on environmental covariates that pull unimportant covariate effects towards zero to avoid overfitting. Our analysis of drivers focused on site-level variation in long-term trends, and not temporal variation in short-term trends examined in the moving-window analysis. Thus, our driver analysis cannot be used to understand recent changes in trends. To further examine whether biodiversity trends were positive or negative across the range of driver values, we used R package marginaleffects  85  to visualize responses to drivers while holding other driver covariates at their median. Predicted trends complement the effects on trends shown in Fig. 4  (see figures 28-34 in the 'Online Figures. docx' file in the 'plots' folder at https://github. com/Ewelti/EuroAquaticMacroInverts).
Sensitivity analysis. To check the robustness of our results to analytical decisions, we ran multiple sensitivity analyses for all biodiversity metrics. We tested the effects on trend estimates of (1) taxonomic resolution, by rerunning meta-analysis models with resolution (family, mixed, and species) as an additional fixed factor; (2) sampling season, by rerunning meta-analysis models (described in the 'Trend analysis' section) with season (winter, spring, summer and fall) as an additional fixed factor; and (3) country, using a jackknife resampling analysis in which the meta-analysis was rerun after sequentially removing countries. Models were otherwise similar to those presented above. Scripts for sensitivity analyses are available at GitHub (https://github. com/ Ewelti/EuroAquaticMacroInverts (HPC_Sensitivity_analysis.
R and HPC_Meta_analysis_country_jackknife). Some caution is advised when inferring conclusions from a dataset including different levels of taxonomic resolution or different seasons. However, intra-site sampling was consistently within one season or taxonomic resolution, so intra-site trends were not affected by these differences. Neither taxonomic resolution nor season had strong directional effects on trend estimates, with error bars generally overlapping. Patterns across taxonomic resolutions and sampling seasons were generally similar to those presented in Fig. 2  (Extended Data Figs. 9 and 10). Trends of taxonomic richness were robust to one-country removal but abundance trends became more strongly positive on removal of data from some countries, suggesting geographical variability in abundance trends (see figure  17  in the 'Online Figures.
docx' file in the 'plots' folder at https://github. com/Ewelti/EuroAquaticMacroInverts). We analysed the effect of the number of sampling years in a time series on observed trends using simple linear regression. The number of sampling years did not affect trend estimates of taxon richness (R 2 < 0. 001), abundance (R 2 < 0. 001), functional richness (R 2 = 0. 004) or functional redundancy (R 2 < 0. 001) (see figure  14.