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).
71 lines
2.4 KiB
Python
71 lines
2.4 KiB
Python
import pytest
|
|
import asyncio
|
|
from pathlib import Path
|
|
import sys
|
|
import logging
|
|
|
|
# Add the project root to Python path
|
|
project_root = Path(__file__).parent.parent
|
|
sys.path.append(str(project_root))
|
|
|
|
# Configure basic logging
|
|
logging.basicConfig(level=logging.INFO)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_researcher_logging(): # Renamed function to be more specific
|
|
"""
|
|
Test suite for verifying the researcher's logging infrastructure.
|
|
Ensures proper creation and formatting of log files.
|
|
"""
|
|
try:
|
|
# Import here to catch any import errors
|
|
from backend.server.server_utils import Researcher
|
|
logger.info("Successfully imported Researcher class")
|
|
|
|
# Create a researcher instance with a logging-focused query
|
|
researcher = Researcher(
|
|
query="Test query for logging verification",
|
|
report_type="research_report"
|
|
)
|
|
logger.info("Created Researcher instance")
|
|
|
|
# Run the research
|
|
report = await researcher.research()
|
|
logger.info("Research completed successfully!")
|
|
logger.info(f"Report length: {len(report)}")
|
|
|
|
# Basic report assertions
|
|
assert report is not None
|
|
assert len(report) > 0
|
|
|
|
# Detailed log file verification
|
|
logs_dir = Path(project_root) / "logs"
|
|
log_files = list(logs_dir.glob("research_*.log"))
|
|
json_files = list(logs_dir.glob("research_*.json"))
|
|
|
|
# Verify log files exist
|
|
assert len(log_files) > 0, "No log files were created"
|
|
assert len(json_files) > 0, "No JSON files were created"
|
|
|
|
# Log the findings
|
|
logger.info(f"\nFound {len(log_files)} log files:")
|
|
for log_file in log_files:
|
|
logger.info(f"- {log_file.name}")
|
|
# Could add additional checks for log file format/content here
|
|
|
|
logger.info(f"\nFound {len(json_files)} JSON files:")
|
|
for json_file in json_files:
|
|
logger.info(f"- {json_file.name}")
|
|
# Could add additional checks for JSON file structure here
|
|
|
|
except ImportError as e:
|
|
logger.error(f"Import error: {e}")
|
|
logger.error("Make sure gpt_researcher is installed and in your PYTHONPATH")
|
|
raise
|
|
except Exception as e:
|
|
logger.error(f"Error during research: {e}")
|
|
raise
|
|
|
|
if __name__ == "__main__":
|
|
pytest.main([__file__]) |