caelum0x 174222bcaa feat: Builder-Track named-user tools, bio + evidence-intelligence platform, Apache-2.0
Builds PaperTrail from the base skeleton into a full evidence-verification platform
for the "Built with Claude: Life Sciences" hackathon (Builder Track).

New named-user features (Build Beyond the Bench):
- Lab Notebook Companion — rough bench notes -> structured, searchable, grounded
  experiment records (lib/labNotebook, /console/lab-notebook, migration 0059)
- Clinical Trial Matcher — de-identified patient notes -> ranked eligible
  ClinicalTrials.gov trials with per-criterion inclusion/exclusion reasoning
  (lib/trialMatcher, /console/trial-matcher, migrations 0060)

Platform:
- Deterministic verification moat (biostats recompute, exact-span grounding)
- 11 biomedical evidence engines (FAERS, GWAS, Open Targets, ChEMBL, ClinVar,
  PharmGKB, PubTator, DDI, repurposing, biomarker, unified verifier)
- Evidence Intelligence (KG, dossier, provenance/export, RWE) + enterprise
  governance (RBAC, /api/v1 gateway, metering, audit chain, retention)
- 17 OSS projects assimilated into native TypeScript on our stack (backend/engines
  retained + credited in NOTICE)
- Multi-format upload (PDF/DOCX/XLSX/CSV/MD/TXT), logo, marketing site
- Next.js 16 upgrade, benchmark harness (honest smoke-test caveat)

Licensing: Apache-2.0 (LICENSE + NOTICE).
2026-07-10 16:23:13 +03:00

79 lines
2.4 KiB
Python

import os
import json
import requests
from typing import List, Dict
from urllib.parse import urljoin
class SearxSearch():
"""
SearxNG API Retriever
"""
def __init__(self, query: str, query_domains=None):
"""
Initializes the SearxSearch object
Args:
query: Search query string
"""
self.query = query
self.query_domains = query_domains or None
self.base_url = self.get_searxng_url()
def get_searxng_url(self) -> str:
"""
Gets the SearxNG instance URL from environment variables
Returns:
str: Base URL of SearxNG instance
"""
try:
base_url = os.environ["SEARX_URL"]
if not base_url.endswith('/'):
base_url += '/'
return base_url
except KeyError:
raise Exception(
"SearxNG URL not found. Please set the SEARX_URL environment variable. "
"You can find public instances at https://searx.space/"
)
def search(self, max_results: int = 10) -> List[Dict[str, str]]:
"""
Searches the query using SearxNG API
Args:
max_results: Maximum number of results to return
Returns:
List of dictionaries containing search results
"""
search_url = urljoin(self.base_url, "search")
# TODO: Add support for query domains
params = {
# The search query.
'q': self.query,
# Output format of results. Format needs to be activated in searxng config.
'format': 'json'
}
try:
response = requests.get(
search_url,
params=params,
headers={'Accept': 'application/json'}
)
response.raise_for_status()
results = response.json()
# Normalize results to match the expected format
search_response = []
for result in results.get('results', [])[:max_results]:
search_response.append({
"href": result.get('url', ''),
"body": result.get('content', '')
})
return search_response
except requests.exceptions.RequestException as e:
raise Exception(f"Error querying SearxNG: {str(e)}")
except json.JSONDecodeError:
raise Exception("Error parsing SearxNG response")