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).
59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
"""Miscellaneous utility functions."""
|
|
|
|
import os.path as op
|
|
|
|
import numpy as np
|
|
|
|
|
|
def get_resource_path():
|
|
"""Return the path to general resources, terminated with separator.
|
|
|
|
Resources are kept outside package folder in "datasets".
|
|
Based on function by Yaroslav Halchenko used in Neurosynth Python package.
|
|
"""
|
|
return op.abspath(op.join(op.dirname(__file__), "resources") + op.sep)
|
|
|
|
|
|
def _listify(obj):
|
|
"""Wrap all non-list or tuple objects in a list.
|
|
|
|
This provides a simple way to accept flexible arguments.
|
|
"""
|
|
return obj if isinstance(obj, (list, tuple, type(None), np.ndarray)) else [obj]
|
|
|
|
|
|
def _check_inputs_shape(param1, param2, param1_name, param2_name, row=False, column=False):
|
|
"""Check whether 'param1' and 'param2' have the same shape.
|
|
|
|
Parameters
|
|
----------
|
|
param1 : array
|
|
param2 : array
|
|
param1_name : str
|
|
param2_name : str
|
|
row : bool, default to False.
|
|
column : bool, default to False.
|
|
"""
|
|
if (param1 is not None) and (param2 is not None):
|
|
if row and not column:
|
|
shape1 = param1.shape[0]
|
|
shape2 = param2.shape[0]
|
|
message = "rows"
|
|
elif column and not row:
|
|
shape1 = param1.shape[1]
|
|
shape2 = param2.shape[1]
|
|
message = "columns"
|
|
elif row and column:
|
|
shape1 = param1.shape
|
|
shape2 = param2.shape
|
|
message = "rows and columns"
|
|
else:
|
|
raise ValueError("At least one of the two parameters (row or column) should be True.")
|
|
|
|
if shape1 != shape2:
|
|
raise ValueError(
|
|
f"{param1_name} and {param2_name} should have the same number of {message}. "
|
|
f"You provided {param1_name} with shape {param1.shape} and {param2_name} "
|
|
f"with shape {param2.shape}."
|
|
)
|