{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/satoc/miniforge3/envs/gradio/lib/python3.12/site-packages/IPython/core/interactiveshell.py:3577: LangChainDeprecationWarning: As of langchain-core 0.3.0, LangChain uses pydantic v2 internally. The langchain_core.pydantic_v1 module was a compatibility shim for pydantic v1, and should no longer be used. Please update the code to import from Pydantic directly.\n", "\n", "For example, replace imports like: `from langchain_core.pydantic_v1 import BaseModel`\n", "with: `from pydantic import BaseModel`\n", "or the v1 compatibility namespace if you are working in a code base that has not been fully upgraded to pydantic 2 yet. \tfrom pydantic.v1 import BaseModel\n", "\n", " exec(code_obj, self.user_global_ns, self.user_ns)\n" ] } ], "source": [ "from langchain_community.agent_toolkits import create_sql_agent\n", "from langchain_openai import ChatOpenAI\n", "from langchain_groq import ChatGroq\n", "from langchain_core.prompts import ChatPromptTemplate\n", "from langchain_core.pydantic_v1 import BaseModel, Field\n", "import pandas as pd\n", "from pydantic import BaseModel, Field\n", "\n", "from langchain.text_splitter import RecursiveCharacterTextSplitter\n", "from langchain_community.vectorstores import Chroma\n", "from langchain.embeddings import HuggingFaceEmbeddings\n", "from langchain_core.runnables import RunnablePassthrough\n", "from langchain_core.output_parsers import StrOutputParser\n", "\n", "\n", "gpt = ChatOpenAI(model=\"gpt-3.5-turbo\", temperature=0)\n", "#agent_gpt_executor = create_sql_agent(gpt, db=db, agent_type=\"tool-calling\", verbose=True)\n", "\n", "## make database\n", "from langchain_community.utilities import SQLDatabase\n", "from sqlalchemy import create_engine\n", "\n", "from langchain.prompts import ChatPromptTemplate\n", "from langchain.schema import SystemMessage\n", "from langchain_core.prompts import MessagesPlaceholder\n", "#agent_groq_executor = create_sql_agent(llm, db=db, agent_type=\"tool-calling\", verbose=True)\n", "\n", "from OpenAITools.FetchTools import fetch_clinical_trials, fetch_clinical_trials_jp\n", "from OpenAITools.CrinicalTrialTools import QuestionModifierEnglish, TumorNameExtractor, SimpleClinicalTrialAgent,GraderAgent,LLMTranslator\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Define LLMS" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "gpt = ChatOpenAI(model=\"gpt-3.5-turbo\", temperature=0)\n", "#agent_gpt_executor = create_sql_agent(gpt, db=db, agent_type=\"tool-calling\", verbose=True)\n", "groq = ChatGroq(model_name=\"llama3-70b-8192\", temperature=0)\n", "#agent_groq_executor = create_sql_agent(groq, db=db, agent_type=\"tool-calling\", verbose=True)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "age = \"65\"\n", "sex =\"男性\"\n", "tumor_type =\"胃癌\"\n", "#tumor_type = \"gastric cancer\"\n", "GeneMutation =\"HER2\"\n", "Meseable = \"有り\"\n", "Biopsiable = \"有り\"\n", "NCTID = 'NCT06441994'\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "def generate_ex_question(age, sex, tumor_type, GeneMutation, Meseable, Biopsiable):\n", " # GeneMutationが空の場合はUnknownに設定\n", " gene_mutation_text = GeneMutation if GeneMutation else \"Unknown\"\n", " \n", " # MeseableとBiopsiableの値をYes, No, Unknownに変換\n", " meseable_text = (\n", " \"Yes\" if Meseable == \"有り\" else \"No\" if Meseable == \"無し\" else \"Unknown\"\n", " )\n", " biopsiable_text = (\n", " \"Yes\" if Biopsiable == \"有り\" else \"No\" if Biopsiable == \"無し\" else \"Unknown\"\n", " )\n", " \n", " # 質問文の生成\n", " ex_question = f\"\"\"{age}歳{sex}の{tumor_type}患者さんはこの治験に参加することができますか?\n", "判明している遺伝子変異: {gene_mutation_text}\n", "Meseable tumor: {meseable_text}\n", "Biopsiable tumor: {biopsiable_text}\n", "です。\n", "\"\"\"\n", " return ex_question" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "def generate_ex_question_English(age, sex, tumor_type, GeneMutation, Meseable, Biopsiable):\n", " # GeneMutationが空の場合は\"Unknown\"に設定\n", " gene_mutation_text = GeneMutation if GeneMutation else \"Unknown\"\n", " \n", " # sexの値を male または female に変換\n", " sex_text = \"male\" if sex == \"男性\" else \"female\" if sex == \"女性\" else \"Unknown\"\n", " \n", " # MeseableとBiopsiableの値を \"Yes\", \"No\", \"Unknown\" に変換\n", " meseable_text = (\n", " \"Yes\" if Meseable == \"有り\" else \"No\" if Meseable == \"無し\" else \"Unknown\"\n", " )\n", " biopsiable_text = (\n", " \"Yes\" if Biopsiable == \"有り\" else \"No\" if Biopsiable == \"無し\" else \"Unknown\"\n", " )\n", " \n", " # 英語での質問文を生成\n", " ex_question = f\"\"\"Can a {age}-year-old {sex_text} patient with {tumor_type} participate in this clinical trial?\n", "Known gene mutation: {gene_mutation_text}\n", "Measurable tumor: {meseable_text}\n", "Biopsiable tumor: {biopsiable_text}\n", "\"\"\"\n", " return ex_question\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Stomach cancer\n" ] } ], "source": [ "#Define extractor\n", "Translator = LLMTranslator(groq)\n", "TumorName = Translator.translate(tumor_type)\n", "print(TumorName)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "TumorName = \"gastric cancer\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Can a 65-year-old male patient with gastric cancer participate in this clinical trial?\\nKnown gene mutation: HER2\\nMeasurable tumor: Yes\\nBiopsiable tumor: Yes\\n'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ex_question = generate_ex_question_English(age, sex, TumorName, GeneMutation, Meseable, Biopsiable)\n", "ex_question" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ex_question = \"\"\"\"65歳男性の胃癌患者さんはこの治験に参加することができますか?\n", "判明している遺伝子変異:HER2\n", "Meseable tumor:Yes\n", "biopsiable tumor: Yes\n", "です。\n", "\"\"\"" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "#ex_question = \"65歳男性でが参加できる臨床治験を教えて下さい。\"" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "#ex_question = \"65歳男性でBRCA遺伝子の変異がある前立患者さんが参加できる臨床治験を教えて下さい。\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "modifierEnglish = QuestionModifierEnglish(groq)\n", "modifierEnglish.modify_question(ex_question)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Fetching data from: https://clinicaltrials.gov/api/v2/studies?query.titles=gastric cancer SEARCH[Location](AREA[LocationCountry]Japan AND AREA[LocationStatus]Recruiting)&pageSize=100\n" ] } ], "source": [ "#Make db\n", "df = fetch_clinical_trials(TumorName)\n", "# 新しい列を追加\n", "df['AgentJudgment'] = None\n", "df['AgentGrade'] = None\n", "#df = df.iloc[:5, :]\n", "NCTIDs = list(df['NCTID' ])\n" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NCTIDTitlePrimary Completion DateCancerSummaryJapanes LocationsEligibility CriteriaAgentJudgmentAgentGrade
0NCT03505320A Study of Zolbetuximab (IMAB362) in Adults Wi...2025-04-30Pharmacokinetics of Zolbetuximab, Gastric Canc...Zolbetuximab is being studied as a treatment f...Chiba, TokyoInclusion Criteria:\\n\\n* Female subject eligib...NoneNone
1NCT05002127A Study of Evorpacept (ALX148) in Patients wit...2026-07Gastric Cancer, Gastroesophageal Junction Aden...A Phase 2/3 Study of Evorpacept (ALX148) in Co...Chiba, Fukuoka, Gifu, Kumamoto, Kyoto, Nagasak...Inclusion Criteria:\\n\\n* HER2-overexpressing a...NoneNone
2NCT05365581A Study of ASP2138 Given by Itself or Given Wi...2026-10-31Gastric Adenocarcinoma, Gastroesophageal Junct...Claudin 18.2 protein, or CLDN18.2 is a protein...Kashiwa, Nagoya, Osakasayama, Suita, Yokohama, kuInclusion Criteria:\\n\\n* Participant is consid...NoneNone
3NCT05111626Bemarituzumab Plus Chemotherapy and Nivolumab ...2026-09-26Gastric Cancer, Gastroesophageal Junction Aden...The main objective of Part 1 is to evaluate th...Sapporo, gun, ku, shiInclusion Criteria Part 1 and Part 2:\\n\\n* Adu...NoneNone
4NCT06324357Beamion BCGC-1: A Study to Find a Suitable Dos...2027-02-22Metastatic Breast Cancer, Metastatic Gastric A...This study is open to adults aged 18 years and...ku, shiInclusion Criteria:\\n\\n* Signed and dated writ...NoneNone
5NCT06056024A Study to Test How Well Different Doses of BI...2027-05-26Solid Tumor, KRAS MutationThis study is open to adults with advanced can...Kashiwa, kuInclusion Criteria:\\n\\n1. Patients with pathol...NoneNone
6NCT04379596Ph1b/2 Study of the Safety and Efficacy of T-D...2026-07-30Gastric CancerDESTINY-Gastric03 will investigate the safety,...Kashiwa, gun, ku, shiInclusion criteria:\\n\\n1. Male and female part...NoneNone
7NCT00197470Cytokine Gene Polymorphisms in Gastric DiseasesUnknown DateGastric Ulcer, Duodenal Ulcer, Gastric CancerRecently, cytokine polymorphisms are considere...HamamatsuInclusion Criteria:\\n\\n-\\n\\nExclusion Criteria...NoneNone
8NCT05205343Trans-Pacific Multicenter Collaborative Study ...2026-05-31Gastrostomy, Gastric, GastroEsophageal CancerTo compare the symptoms of patients who have a...TokyoInclusion Criteria:\\n\\n1. Able to speak and re...NoneNone
9NCT06490055Predicting the Efficacy in Advanced Gastric Ca...2025-12-31Gastric Cancer, Chemotherapy Effect, Paclitaxe...With advances in chemotherapy for gastric canc...KurashikiInclusion Criteria:\\n\\n1. unresectable or recu...NoneNone
10NCT06490159Predicting Peripheral Neuropathy of Paclitaxel...2025-12-31Gastric Cancer, Chemotherapy-induced Periphera...Although advances in chemotherapy have improve...KurashikiInclusion Criteria:\\n\\n1. unresectable or recu...NoneNone
11NCT05438459GAIA-102 Intraperitoneal Administration in Pat...2026-12-31Gastric Cancer, Pancreatic CancerPhase I Part :\\n\\nConfirm the safety of GAIA-1...shiInclusion Criteria:\\n\\n1. Unresectable, advanc...NoneNone
12NCT04745988An Open Label Phase 2 Study to Evaluate the Sa...2025-08Gastric CancerThis study is an open label phase 2 study to e...KashiwaInclusion Criteria:\\n\\n1. Have gastric and gas...NoneNone
13NCT06038578A Study of TRK-950 When Used in Combination Wi...2025-08-31Gastric Adenocarcinoma, Gastric Cancer, Gastro...This study will assess the efficacy, safety, o...Chuo Ku, Kashiwa, KuInclusion Criteria:\\n\\n* Histologically or cyt...NoneNone
14NCT05322577A Study Evaluating Bemarituzumab in Combinatio...2026-03-17Gastric Cancer, Gastroesophageal Junction CancerThe main objectives of this study are to evalu...Shi, gun, ku, shiInclusion Criteria:\\n\\n* Adults with unresecta...NoneNone
15NCT05152147A Study of Zanidatamab in Combination With Che...2024-12-31Gastric Neoplasms, Gastroesophageal Adenocarci...This study is being done to find out if zanida...Cho, Chuo Ku, Hirakata, Ina, Ku, Matsuyama, Na...Inclusion Criteria:\\n\\n* Histologically confir...NoneNone
\n", "
" ], "text/plain": [ " NCTID Title \\\n", "0 NCT03505320 A Study of Zolbetuximab (IMAB362) in Adults Wi... \n", "1 NCT05002127 A Study of Evorpacept (ALX148) in Patients wit... \n", "2 NCT05365581 A Study of ASP2138 Given by Itself or Given Wi... \n", "3 NCT05111626 Bemarituzumab Plus Chemotherapy and Nivolumab ... \n", "4 NCT06324357 Beamion BCGC-1: A Study to Find a Suitable Dos... \n", "5 NCT06056024 A Study to Test How Well Different Doses of BI... \n", "6 NCT04379596 Ph1b/2 Study of the Safety and Efficacy of T-D... \n", "7 NCT00197470 Cytokine Gene Polymorphisms in Gastric Diseases \n", "8 NCT05205343 Trans-Pacific Multicenter Collaborative Study ... \n", "9 NCT06490055 Predicting the Efficacy in Advanced Gastric Ca... \n", "10 NCT06490159 Predicting Peripheral Neuropathy of Paclitaxel... \n", "11 NCT05438459 GAIA-102 Intraperitoneal Administration in Pat... \n", "12 NCT04745988 An Open Label Phase 2 Study to Evaluate the Sa... \n", "13 NCT06038578 A Study of TRK-950 When Used in Combination Wi... \n", "14 NCT05322577 A Study Evaluating Bemarituzumab in Combinatio... \n", "15 NCT05152147 A Study of Zanidatamab in Combination With Che... \n", "\n", " Primary Completion Date Cancer \\\n", "0 2025-04-30 Pharmacokinetics of Zolbetuximab, Gastric Canc... \n", "1 2026-07 Gastric Cancer, Gastroesophageal Junction Aden... \n", "2 2026-10-31 Gastric Adenocarcinoma, Gastroesophageal Junct... \n", "3 2026-09-26 Gastric Cancer, Gastroesophageal Junction Aden... \n", "4 2027-02-22 Metastatic Breast Cancer, Metastatic Gastric A... \n", "5 2027-05-26 Solid Tumor, KRAS Mutation \n", "6 2026-07-30 Gastric Cancer \n", "7 Unknown Date Gastric Ulcer, Duodenal Ulcer, Gastric Cancer \n", "8 2026-05-31 Gastrostomy, Gastric, GastroEsophageal Cancer \n", "9 2025-12-31 Gastric Cancer, Chemotherapy Effect, Paclitaxe... \n", "10 2025-12-31 Gastric Cancer, Chemotherapy-induced Periphera... \n", "11 2026-12-31 Gastric Cancer, Pancreatic Cancer \n", "12 2025-08 Gastric Cancer \n", "13 2025-08-31 Gastric Adenocarcinoma, Gastric Cancer, Gastro... \n", "14 2026-03-17 Gastric Cancer, Gastroesophageal Junction Cancer \n", "15 2024-12-31 Gastric Neoplasms, Gastroesophageal Adenocarci... \n", "\n", " Summary \\\n", "0 Zolbetuximab is being studied as a treatment f... \n", "1 A Phase 2/3 Study of Evorpacept (ALX148) in Co... \n", "2 Claudin 18.2 protein, or CLDN18.2 is a protein... \n", "3 The main objective of Part 1 is to evaluate th... \n", "4 This study is open to adults aged 18 years and... \n", "5 This study is open to adults with advanced can... \n", "6 DESTINY-Gastric03 will investigate the safety,... \n", "7 Recently, cytokine polymorphisms are considere... \n", "8 To compare the symptoms of patients who have a... \n", "9 With advances in chemotherapy for gastric canc... \n", "10 Although advances in chemotherapy have improve... \n", "11 Phase I Part :\\n\\nConfirm the safety of GAIA-1... \n", "12 This study is an open label phase 2 study to e... \n", "13 This study will assess the efficacy, safety, o... \n", "14 The main objectives of this study are to evalu... \n", "15 This study is being done to find out if zanida... \n", "\n", " Japanes Locations \\\n", "0 Chiba, Tokyo \n", "1 Chiba, Fukuoka, Gifu, Kumamoto, Kyoto, Nagasak... \n", "2 Kashiwa, Nagoya, Osakasayama, Suita, Yokohama, ku \n", "3 Sapporo, gun, ku, shi \n", "4 ku, shi \n", "5 Kashiwa, ku \n", "6 Kashiwa, gun, ku, shi \n", "7 Hamamatsu \n", "8 Tokyo \n", "9 Kurashiki \n", "10 Kurashiki \n", "11 shi \n", "12 Kashiwa \n", "13 Chuo Ku, Kashiwa, Ku \n", "14 Shi, gun, ku, shi \n", "15 Cho, Chuo Ku, Hirakata, Ina, Ku, Matsuyama, Na... \n", "\n", " Eligibility Criteria AgentJudgment AgentGrade \n", "0 Inclusion Criteria:\\n\\n* Female subject eligib... None None \n", "1 Inclusion Criteria:\\n\\n* HER2-overexpressing a... None None \n", "2 Inclusion Criteria:\\n\\n* Participant is consid... None None \n", "3 Inclusion Criteria Part 1 and Part 2:\\n\\n* Adu... None None \n", "4 Inclusion Criteria:\\n\\n* Signed and dated writ... None None \n", "5 Inclusion Criteria:\\n\\n1. Patients with pathol... None None \n", "6 Inclusion criteria:\\n\\n1. Male and female part... None None \n", "7 Inclusion Criteria:\\n\\n-\\n\\nExclusion Criteria... None None \n", "8 Inclusion Criteria:\\n\\n1. Able to speak and re... None None \n", "9 Inclusion Criteria:\\n\\n1. unresectable or recu... None None \n", "10 Inclusion Criteria:\\n\\n1. unresectable or recu... None None \n", "11 Inclusion Criteria:\\n\\n1. Unresectable, advanc... None None \n", "12 Inclusion Criteria:\\n\\n1. Have gastric and gas... None None \n", "13 Inclusion Criteria:\\n\\n* Histologically or cyt... None None \n", "14 Inclusion Criteria:\\n\\n* Adults with unresecta... None None \n", "15 Inclusion Criteria:\\n\\n* Histologically confir... None None " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "\n", "#Define agents\n", "#modifier = QuestionModifierEnglish(groq)\n", "CriteriaCheckAgent = SimpleClinicalTrialAgent(groq)\n", "grader_agent = GraderAgent(groq)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The patient is not eligible for this clinical trial because the inclusion criteria specify that female subjects are eligible, and the patient is a 65-year-old male.\n", "no\n", "The patient is eligible for this clinical trial based on the provided information, as he has a measurable and biopsiable tumor with a known HER2 gene mutation, which meets the inclusion criteria. However, I do not know if he has progressed on or after a prior HER2-directed agent and fluoropyrimidine- or platinum-containing chemotherapy, which is also required for inclusion.\n", "unclear\n", "The patient is eligible for this clinical trial based on the provided criteria. The patient meets the inclusion criteria, including having a measurable tumor, being at least 18 years old, and having a predicted life expectancy of at least 12 weeks. The patient also has histologically confirmed gastric/gastroesophageal junction (GEJ) adenocarcinoma, which is one of the specified disease types for this trial. Additionally, the patient has a HER2-positive tumor, which is not an exclusion criterion for this trial.\n", "yes\n", "The patient is eligible for this clinical trial based on the provided criteria, as they meet the inclusion criteria for age, measurable tumor, and biopsiable tumor. However, the patient's HER2 status is known to be positive, which is an exclusion criterion. Therefore, the patient is not eligible for this clinical trial.\n", "no\n", "The patient is not eligible for this clinical trial because the trial is for metastatic breast cancer (mBC) or metastatic gastric adenocarcinoma, gastroesophageal junction adenocarcinoma, or esophageal adenocarcinoma (mGEAC), and the patient has gastric cancer, which is not specified as an eligible type of cancer.\n", "no\n", "The patient is not eligible for this clinical trial because the trial requires a KRAS wild type (wt) amplification or a KRAS G12V mutation, but the patient has a HER2 gene mutation.\n", "no\n", "The patient is eligible for this clinical trial based on the provided criteria, as they meet the inclusion criteria (age, disease characteristics, measurable tumor, and HER2-positive status) and do not have any of the exclusion criteria mentioned.\n", "yes\n", "I do not know if the patient is eligible for this clinical trial because the criteria do not mention age or specific types of cancer, and there is no information about H. pylori status in the patient.\n", "unclear\n", "The patient is eligible for this clinical trial based on the provided criteria, as he has a biopsy-confirmed diagnosis of gastric cancer, is 65 years old (meeting the age criterion), and there is no mention of any exclusion criteria being met.\n", "yes\n", "The patient is eligible for this clinical trial based on the provided information, as he meets the inclusion criteria (age, measurable tumor, biopsiable tumor, and gastric cancer diagnosis) and does not appear to meet any of the exclusion criteria.\n", "yes\n", "The patient is eligible for this clinical trial based on the provided criteria, as they meet the inclusion criteria (age, measurable tumor, biopsiable tumor, and gastric cancer diagnosis) and do not have any of the listed exclusion criteria.\n", "yes\n", "Based on the provided criteria, the 65-year-old male patient with gastric cancer and a known HER2 gene mutation appears to be eligible for this clinical trial, as he meets the inclusion criteria (e.g., unresectable advanced gastric cancer, measurable tumor, biopsiable tumor, etc.) and does not have any obvious exclusion criteria mentioned. However, I would need to review the patient's full medical history and current condition to confirm eligibility.\n", "unclear\n", "The patient is eligible for this clinical trial based on the provided criteria, as they meet the inclusion criteria (gastric cancer, measurable tumor, biopsiable tumor, age ≥ 20, etc.) and do not have any of the exclusion criteria mentioned.\n", "yes\n", "The patient is not eligible for this clinical trial because the patient has a known HER2 gene mutation, and the exclusion criteria specify that patients with HER2 positive gastric or GEJ adenocarcinoma are not eligible.\n", "no\n", "The patient is not eligible for this clinical trial because they have a known HER2 gene mutation, which is an exclusion criterion.\n", "no\n", "Based on the provided information, the 65-year-old male patient with gastric cancer and a known HER2 gene mutation appears to be eligible for this clinical trial, as he meets the inclusion criteria of having measurable tumor and biopsiable tumor, and there is no mention of any exclusion criteria that would disqualify him.\n", "yes\n" ] } ], "source": [ "for nct_id in NCTIDs:\n", " TargetCriteria = df.loc[df['NCTID'] == nct_id, 'Eligibility Criteria'].values[0]\n", " AgentJudgment = CriteriaCheckAgent.evaluate_eligibility(TargetCriteria, ex_question)\n", " print(AgentJudgment)\n", "\n", " AgentGrade = grader_agent.evaluate_eligibility(AgentJudgment)\n", " print(AgentGrade)\n", " # NCTIDに一致する行を見つけて更新\n", " df.loc[df['NCTID'] == nct_id, 'AgentJudgment'] = AgentJudgment\n", " df.loc[df['NCTID'] == nct_id, 'AgentGrade'] = AgentGrade\n" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
NCTIDTitlePrimary Completion DateCancerSummaryJapanes LocationsEligibility CriteriaAgentJudgmentAgentGrade
0NCT03505320A Study of Zolbetuximab (IMAB362) in Adults Wi...2025-04-30Pharmacokinetics of Zolbetuximab, Gastric Canc...Zolbetuximab is being studied as a treatment f...Chiba, TokyoInclusion Criteria:\\n\\n* Female subject eligib...The patient is not eligible for this clinical ...no
1NCT05002127A Study of Evorpacept (ALX148) in Patients wit...2026-07Gastric Cancer, Gastroesophageal Junction Aden...A Phase 2/3 Study of Evorpacept (ALX148) in Co...Chiba, Fukuoka, Gifu, Kumamoto, Kyoto, Nagasak...Inclusion Criteria:\\n\\n* HER2-overexpressing a...The patient is eligible for this clinical tria...unclear
2NCT05365581A Study of ASP2138 Given by Itself or Given Wi...2026-10-31Gastric Adenocarcinoma, Gastroesophageal Junct...Claudin 18.2 protein, or CLDN18.2 is a protein...Kashiwa, Nagoya, Osakasayama, Suita, Yokohama, kuInclusion Criteria:\\n\\n* Participant is consid...The patient is eligible for this clinical tria...yes
3NCT05111626Bemarituzumab Plus Chemotherapy and Nivolumab ...2026-09-26Gastric Cancer, Gastroesophageal Junction Aden...The main objective of Part 1 is to evaluate th...Sapporo, gun, ku, shiInclusion Criteria Part 1 and Part 2:\\n\\n* Adu...The patient is eligible for this clinical tria...no
4NCT06324357Beamion BCGC-1: A Study to Find a Suitable Dos...2027-02-22Metastatic Breast Cancer, Metastatic Gastric A...This study is open to adults aged 18 years and...ku, shiInclusion Criteria:\\n\\n* Signed and dated writ...The patient is not eligible for this clinical ...no
5NCT06056024A Study to Test How Well Different Doses of BI...2027-05-26Solid Tumor, KRAS MutationThis study is open to adults with advanced can...Kashiwa, kuInclusion Criteria:\\n\\n1. Patients with pathol...The patient is not eligible for this clinical ...no
6NCT04379596Ph1b/2 Study of the Safety and Efficacy of T-D...2026-07-30Gastric CancerDESTINY-Gastric03 will investigate the safety,...Kashiwa, gun, ku, shiInclusion criteria:\\n\\n1. Male and female part...The patient is eligible for this clinical tria...yes
7NCT00197470Cytokine Gene Polymorphisms in Gastric DiseasesUnknown DateGastric Ulcer, Duodenal Ulcer, Gastric CancerRecently, cytokine polymorphisms are considere...HamamatsuInclusion Criteria:\\n\\n-\\n\\nExclusion Criteria...I do not know if the patient is eligible for t...unclear
8NCT05205343Trans-Pacific Multicenter Collaborative Study ...2026-05-31Gastrostomy, Gastric, GastroEsophageal CancerTo compare the symptoms of patients who have a...TokyoInclusion Criteria:\\n\\n1. Able to speak and re...The patient is eligible for this clinical tria...yes
9NCT06490055Predicting the Efficacy in Advanced Gastric Ca...2025-12-31Gastric Cancer, Chemotherapy Effect, Paclitaxe...With advances in chemotherapy for gastric canc...KurashikiInclusion Criteria:\\n\\n1. unresectable or recu...The patient is eligible for this clinical tria...yes
10NCT06490159Predicting Peripheral Neuropathy of Paclitaxel...2025-12-31Gastric Cancer, Chemotherapy-induced Periphera...Although advances in chemotherapy have improve...KurashikiInclusion Criteria:\\n\\n1. unresectable or recu...The patient is eligible for this clinical tria...yes
11NCT05438459GAIA-102 Intraperitoneal Administration in Pat...2026-12-31Gastric Cancer, Pancreatic CancerPhase I Part :\\n\\nConfirm the safety of GAIA-1...shiInclusion Criteria:\\n\\n1. Unresectable, advanc...Based on the provided criteria, the 65-year-ol...unclear
12NCT04745988An Open Label Phase 2 Study to Evaluate the Sa...2025-08Gastric CancerThis study is an open label phase 2 study to e...KashiwaInclusion Criteria:\\n\\n1. Have gastric and gas...The patient is eligible for this clinical tria...yes
13NCT06038578A Study of TRK-950 When Used in Combination Wi...2025-08-31Gastric Adenocarcinoma, Gastric Cancer, Gastro...This study will assess the efficacy, safety, o...Chuo Ku, Kashiwa, KuInclusion Criteria:\\n\\n* Histologically or cyt...The patient is not eligible for this clinical ...no
14NCT05322577A Study Evaluating Bemarituzumab in Combinatio...2026-03-17Gastric Cancer, Gastroesophageal Junction CancerThe main objectives of this study are to evalu...Shi, gun, ku, shiInclusion Criteria:\\n\\n* Adults with unresecta...The patient is not eligible for this clinical ...no
15NCT05152147A Study of Zanidatamab in Combination With Che...2024-12-31Gastric Neoplasms, Gastroesophageal Adenocarci...This study is being done to find out if zanida...Cho, Chuo Ku, Hirakata, Ina, Ku, Matsuyama, Na...Inclusion Criteria:\\n\\n* Histologically confir...Based on the provided information, the 65-year...yes
\n", "
" ], "text/plain": [ " NCTID Title \\\n", "0 NCT03505320 A Study of Zolbetuximab (IMAB362) in Adults Wi... \n", "1 NCT05002127 A Study of Evorpacept (ALX148) in Patients wit... \n", "2 NCT05365581 A Study of ASP2138 Given by Itself or Given Wi... \n", "3 NCT05111626 Bemarituzumab Plus Chemotherapy and Nivolumab ... \n", "4 NCT06324357 Beamion BCGC-1: A Study to Find a Suitable Dos... \n", "5 NCT06056024 A Study to Test How Well Different Doses of BI... \n", "6 NCT04379596 Ph1b/2 Study of the Safety and Efficacy of T-D... \n", "7 NCT00197470 Cytokine Gene Polymorphisms in Gastric Diseases \n", "8 NCT05205343 Trans-Pacific Multicenter Collaborative Study ... \n", "9 NCT06490055 Predicting the Efficacy in Advanced Gastric Ca... \n", "10 NCT06490159 Predicting Peripheral Neuropathy of Paclitaxel... \n", "11 NCT05438459 GAIA-102 Intraperitoneal Administration in Pat... \n", "12 NCT04745988 An Open Label Phase 2 Study to Evaluate the Sa... \n", "13 NCT06038578 A Study of TRK-950 When Used in Combination Wi... \n", "14 NCT05322577 A Study Evaluating Bemarituzumab in Combinatio... \n", "15 NCT05152147 A Study of Zanidatamab in Combination With Che... \n", "\n", " Primary Completion Date Cancer \\\n", "0 2025-04-30 Pharmacokinetics of Zolbetuximab, Gastric Canc... \n", "1 2026-07 Gastric Cancer, Gastroesophageal Junction Aden... \n", "2 2026-10-31 Gastric Adenocarcinoma, Gastroesophageal Junct... \n", "3 2026-09-26 Gastric Cancer, Gastroesophageal Junction Aden... \n", "4 2027-02-22 Metastatic Breast Cancer, Metastatic Gastric A... \n", "5 2027-05-26 Solid Tumor, KRAS Mutation \n", "6 2026-07-30 Gastric Cancer \n", "7 Unknown Date Gastric Ulcer, Duodenal Ulcer, Gastric Cancer \n", "8 2026-05-31 Gastrostomy, Gastric, GastroEsophageal Cancer \n", "9 2025-12-31 Gastric Cancer, Chemotherapy Effect, Paclitaxe... \n", "10 2025-12-31 Gastric Cancer, Chemotherapy-induced Periphera... \n", "11 2026-12-31 Gastric Cancer, Pancreatic Cancer \n", "12 2025-08 Gastric Cancer \n", "13 2025-08-31 Gastric Adenocarcinoma, Gastric Cancer, Gastro... \n", "14 2026-03-17 Gastric Cancer, Gastroesophageal Junction Cancer \n", "15 2024-12-31 Gastric Neoplasms, Gastroesophageal Adenocarci... \n", "\n", " Summary \\\n", "0 Zolbetuximab is being studied as a treatment f... \n", "1 A Phase 2/3 Study of Evorpacept (ALX148) in Co... \n", "2 Claudin 18.2 protein, or CLDN18.2 is a protein... \n", "3 The main objective of Part 1 is to evaluate th... \n", "4 This study is open to adults aged 18 years and... \n", "5 This study is open to adults with advanced can... \n", "6 DESTINY-Gastric03 will investigate the safety,... \n", "7 Recently, cytokine polymorphisms are considere... \n", "8 To compare the symptoms of patients who have a... \n", "9 With advances in chemotherapy for gastric canc... \n", "10 Although advances in chemotherapy have improve... \n", "11 Phase I Part :\\n\\nConfirm the safety of GAIA-1... \n", "12 This study is an open label phase 2 study to e... \n", "13 This study will assess the efficacy, safety, o... \n", "14 The main objectives of this study are to evalu... \n", "15 This study is being done to find out if zanida... \n", "\n", " Japanes Locations \\\n", "0 Chiba, Tokyo \n", "1 Chiba, Fukuoka, Gifu, Kumamoto, Kyoto, Nagasak... \n", "2 Kashiwa, Nagoya, Osakasayama, Suita, Yokohama, ku \n", "3 Sapporo, gun, ku, shi \n", "4 ku, shi \n", "5 Kashiwa, ku \n", "6 Kashiwa, gun, ku, shi \n", "7 Hamamatsu \n", "8 Tokyo \n", "9 Kurashiki \n", "10 Kurashiki \n", "11 shi \n", "12 Kashiwa \n", "13 Chuo Ku, Kashiwa, Ku \n", "14 Shi, gun, ku, shi \n", "15 Cho, Chuo Ku, Hirakata, Ina, Ku, Matsuyama, Na... \n", "\n", " Eligibility Criteria \\\n", "0 Inclusion Criteria:\\n\\n* Female subject eligib... \n", "1 Inclusion Criteria:\\n\\n* HER2-overexpressing a... \n", "2 Inclusion Criteria:\\n\\n* Participant is consid... \n", "3 Inclusion Criteria Part 1 and Part 2:\\n\\n* Adu... \n", "4 Inclusion Criteria:\\n\\n* Signed and dated writ... \n", "5 Inclusion Criteria:\\n\\n1. Patients with pathol... \n", "6 Inclusion criteria:\\n\\n1. Male and female part... \n", "7 Inclusion Criteria:\\n\\n-\\n\\nExclusion Criteria... \n", "8 Inclusion Criteria:\\n\\n1. Able to speak and re... \n", "9 Inclusion Criteria:\\n\\n1. unresectable or recu... \n", "10 Inclusion Criteria:\\n\\n1. unresectable or recu... \n", "11 Inclusion Criteria:\\n\\n1. Unresectable, advanc... \n", "12 Inclusion Criteria:\\n\\n1. Have gastric and gas... \n", "13 Inclusion Criteria:\\n\\n* Histologically or cyt... \n", "14 Inclusion Criteria:\\n\\n* Adults with unresecta... \n", "15 Inclusion Criteria:\\n\\n* Histologically confir... \n", "\n", " AgentJudgment AgentGrade \n", "0 The patient is not eligible for this clinical ... no \n", "1 The patient is eligible for this clinical tria... unclear \n", "2 The patient is eligible for this clinical tria... yes \n", "3 The patient is eligible for this clinical tria... no \n", "4 The patient is not eligible for this clinical ... no \n", "5 The patient is not eligible for this clinical ... no \n", "6 The patient is eligible for this clinical tria... yes \n", "7 I do not know if the patient is eligible for t... unclear \n", "8 The patient is eligible for this clinical tria... yes \n", "9 The patient is eligible for this clinical tria... yes \n", "10 The patient is eligible for this clinical tria... yes \n", "11 Based on the provided criteria, the 65-year-ol... unclear \n", "12 The patient is eligible for this clinical tria... yes \n", "13 The patient is not eligible for this clinical ... no \n", "14 The patient is not eligible for this clinical ... no \n", "15 Based on the provided information, the 65-year... yes " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "df.to_csv('./65yerProstateCancer.csv')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "gradio", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }