Skip to content

Instantly share code, notes, and snippets.

View david-andrew's full-sized avatar

David-Andrew Samson david-andrew

View GitHub Profile
@david-andrew
david-andrew / gist:f8404b38eaae264d87588f762cad19c6
Created January 17, 2025 14:58
vs vanilla with examples adhoc-api
>>> can you run code to get gene panel data?
To help you with getting gene panel data, I need more information about the specific source or API you want to use to retrieve this data. Could you please provide more details or specify the API or database you are interested in?
>>> I'm just doing early exploration, I don't know what I want.
thought: Since the user is exploring options for obtaining gene panel data, I
will list the available APIs to see if any are relevant to their needs.
tool: list_apis
tool_input: {}
observation: {'cbioportal': {'description': "The cBioPortal for Cancer Genomics
was originally developed at \nMemorial Sloan Kettering Cancer Center (MSK). The
>>> can you run code to get gene panel data?
thought: I need more information about the specific gene panel data the user is
interested in to proceed effectively.
tool: ask_user
tool_input: {'query': 'Could you please provide more details about the gene
panel data you are interested in? For example, are you looking for specific
genes, a particular type of analysis, or data from a specific source?'}
Could you please provide more details about the gene panel data you are interested in? For example, are you looking for specific genes, a particular type of analysis, or data from a specific source? $ I'm just doing early exploration, I don't know what I want.
observation: I'm just doing early exploration, I don't know what I want.
@david-andrew
david-andrew / gist:e24dcd431bfd637bfd166e06f8772c22
Created January 16, 2025 15:23
simple test of graph rag over cbioportal
$ python -m graphrag.graphrag
Successfully loaded graph @ /home/david/dev/adhoc-api/graphrag/cbioportal from disk.
>>> can you run code to get gene panel data?
thought: I need more information about the specific gene panel data the user is interested in
to proceed effectively.
tool: ask_user
tool_input: {'query': 'Could you please provide more details about the gene panel data you are
interested in? For example, are you looking for specific genes, a particular type of analysis,
or data from a certain database or source?'}
@david-andrew
david-andrew / gist:cc825b97fe3dfe0ddd3a6313d9137fc4
Last active November 8, 2024 19:23
Collecting Facets for PDC API
>>> for the PDC api, can you ask if there are any fields necessary for various requests that look like they might be drawn from a fixed enumerated set of values? Not things like case IDs which do have a fixed set of values--but are always changing. But rather other parameters used to filter for data that are likely to have a stable set of fixed possible values
thought: I need to list the available APIs to find the PDC API and then ask about the fields
that might be drawn from a fixed enumerated set of values.
tool: AdhocApi.list_apis
tool_input: None
observation: {'Proteomic Data Commons': {'description': "The Proteomics Data Commons (PDC) is a
comprehensive, open-access resource that stores,\nmanages, and shares large-scale proteomic
data for cancer and other biomedical research.\nIt is part of the National Cancer Institute's
broader data ecosystem, enabling researchers\nto access and analyze proteomic datasets,
>>> From the Proteomic Data Commons, use the api tool to download a metadata file with information about proteome protein assembly data files from primary tumor samples. Exclude any disqualified cases and specimens.
thought: First, I need to list the available APIs to find the Proteomic Data Commons API.
tool: AdhocApi.list_apis
tool_input: None
observation: {'Proteomic Data Commons': {'description': "The Proteomics Data Commons (PDC) is a comprehensive, open-access resource that stores,\nmanages, and shares large-scale proteomic
data for cancer and other biomedical research.\nIt is part of the National Cancer Institute's broader data ecosystem, enabling researchers\nto access and analyze proteomic datasets, including
mass spectrometry data and related\nmetadata. The PDC supports integrative research by providing standardized data formats\nand analysis tools, facilitating the discovery of protein
biomarkers and insights into\ncancer biology, which helps in advancing personalized medicine and treatment appr
@david-andrew
david-andrew / gist:125bbab42d3673d39db78927d50e4b62
Last active November 8, 2024 16:50
PDC API Test example 2
>>> From the Proteomic Data Commons site, use the api tool to download the biospecimen metadata for specimens with processed mass spectra data from patients with endometrial cancer.
thought: I need to list the available APIs to find the one related to the Proteomic Data Commons.
tool: AdhocApi.list_apis
tool_input: None
observation: {'Proteomic Data Commons': {'description': "The Proteomics Data Commons (PDC) is a comprehensive, open-access resource that stores,\nmanages, and shares large-scale proteomic
data for cancer and other biomedical research.\nIt is part of the National Cancer Institute's broader data ecosystem, enabling researchers\nto access and analyze proteomic datasets, including
mass spectrometry data and related\nmetadata. The PDC supports integrative research by providing standardized data formats\nand analysis tools, facilitating the discovery of protein
biomarkers and insights into\ncancer biology, which helps in advancing personalized medicine and treatment approaches.\n"}}
>>> what apis are available?
thought: I will list all the available APIs to provide the user with the information they need.
tool: AdhocApi.list_apis
tool_input: None
observation: {'Proteomic Data Commons': {'description': "The Proteomics Data Commons (PDC) is a comprehensive, open-access resource that stores,\nmanages, and shares large-scale proteomic
data for cancer and other biomedical research.\nIt is part of the National Cancer Institute's broader data ecosystem, enabling researchers\nto access and analyze proteomic datasets, including
mass spectrometry data and related\nmetadata. The PDC supports integrative research by providing standardized data formats\nand analysis tools, facilitating the discovery of protein
biomarkers and insights into\ncancer biology, which helps in advancing personalized medicine and treatment approaches.\n"}}
>>> On the Proteomic Data Commons site, find the number of clinical cases with Hepatocellular Carcinoma
thought: I need to find an API related to the Proteomic Data Commons to retrieve information about clinical cases with Hepatocellular Carcinoma.
tool: AdhocApi.list_apis
tool_input: None
observation: {'Proteomic Data Commons': {'description': "The Proteomics Data Commons (PDC) is a comprehensive, open-access resource that stores,\nmanages, and shares large-scale proteomic
data for cancer and other biomedical research.\nIt is part of the National Cancer Institute's broader data ecosystem, enabling researchers\nto access and analyze proteomic datasets, including
mass spectrometry data and related\nmetadata. The PDC supports integrative research by providing standardized data formats\nand analysis tools, facilitating the discovery of protein
biomarkers and insights into\ncancer biology, which helps in advancing personalized medicine and treatment approaches.\n"}}
@david-andrew
david-andrew / gist:d992ef49ab68057e852c85958a11330d
Created September 22, 2024 20:28
extract just policy and environment
import requests
from bs4 import BeautifulSoup
from collections import defaultdict
# from markdownify import markdownify as md
from weasyprint import HTML
from tqdm import tqdm
from enum import Enum
import pdb
@david-andrew
david-andrew / gist:24db57e49631dae2333cd048c2f54218
Created August 23, 2024 15:31
geothermal react example chat
>>> can you help me do a geo power analysis
⠙ thinking...[2024-08-23 11:05:30,632] {_client.py:1026} INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK"
thought: I need to gather the necessary parameters for the geo power analysis.
tool: geo_power_api
tool_input: {'data': {}}
observation: {'1_user_inputs': {'application': 'power', 'latitude': None, 'Longitude': None, 'subsurface favorability': 1.0, 'surface favorability': 1.0, 'geothermal gradient': 74.0, 'Surface
Temperature': 25.0, 'Depth to Basement': 4.7, 'Production Temperature': 150.0, 'Derisking Time': 1, 'Production Well Count': 5, 'Discount Rate': 9.0, 'Mass Flow Rate / Well': 50.0, 'Linear
Temperature Decline': 1.0, 'Sedimentary Drilling Cost Adjuster': 100.0, 'Basement Drilling Cost Multiplier': 1.2, 'Horizontal Well Length': 1000.0, 'Capital Expenditure Subsidy': 0.0, 'Annual
Fixed OPEX as % of Total CAPEX': 2.0, 'Wells and Plant Construction Time': 2, 'Power Plant Efficiency Increase Over Baseline': 0.0, 'Powe