# 🍷🏥 FineWeb-Med: Medical-Focused Web Dataset FineWeb-Med is a high-quality dataset of medical and healthcare-related web content, extracted and processed from Common Crawl using the FineWeb methodology with specialized medical filtering. ## Dataset Summary This dataset contains **9 documents** with approximately **0 tokens**, focusing exclusively on medical, healthcare, and related topics from the web. It serves as a specialized complement to general web datasets like FineWeb for training medical AI models. ## Data Processing The dataset was created using the 🏭 `datatrove` library with enhanced medical-specific processing. You can find the complete processing script in our repository. ### Processing Pipeline 1. **Data Source**: Common Crawl dump `CC-MAIN-2023-40` 2. **URL Filtering**: Remove malicious and NSFW websites using blocklists and subword detection 3. **Text Extraction**: Trafilatura for high-quality text extraction from raw HTML WARC files 4. **Language Filtering**: FastText language detection, keeping only English content (score > 0.65) 5. **Medical Content Filtering**: Documents must contain at least one of 26 medical keywords 6. **Length Filtering**: Documents must be at least 200 words to ensure substantial content 7. **Quality Filtering**: - Gopher repetition and quality filters - C4 quality filters (excluding terminal punctuation rule) - FineWeb custom filters for list-like documents and formatting issues 8. **Token Counting**: GPT-2 tokenizer for token statistics ## Medical Keywords The dataset employs specialized filtering for medical content using these keywords: **Core Medical Terms**: medical, diagnosis, treatment, patient, doctor, symptom, therapy, prescription, clinical, healthcare **Healthcare Facilities**: hospital, clinic, nurse, surgery, pharmacy, pharmaceutical **Health Conditions**: disease, disorder, condition, medication, drug, vaccine, epidemic, pandemic **Wellness Terms**: health, wellness ## Data Format Each example is a JSON object with the following fields: ### Core Fields - **`text`** *(string)*: The extracted and cleaned text content - **`id`** *(string)*: Unique identifier from the original WARC record - **`metadata`** *(dict)*: Extended metadata information ### Metadata Fields - **`dump`** *(string)*: Common Crawl dump identifier (e.g., "CC-MAIN-2023-50") - **`dataset`** *(string)*: Dataset identifier ("fineweb-med") - **`url`** *(string)*: Original webpage URL - **`date`** *(string)*: Crawl timestamp in ISO format - **`file_path`** *(string)*: S3 path to source WARC file - **`language`** *(string)*: Detected language (always "en" for this dataset) - **`language_score`** *(float)*: Language detection confidence score - **`token_count`** *(int)*: Number of tokens using GPT-2 tokenizer ## Usage ### Loading the Dataset ```python from datasets import load_dataset # Load the complete dataset dataset = load_dataset("pohsjxx/fineweb-med-test") # Access training split train_data = dataset['train'] # Example usage for example in train_data: print(f"Text: {example['text'][:100]}...") print(f"URL: {example['metadata']['url']}") print(f"Tokens: {example['metadata']['token_count']}") break ``` ### Medical-Specific Filtering ```python # Filter for clinical documents clinical_docs = [doc for doc in dataset['train'] if 'clinical' in doc['text'].lower()] # Filter by token count for model training suitable_docs = [doc for doc in dataset['train'] if 512 <= doc['metadata']['token_count'] <= 2048] ``` ## Statistics | Metric | Value | |--------|-------| | **Total Documents** | 9 | | **Total Tokens** | 0 | | **Average Tokens/Document** | 0.0 | | **Token Range** | 0 - 0 | | **Median Tokens/Document** | 0 | | **Source Dump** | CC-MAIN-2023-40 | | **Language** | English only | | **Medical Focus** | Healthcare & medical content | ### Top Content Sources - **123fish.net**: 4 documents - **afrigems.de**: 2 documents - **accg.org**: 1 documents - **2510000.com**: 1 documents - **abbybosshair.com**: 1 documents ## Dataset Creation ### Curation Rationale While FineWeb provides excellent general web text data, specialized domains like healthcare require targeted datasets. FineWeb-Med addresses this need by applying medical-specific filtering to create a high-quality, domain-focused dataset suitable for: - Training medical language models - Fine-tuning healthcare AI applications - Medical text analysis and NLP research - Healthcare chatbot development ### Source Data **Primary Source**: Common Crawl web crawl data - **Dump**: CC-MAIN-2023-40 - **Time Period**: 2023-2024 web crawl - **Content Type**: Public web pages with medical relevance ### Annotations We augment samples with automatic annotations: - **`language`** & **`language_score`**: Generated by FastText language classifier - **`token_count`**: Calculated using GPT-2 tokenizer ## Considerations for Using the Data ### Social Impact This dataset enables more accessible development of healthcare AI applications, potentially improving medical text understanding and patient care through better language models. ### Discussion of Biases The dataset inherits biases from web-sourced medical content, which may reflect: - Geographic biases in healthcare information availability - Language biases (English-only content) - Platform biases from different healthcare websites ### Limitations - **Code Content**: Limited due to filtering steps; supplement with code-specific datasets if needed - **Medical Accuracy**: Web content may contain outdated or inaccurate medical information - **PII Concerns**: Despite anonymization, some personal health information may remain - **Specialized Domains**: May not cover all medical specialties equally ## Additional Information ### Licensing Information **License**: Apache 2.0 **Additional Terms**: Subject to Common Crawl's Terms of Use ### Personal and Sensitive Information We anonymize: - Email addresses → `email@example.com` or `firstname.lastname@example.org` - Public IP addresses → Randomly assigned non-responsive IPs For PII removal requests, please create an issue in our repository. ### Future Work We plan to expand FineWeb-Med with: - Additional medical domains and specialties - Multi-language medical content - Enhanced quality filtering for medical text - Integration with medical knowledge bases ## Citation Information ```bibtex @dataset{fineweb_med, title={FineWeb-Med: Medical-Focused Web Dataset}, author={Generated using datatrove FineWeb methodology with medical filtering}, year={2024}, url={https://huggingface.co/datasets/pohsjxx/fineweb-med-test} } ``` --- *Built with ❤️ using the FineWeb methodology and datatrove*