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

38 lines
1.6 KiB
Python

from azure.storage.blob import BlobServiceClient
import tempfile
from pathlib import Path, PurePosixPath
class AzureDocumentLoader:
def __init__(self, container_name, connection_string):
self.client = BlobServiceClient.from_connection_string(connection_string)
self.container = self.client.get_container_client(container_name)
async def load(self):
"""Download all blobs to temp files and return their paths."""
temp_dir = Path(tempfile.mkdtemp()).resolve()
blobs = self.container.list_blobs()
file_paths = []
for blob in blobs:
blob_client = self.container.get_blob_client(blob.name)
local_path = self._get_blob_path(temp_dir, blob.name)
local_path.parent.mkdir(parents=True, exist_ok=True)
with open(local_path, "wb") as f:
blob_data = blob_client.download_blob()
f.write(blob_data.readall())
file_paths.append(str(local_path))
return file_paths # Pass to existing DocumentLoader
@staticmethod
def _get_blob_path(temp_dir: Path, blob_name: str) -> Path:
"""Return a safe local path for an Azure blob name."""
blob_path = PurePosixPath(blob_name.replace("\\", "/"))
if blob_path.is_absolute() or ".." in blob_path.parts:
raise ValueError(f"Unsafe blob name: {blob_name}")
local_path = (temp_dir / Path(*blob_path.parts)).resolve()
if temp_dir != local_path and temp_dir not in local_path.parents:
raise ValueError(f"Unsafe blob name: {blob_name}")
return local_path