Trường Hợp Sử Dụng

Thu thập dữ liệu chăm sóc sức khỏe đằng sau bức tường CAPTCHA

Cổng dữ liệu chăm sóc sức khỏe - danh mục nhà cung cấp, cơ sở dữ liệu về giá thuốc và cơ quan đăng ký thử nghiệm lâm sàng - sử dụng CAPTCHA để ngăn chặn việc thu thập dữ liệu tự động. Các nhà nghiên cứu và nền tảng công nghệ y tế cần dữ liệu này để phân tích, tuân thủ và đưa ra quyết định sáng suốt.


Nơi CAPTCHA xuất hiện

Nguồn Loại CAPTCHA dữ liệu Trường hợp sử dụng
Danh mục nhà cung cấp (NPI) CAPTCHA hình ảnh Tra cứu Doctor/facility Độ đầy đủ của mạng
Cổng thông tin định giá thuốc reCAPTCHA v2 Giá thuốc Minh bạch về giá
Sổ đăng ký thử nghiệm lâm sàng reCAPTCHA v2 Dữ liệu thử nghiệm, kết quả Phân tích nghiên cứu
Công thức bảo hiểm reCAPTCHA v2 Danh sách bảo hiểm thuốc So sánh công thức thuốc
Hội đồng cấp phép nhà nước CAPTCHA hình ảnh Xác minh giấy phép Kiểm tra thông tin xác thực
Đánh giá chất lượng bệnh viện Cloudflare Turnstile Số liệu chất lượng Phân tích hiệu suất

Máy quét thư mục nhà cung cấp

import requests
import time
import re
import base64
from bs4 import BeautifulSoup
import csv

CAPTCHAAI_KEY = "YOUR_API_KEY"
CAPTCHAAI_URL = "https://ocr.captchaai.com"

def solve_recaptcha(sitekey, pageurl):
    resp = requests.post(f"{CAPTCHAAI_URL}/in.php", data={
        "key": CAPTCHAAI_KEY, "method": "userrecaptcha",
        "googlekey": sitekey, "pageurl": pageurl, "json": 1,
    })
    task_id = resp.json()["request"]
    for _ in range(60):
        time.sleep(5)
        result = requests.get(f"{CAPTCHAAI_URL}/res.php", params={
            "key": CAPTCHAAI_KEY, "action": "get",
            "id": task_id, "json": 1,
        })
        data = result.json()
        if data["request"] != "CAPCHA_NOT_READY":
            return data["request"]
    raise TimeoutError("Timeout")

def solve_image_captcha(image_bytes):
    img_b64 = base64.b64encode(image_bytes).decode()
    resp = requests.post(f"{CAPTCHAAI_URL}/in.php", data={
        "key": CAPTCHAAI_KEY, "method": "base64",
        "body": img_b64, "json": 1,
    })
    task_id = resp.json()["request"]
    for _ in range(20):
        time.sleep(3)
        result = requests.get(f"{CAPTCHAAI_URL}/res.php", params={
            "key": CAPTCHAAI_KEY, "action": "get",
            "id": task_id, "json": 1,
        })
        data = result.json()
        if data["request"] != "CAPCHA_NOT_READY":
            return data["request"]
    raise TimeoutError("Timeout")

class HealthcareDataCollector:
    def __init__(self, proxy=None):
        self.session = requests.Session()
        if proxy:
            self.session.proxies = {"http": proxy, "https": proxy}
        self.session.headers.update({
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
            "AppleWebKit/537.36 Chrome/126.0.0.0 Safari/537.36",
        })

    def search_providers(self, portal_url, specialty, location, sitekey=None):
        """Search provider directory with CAPTCHA handling."""
        resp = self.session.get(portal_url, timeout=30)

        data = {"specialty": specialty, "location": location}

        # Handle CAPTCHA
        if sitekey:
            token = solve_recaptcha(sitekey, portal_url)
            data["g-recaptcha-response"] = token
        else:
            captcha_img = re.search(r'src="(/captcha[^"]+)"', resp.text)
            if captcha_img:
                img_url = portal_url.rstrip("/") + captcha_img.group(1)
                img = self.session.get(img_url)
                data["captcha"] = solve_image_captcha(img.content)

        resp = self.session.post(portal_url, data=data)
        return self._parse_providers(resp.text)

    def lookup_drug_prices(self, pricing_url, drug_name, zip_code, sitekey):
        """Look up drug prices with CAPTCHA solving."""
        # Load search page
        self.session.get(pricing_url)

        # Solve CAPTCHA
        token = solve_recaptcha(sitekey, pricing_url)

        resp = self.session.post(pricing_url, data={
            "drug": drug_name,
            "zip": zip_code,
            "g-recaptcha-response": token,
        })

        if resp.status_code == 200:
            return self._parse_prices(resp.text)
        return []

    def batch_provider_lookup(self, portal_url, specialties, locations, output_file):
        """Batch search across specialties and locations."""
        all_providers = []

        for specialty in specialties:
            for location in locations:
                try:
                    providers = self.search_providers(
                        portal_url, specialty, location,
                    )
                    for p in providers:
                        p["specialty_search"] = specialty
                        p["location_search"] = location
                    all_providers.extend(providers)
                    print(f"{specialty} / {location}: {len(providers)} providers")
                    time.sleep(5)
                except Exception as e:
                    print(f"Error: {specialty} / {location}: {e}")

        # Export
        if all_providers:
            keys = all_providers[0].keys()
            with open(output_file, "w", newline="", encoding="utf-8") as f:
                writer = csv.DictWriter(f, fieldnames=keys)
                writer.writeheader()
                writer.writerows(all_providers)

        return all_providers

    def _parse_providers(self, html):
        soup = BeautifulSoup(html, "html.parser")
        providers = []
        for card in soup.select(".provider-card, .doctor-result, tr.provider"):
            providers.append({
                "name": self._text(card, ".name, .provider-name"),
                "specialty": self._text(card, ".specialty"),
                "address": self._text(card, ".address"),
                "phone": self._text(card, ".phone"),
                "accepting": self._text(card, ".accepting-patients"),
            })
        return providers

    def _parse_prices(self, html):
        soup = BeautifulSoup(html, "html.parser")
        prices = []
        for row in soup.select(".pharmacy-row, .price-result"):
            prices.append({
                "pharmacy": self._text(row, ".pharmacy-name"),
                "price": self._text(row, ".price, .drug-price"),
                "quantity": self._text(row, ".quantity"),
            })
        return prices

    def _text(self, el, selector):
        found = el.select_one(selector)
        return found.get_text(strip=True) if found else ""

# Usage
collector = HealthcareDataCollector(
    proxy="http://user:pass@residential.proxy.com:5000"
)

# Provider search
providers = collector.search_providers(
    portal_url="https://provider-directory.example.com/search",
    specialty="Cardiology",
    location="New York, NY",
)

# Drug pricing
prices = collector.lookup_drug_prices(
    pricing_url="https://drug-prices.example.com/compare",
    drug_name="atorvastatin",
    zip_code="10001",
    sitekey="6Lc_xxxxxxx",
)

Thu thập dữ liệu thử nghiệm lâm sàng

def collect_clinical_trials(search_url, condition, sitekey):
    """Collect clinical trial data for a medical condition."""
    collector = HealthcareDataCollector(
        proxy="http://user:pass@residential.proxy.com:5000"
    )

    token = solve_recaptcha(sitekey, search_url)
    resp = collector.session.post(search_url, data={
        "condition": condition,
        "status": "recruiting",
        "g-recaptcha-response": token,
    })

    if resp.status_code != 200:
        return []

    soup = BeautifulSoup(resp.text, "html.parser")
    trials = []
    for item in soup.select(".trial-item, .study-result"):
        trials.append({
            "title": collector._text(item, ".title, h3"),
            "status": collector._text(item, ".status"),
            "sponsor": collector._text(item, ".sponsor"),
            "phase": collector._text(item, ".phase"),
            "enrollment": collector._text(item, ".enrollment"),
            "location": collector._text(item, ".location"),
        })

    return trials

Cân nhắc về quyền riêng tư dữ liệu

Kiểu dữ liệu Độ nhạy Khuyến nghị
Danh mục nhà cung cấp Thấp (thông tin công khai) Nói chung là an toàn để thu thập
Giá thuốc Thấp (giá công khai) Được phép minh bạch
Siêu dữ liệu thử nghiệm lâm sàng Thấp (đăng ký công cộng) Nghiên cứu sử dụng phù hợp
Đánh giá của bệnh nhân Trung bình Ẩn danh trước khi phân tích
Chi tiết gói bảo hiểm Thấp (tỷ lệ công bố) Được phép so sánh

Quan trọng: Đừng bao giờ cố gắng thu thập thông tin sức khỏe được bảo vệ (PHI). Chỉ tập trung vào dữ liệu có sẵn công khai, không dành riêng cho bệnh nhân.


Khắc phục sự cố

Vấn đề Nguyên nhân Cách xử lý
Hình ảnh CAPTCHA không thể đọc được Hình ảnh chất lượng thấp Thử lại – hình ảnh mới được tạo
Tìm kiếm nhà cung cấp trả về trống CAPTCHA đã chặn tìm kiếm Giải CAPTCHA trước khi gửi
Giá thuốc thay đổi tùy theo địa điểm Định giá dựa trên địa lý Khớp vị trí proxy với mã zip
Phiên hết hạn trên nhiều trang Hết thời gian chờ của cổng thông tin Hoàn thành tìm kiếm nhanh chóng
Tỷ lệ giới hạn khi tra cứu hàng loạt Quá nhiều yêu cầu Thêm độ trễ 5-10 giây

Câu hỏi thường gặp

Việc thu thập dữ liệu về giá chăm sóc sức khỏe có được phép không?

Sự minh bạch về giá thuốc được khuyến khích bởi quy định (Quy tắc minh bạch về giá của CMS). Dữ liệu thư mục nhà cung cấp công cộng thường có thể truy cập được.

Tôi có thể so sánh giá thuốc giữa các hiệu thuốc không?

Vâng. Các dịch vụ như GoodRx thực hiện điều này trên quy mô lớn. CaptchaAI xử lý CAPTCHA mà cổng định giá sử dụng để hạn chế quyền truy cập tự động.

Làm cách nào để xử lý HIPAA khi xóa các trang web chăm sóc sức khỏe?

HIPAA áp dụng cho thông tin sức khỏe được bảo vệ (PHI). Dữ liệu công khai như danh mục nhà cung cấp, giá thuốc và đăng ký thử nghiệm lâm sàng không phải là PHI. Không bao giờ cạo hồ sơ bệnh nhân cá nhân.


Hướng dẫn liên quan


Thu thập dữ liệu chăm sóc sức khỏe một cách hiệu quả —lấy khóa CaptchaAI của bạnvà tự động tra cứu nhà cung cấp và giá cả.

Os comentários estão desativados para este artigo.