File size: 72,139 Bytes
9754890
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/satoc/miniforge3/envs/gradio/lib/python3.12/site-packages/transformers/tokenization_utils_base.py:1617: FutureWarning: `clean_up_tokenization_spaces` was not set. It will be set to `True` by default. This behavior will be deprecated in transformers v4.45, and will be then set to `False` by default. For more details check this issue: https://github.com/huggingface/transformers/issues/31884\n",
      "  warnings.warn(\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,generate_ex_question_English\n",
    "\n",
    "from OpenAITools.JRCTTools import get_matched_df\n",
    "from sentence_transformers import SentenceTransformer\n",
    "from sentence_transformers import util\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)\n",
    "\n",
    "import ast\n",
    "import torch\n",
    "age = \"65\"\n",
    "sex =\"男性\"\n",
    "tumor_type =\"glioma\"\n",
    "#tumor_type = \"gastric cancer\"\n",
    "GeneMutation =\"HER2\"\n",
    "Meseable = \"有り\"\n",
    "Biopsiable = \"有り\"\n",
    "NCTID = 'NCT06441994'\n",
    "\n",
    "#Define extractor\n",
    "Translator = LLMTranslator(groq)\n",
    "TumorName = Translator.translate(tumor_type)\n",
    "selectionModel =  SentenceTransformer('pritamdeka/S-PubMedBert-MS-MARCO')\n",
    "ex_question = generate_ex_question_English(age, sex, TumorName, GeneMutation, Meseable, Biopsiable)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "basedf = pd.read_csv(\"../ClinicalTrialCSV/JRCT20241215CancerPost.csv\", index_col=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/var/folders/yw/qz00x75d7kb98f7vm8dkhkvw0000gn/T/ipykernel_49357/2492212482.py:2: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['AgentJudgment'] = None\n",
      "/var/folders/yw/qz00x75d7kb98f7vm8dkhkvw0000gn/T/ipykernel_49357/2492212482.py:3: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['AgentGrade'] = None\n"
     ]
    }
   ],
   "source": [
    "df = get_matched_df(basedf=basedf, query=TumorName, model=selectionModel, threshold=0.925)\n",
    "df['AgentJudgment'] = None\n",
    "df['AgentGrade'] = None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>JRCT ID</th>\n",
       "      <th>NCT No</th>\n",
       "      <th>JapicCTI No</th>\n",
       "      <th>Title</th>\n",
       "      <th>TargetJ</th>\n",
       "      <th>Target</th>\n",
       "      <th>TargetEnglish</th>\n",
       "      <th>研究・治験の目的</th>\n",
       "      <th>試験等のフェーズ</th>\n",
       "      <th>試験の種類</th>\n",
       "      <th>...</th>\n",
       "      <th>Age Minimum</th>\n",
       "      <th>Age Maximum</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Discontinuation Criteria</th>\n",
       "      <th>Keyword</th>\n",
       "      <th>Intervention(s)</th>\n",
       "      <th>TargetWord</th>\n",
       "      <th>TargetVec</th>\n",
       "      <th>AgentJudgment</th>\n",
       "      <th>AgentGrade</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>jRCT2051240121</td>\n",
       "      <td>NCT06413706</td>\n",
       "      <td>NaN</td>\n",
       "      <td>放射線療法後の悪性神経膠腫の小児および若年成人を対象に、アベマシクリブ+テモゾロミドとテモゾ...</td>\n",
       "      <td>悪性神経膠腫</td>\n",
       "      <td>悪性神経膠腫</td>\n",
       "      <td>High-Grade Glioma</td>\n",
       "      <td>放射線療法後の悪性神経膠腫を有する小児および若年成人を対象に、アベマシクリブとテモゾロミドの...</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>No limit</td>\n",
       "      <td>21age old not</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Drug: Abemaciclib Administered orally Other Na...</td>\n",
       "      <td>['High-Grade Glioma']</td>\n",
       "      <td>[[-0.12244764715433121, -0.5778073668479919, -...</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>175</th>\n",
       "      <td>jRCT2031240090</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>再発悪性神経膠腫に対する治療用放射性薬剤64Cu-ATSMの有効性を検証するランダム化比較医...</td>\n",
       "      <td>悪性神経膠腫</td>\n",
       "      <td>悪性神経膠腫</td>\n",
       "      <td>Malignant glioma</td>\n",
       "      <td>再発・難治性悪性神経膠腫を対象として、64Cu-diacetyl-bis(N4-methyl...</td>\n",
       "      <td>3</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>75age old under</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>glioblastoma, grade3/4 astrocytoma, grade3 oli...</td>\n",
       "      <td>Group A: BPC Therapy Depending on the patient'...</td>\n",
       "      <td>['Malignant Glioma']</td>\n",
       "      <td>[[-0.33767956495285034, -0.4648125171661377, -...</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>263</th>\n",
       "      <td>jRCT2041230136</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>再発膠芽腫に対するTUG1を標的とした核酸医薬医師主導第I相試験</td>\n",
       "      <td>再発膠芽腫</td>\n",
       "      <td>再発膠芽腫</td>\n",
       "      <td>recurrent glioblastoma</td>\n",
       "      <td>再発膠芽腫患者を対象としてTUG1ASOを投与した場合の投与時の安全性を検討し、至適投与量を...</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>75age old under</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Dosing frequency: 1 time /week Dose Levels Lev...</td>\n",
       "      <td>['Recurrent', 'Glioblastoma']</td>\n",
       "      <td>[[-0.27501848340034485, -0.5264514088630676, -...</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>361</th>\n",
       "      <td>jRCT2051230069</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>神経膠腫患者に対するロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併⽤療法の安全...</td>\n",
       "      <td>神経膠腫</td>\n",
       "      <td>神経膠腫</td>\n",
       "      <td>Glioma</td>\n",
       "      <td>神経膠腫患者におけるロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併用療法の安全...</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>No limit</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>&lt;cohort1&gt; Lomustine 130 mg/m2 orally every 6 w...</td>\n",
       "      <td>['Glioma']</td>\n",
       "      <td>[[-0.21631155908107758, -0.5687925219535828, -...</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>414</th>\n",
       "      <td>jRCT2031230007</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>BRAF融合遺伝子陽性の進行・再発の低悪性度神経膠腫または膵癌に対するビニメチニブの第Ⅱ相医...</td>\n",
       "      <td>低悪性度神経膠腫、膵癌</td>\n",
       "      <td>低悪性度神経膠腫、膵癌</td>\n",
       "      <td>Low-grade glioma, pancreatic cancer</td>\n",
       "      <td>BRAF融合遺伝子または遺伝子再構成陽性の切除不能または再発の低悪性度神経膠腫(コホート A...</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>12age old over</td>\n",
       "      <td>No limit</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>BRAF fusion gene, BRAF rearrangement, low-grad...</td>\n",
       "      <td>Binimetinib is administered 45 mg orally, twic...</td>\n",
       "      <td>['Low-Grade Glioma', 'Pancreatic Cancer']</td>\n",
       "      <td>[[-0.18604964017868042, -0.547483503818512, -0...</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>636</th>\n",
       "      <td>jRCT2031210299</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>再発悪性神経膠腫患者を対象としたDSP-0390の第1相試験</td>\n",
       "      <td>再発悪性神経膠腫</td>\n",
       "      <td>再発悪性神経膠腫</td>\n",
       "      <td>Recurrent High-Grade Glioma</td>\n",
       "      <td>再発悪性神経膠腫患者を対象にDSP-0390を経口投与したときの安全性、薬物動態、薬力学及び...</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>No limit</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Patients will receive DSP-0390 orally once dai...</td>\n",
       "      <td>['Recurrent', 'High-Grade Glioma']</td>\n",
       "      <td>[[-0.2750183045864105, -0.5264511704444885, -0...</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>712</th>\n",
       "      <td>jRCT2031200153</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Cellm-001による初発膠芽腫治療効果無作為比較対照試験</td>\n",
       "      <td>膠芽腫</td>\n",
       "      <td>膠芽腫</td>\n",
       "      <td>glioblastoma</td>\n",
       "      <td>脳腫瘍のうち、初発悪性膠芽腫に対する自家脳腫瘍免疫賦活剤であるCellm-001について、術...</td>\n",
       "      <td>3</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>75age old under</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Inject the investigational drug (Cellm-001 or ...</td>\n",
       "      <td>['Glioblastoma']</td>\n",
       "      <td>[[-0.15113382041454315, -0.5002245306968689, -...</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7 rows × 43 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            JRCT ID       NCT No JapicCTI No  \\\n",
       "82   jRCT2051240121  NCT06413706         NaN   \n",
       "175  jRCT2031240090          NaN         NaN   \n",
       "263  jRCT2041230136          NaN         NaN   \n",
       "361  jRCT2051230069          NaN         NaN   \n",
       "414  jRCT2031230007          NaN         NaN   \n",
       "636  jRCT2031210299          NaN         NaN   \n",
       "712  jRCT2031200153          NaN         NaN   \n",
       "\n",
       "                                                 Title      TargetJ  \\\n",
       "82   放射線療法後の悪性神経膠腫の小児および若年成人を対象に、アベマシクリブ+テモゾロミドとテモゾ...       悪性神経膠腫   \n",
       "175  再発悪性神経膠腫に対する治療用放射性薬剤64Cu-ATSMの有効性を検証するランダム化比較医...       悪性神経膠腫   \n",
       "263                   再発膠芽腫に対するTUG1を標的とした核酸医薬医師主導第I相試験        再発膠芽腫   \n",
       "361  神経膠腫患者に対するロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併⽤療法の安全...         神経膠腫   \n",
       "414  BRAF融合遺伝子陽性の進行・再発の低悪性度神経膠腫または膵癌に対するビニメチニブの第Ⅱ相医...  低悪性度神経膠腫、膵癌   \n",
       "636                     再発悪性神経膠腫患者を対象としたDSP-0390の第1相試験     再発悪性神経膠腫   \n",
       "712                     Cellm-001による初発膠芽腫治療効果無作為比較対照試験          膠芽腫   \n",
       "\n",
       "          Target                        TargetEnglish  \\\n",
       "82        悪性神経膠腫                    High-Grade Glioma   \n",
       "175       悪性神経膠腫                     Malignant glioma   \n",
       "263        再発膠芽腫               recurrent glioblastoma   \n",
       "361         神経膠腫                               Glioma   \n",
       "414  低悪性度神経膠腫、膵癌  Low-grade glioma, pancreatic cancer   \n",
       "636     再発悪性神経膠腫          Recurrent High-Grade Glioma   \n",
       "712          膠芽腫                         glioblastoma   \n",
       "\n",
       "                                              研究・治験の目的 試験等のフェーズ  試験の種類  ...  \\\n",
       "82   放射線療法後の悪性神経膠腫を有する小児および若年成人を対象に、アベマシクリブとテモゾロミドの...        2    NaN  ...   \n",
       "175  再発・難治性悪性神経膠腫を対象として、64Cu-diacetyl-bis(N4-methyl...        3    NaN  ...   \n",
       "263  再発膠芽腫患者を対象としてTUG1ASOを投与した場合の投与時の安全性を検討し、至適投与量を...        1    NaN  ...   \n",
       "361  神経膠腫患者におけるロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併用療法の安全...        1    NaN  ...   \n",
       "414  BRAF融合遺伝子または遺伝子再構成陽性の切除不能または再発の低悪性度神経膠腫(コホート A...        2    NaN  ...   \n",
       "636  再発悪性神経膠腫患者を対象にDSP-0390を経口投与したときの安全性、薬物動態、薬力学及び...        1    NaN  ...   \n",
       "712  脳腫瘍のうち、初発悪性膠芽腫に対する自家脳腫瘍免疫賦活剤であるCellm-001について、術...        3    NaN  ...   \n",
       "\n",
       "        Age Minimum      Age Maximum Gender Discontinuation Criteria  \\\n",
       "82         No limit    21age old not    NaN                      NaN   \n",
       "175  18age old over  75age old under   Both                      NaN   \n",
       "263  18age old over  75age old under   Both                      NaN   \n",
       "361  18age old over         No limit   Both                      NaN   \n",
       "414  12age old over         No limit   Both                      NaN   \n",
       "636  18age old over         No limit   Both                      NaN   \n",
       "712  18age old over  75age old under   Both                      NaN   \n",
       "\n",
       "                                               Keyword  \\\n",
       "82                                                 NaN   \n",
       "175  glioblastoma, grade3/4 astrocytoma, grade3 oli...   \n",
       "263                                                NaN   \n",
       "361                                                NaN   \n",
       "414  BRAF fusion gene, BRAF rearrangement, low-grad...   \n",
       "636                                                NaN   \n",
       "712                                                NaN   \n",
       "\n",
       "                                       Intervention(s)  \\\n",
       "82   Drug: Abemaciclib Administered orally Other Na...   \n",
       "175  Group A: BPC Therapy Depending on the patient'...   \n",
       "263  Dosing frequency: 1 time /week Dose Levels Lev...   \n",
       "361  <cohort1> Lomustine 130 mg/m2 orally every 6 w...   \n",
       "414  Binimetinib is administered 45 mg orally, twic...   \n",
       "636  Patients will receive DSP-0390 orally once dai...   \n",
       "712  Inject the investigational drug (Cellm-001 or ...   \n",
       "\n",
       "                                    TargetWord  \\\n",
       "82                       ['High-Grade Glioma']   \n",
       "175                       ['Malignant Glioma']   \n",
       "263              ['Recurrent', 'Glioblastoma']   \n",
       "361                                 ['Glioma']   \n",
       "414  ['Low-Grade Glioma', 'Pancreatic Cancer']   \n",
       "636         ['Recurrent', 'High-Grade Glioma']   \n",
       "712                           ['Glioblastoma']   \n",
       "\n",
       "                                             TargetVec AgentJudgment  \\\n",
       "82   [[-0.12244764715433121, -0.5778073668479919, -...          None   \n",
       "175  [[-0.33767956495285034, -0.4648125171661377, -...          None   \n",
       "263  [[-0.27501848340034485, -0.5264514088630676, -...          None   \n",
       "361  [[-0.21631155908107758, -0.5687925219535828, -...          None   \n",
       "414  [[-0.18604964017868042, -0.547483503818512, -0...          None   \n",
       "636  [[-0.2750183045864105, -0.5264511704444885, -0...          None   \n",
       "712  [[-0.15113382041454315, -0.5002245306968689, -...          None   \n",
       "\n",
       "    AgentGrade  \n",
       "82        None  \n",
       "175       None  \n",
       "263       None  \n",
       "361       None  \n",
       "414       None  \n",
       "636       None  \n",
       "712       None  \n",
       "\n",
       "[7 rows x 43 columns]"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/var/folders/yw/qz00x75d7kb98f7vm8dkhkvw0000gn/T/ipykernel_49357/1375088122.py:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['AgentJudgment'] = None\n",
      "/var/folders/yw/qz00x75d7kb98f7vm8dkhkvw0000gn/T/ipykernel_49357/1375088122.py:2: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['AgentGrade'] = None\n"
     ]
    }
   ],
   "source": [
    "\n",
    "df['AgentJudgment'] = None\n",
    "df['AgentGrade'] = None\n",
    "\n",
    "#Define agents\n",
    "#modifier = QuestionModifierEnglish(groq)\n",
    "CriteriaCheckAgent = SimpleClinicalTrialAgent(groq)\n",
    "grader_agent = GraderAgent(groq)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Patients who meets any of the following criteria cannot participate in this clinical trial. -Diffuse Intrinsic Pontine Glioma (DIPG) or diffuse midline glioma located in the ? -Recurrent or refractory HGG including any recurrence/progression during/after radiotherapy. -Secondary HGG, defined as a previously treated low-grade glioma that now meets high- grade criteria, or that resulted from a previously treated malignancy. -Have known pathogenic somatic mutations appropriate for an anaplastic lymphoma kinase (ALK), B-rapidly accelerated fibrosarcoma (BRAF), or neurotrophic tyrosine receptor kinase (NTRK ) inhibitor, in regions where these therapies are available and deemed appropriate by the investigator. -Prior HGG treatment (including bevacizumab), except for surgery and radiotherapy (with or without concomitant temozolomide) -Current enrollment in another trial deemed. -Treatment with an investigational product within the last 30 days or 5 half-lives (whichever is longer). -Prior malignancy within the previous 3 years that, per the investigator and the medical monitor, may affect interpretation of study results. -A preexisting medical condition(s) that, per the investigator, would preclude study participation. -Any serious, active, systemic infection requiring IV antibiotic, antifungal, or antiviral therapy, including acute hepatitis B or C, or Human Immunodeficiency Virus at C1D1. -Intolerability or hypersensitivity such as urticaria, anaphylaxis, toxic necrolysis, and/or Stevens-Johnson syndrome, to temozolomide, its excipients, or dacarbazine. -Received a live virus vaccine within 28 days of C1D1. -Pregnant, breastfeeding, or intend to become pregnant during the study.'"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.iloc[0,:]['Inclusion Criteria']\n",
    "df.iloc[0,:]['Exclusion Criteria']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "def GetJRCTCriteria(dataframe, idx):\n",
    "    InC = dataframe.iloc[idx,:]['Inclusion Criteria']\n",
    "    ExC = dataframe.iloc[idx,:]['Exclusion Criteria']\n",
    "    return \"Inclusion Criteria :\" + InC + \"\\n\" + \"Exclusion Criteria :\" + ExC"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "TargetCriteria = GetJRCTCriteria(df,0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The patient is eligible for this clinical trial based on the provided information, as there are no exclusion criteria that would prevent him from participating.\n"
     ]
    }
   ],
   "source": [
    "AgentJudgment = CriteriaCheckAgent.evaluate_eligibility(TargetCriteria, ex_question)\n",
    "print(AgentJudgment)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "AgentGrade = grader_agent.evaluate_eligibility(AgentJudgment)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'yes'"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "AgentGrade"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [],
   "source": [
    "ex_question = generate_ex_question_English(age, sex, TumorName, GeneMutation, Meseable, Biopsiable)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The patient is eligible for this clinical trial based on the provided information, as there are no exclusion criteria that would prevent him from participating.\n",
      "yes\n",
      "The patient is eligible for this clinical trial based on the provided information, as the patient meets the inclusion criteria (age, measurable and biopsiable tumor, and no exclusion criteria mentioned).\n",
      "yes\n",
      "The patient is not eligible for this clinical trial because the patient's age (65) exceeds the upper limit of 75 years old specified in inclusion criterion (7).\n",
      "no\n",
      "Based on the provided information, the patient is eligible for this clinical trial. The patient meets the inclusion criteria for Cohort 1, as they have a glioma (WHO Grade 2-4) diagnosed by pathological diagnosis of resection or biopsy, have a history of chemotherapy or radiation therapy, and have measurable lesions based on the RANO criteria. The patient's age of 65 meets the age requirement, and there is no mention of any exclusion criteria that would prevent the patient from participating.\n",
      "yes\n",
      "The patient is not eligible for this clinical trial because the inclusion criteria specify that patients must have a BRAF fusion or rearrangement, but the patient has a HER2 gene mutation.\n",
      "no\n",
      "Based on the provided criteria, the 65-year-old male patient with glioma appears to be eligible for this clinical trial, as there are no specific age restrictions or exclusions mentioned. However, I do not know if the patient meets the other inclusion criteria, such as Karnofsky Performance Status (KPS) score, adequate organ function, and recovery from prior therapy, as this information is not provided.\n",
      "unclear\n",
      "The patient is eligible for this clinical trial based on the provided information, as the patient meets the inclusion criteria (age, measurable tumor, biopsiable tumor) and does not have any obvious exclusions (e.g., no mention of corticosteroids, immunosuppressive agents, or other exclusion criteria). However, some information is missing, such as Karnofsky Performance Status, neutrophil count, hemoglobin, platelet count, and other lab values, which would need to be confirmed to ensure full eligibility.\n",
      "unclear\n"
     ]
    }
   ],
   "source": [
    "for i in range(len(df)):\n",
    "    TargetCriteria = GetJRCTCriteria(df, i)\n",
    "    AgentJudgment = CriteriaCheckAgent.evaluate_eligibility(TargetCriteria, ex_question)\n",
    "    print(AgentJudgment)\n",
    "    AgentGrade = grader_agent.evaluate_eligibility(AgentJudgment)\n",
    "    print(AgentGrade)\n",
    "    \n",
    "    # df.locを使って値を代入(行・列名で指定)\n",
    "    df.loc[df.index[i], 'AgentJudgment'] = AgentJudgment\n",
    "    df.loc[df.index[i], 'AgentGrade'] = AgentGrade\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "for i in range(len(df)):\n",
    "    TargetCriteria = GetJRCTCriteria(df,i)\n",
    "    AgentJudgment = CriteriaCheckAgent.evaluate_eligibility(TargetCriteria, ex_question)\n",
    "    print(AgentJudgment)\n",
    "    AgentGrade = grader_agent.evaluate_eligibility(AgentJudgment)\n",
    "    print(AgentGrade)\n",
    "    df.iloc[i,:]['AgentJudgment'] = AgentJudgment\n",
    "    df.iloc[i,:]['AgentJudgment'] = AgentGrade\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>JRCT ID</th>\n",
       "      <th>NCT No</th>\n",
       "      <th>JapicCTI No</th>\n",
       "      <th>Title</th>\n",
       "      <th>TargetJ</th>\n",
       "      <th>Target</th>\n",
       "      <th>TargetEnglish</th>\n",
       "      <th>研究・治験の目的</th>\n",
       "      <th>試験等のフェーズ</th>\n",
       "      <th>試験の種類</th>\n",
       "      <th>...</th>\n",
       "      <th>Age Minimum</th>\n",
       "      <th>Age Maximum</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Discontinuation Criteria</th>\n",
       "      <th>Keyword</th>\n",
       "      <th>Intervention(s)</th>\n",
       "      <th>TargetWord</th>\n",
       "      <th>TargetVec</th>\n",
       "      <th>AgentJudgment</th>\n",
       "      <th>AgentGrade</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>jRCT2051240121</td>\n",
       "      <td>NCT06413706</td>\n",
       "      <td>NaN</td>\n",
       "      <td>放射線療法後の悪性神経膠腫の小児および若年成人を対象に、アベマシクリブ+テモゾロミドとテモゾ...</td>\n",
       "      <td>悪性神経膠腫</td>\n",
       "      <td>悪性神経膠腫</td>\n",
       "      <td>High-Grade Glioma</td>\n",
       "      <td>放射線療法後の悪性神経膠腫を有する小児および若年成人を対象に、アベマシクリブとテモゾロミドの...</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>No limit</td>\n",
       "      <td>21age old not</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Drug: Abemaciclib Administered orally Other Na...</td>\n",
       "      <td>['High-Grade Glioma']</td>\n",
       "      <td>[[-0.12244764715433121, -0.5778073668479919, -...</td>\n",
       "      <td>The patient is eligible for this clinical tria...</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>175</th>\n",
       "      <td>jRCT2031240090</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>再発悪性神経膠腫に対する治療用放射性薬剤64Cu-ATSMの有効性を検証するランダム化比較医...</td>\n",
       "      <td>悪性神経膠腫</td>\n",
       "      <td>悪性神経膠腫</td>\n",
       "      <td>Malignant glioma</td>\n",
       "      <td>再発・難治性悪性神経膠腫を対象として、64Cu-diacetyl-bis(N4-methyl...</td>\n",
       "      <td>3</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>75age old under</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>glioblastoma, grade3/4 astrocytoma, grade3 oli...</td>\n",
       "      <td>Group A: BPC Therapy Depending on the patient'...</td>\n",
       "      <td>['Malignant Glioma']</td>\n",
       "      <td>[[-0.33767956495285034, -0.4648125171661377, -...</td>\n",
       "      <td>The patient is eligible for this clinical tria...</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>263</th>\n",
       "      <td>jRCT2041230136</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>再発膠芽腫に対するTUG1を標的とした核酸医薬医師主導第I相試験</td>\n",
       "      <td>再発膠芽腫</td>\n",
       "      <td>再発膠芽腫</td>\n",
       "      <td>recurrent glioblastoma</td>\n",
       "      <td>再発膠芽腫患者を対象としてTUG1ASOを投与した場合の投与時の安全性を検討し、至適投与量を...</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>75age old under</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Dosing frequency: 1 time /week Dose Levels Lev...</td>\n",
       "      <td>['Recurrent', 'Glioblastoma']</td>\n",
       "      <td>[[-0.27501848340034485, -0.5264514088630676, -...</td>\n",
       "      <td>The patient is not eligible for this clinical ...</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>361</th>\n",
       "      <td>jRCT2051230069</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>神経膠腫患者に対するロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併⽤療法の安全...</td>\n",
       "      <td>神経膠腫</td>\n",
       "      <td>神経膠腫</td>\n",
       "      <td>Glioma</td>\n",
       "      <td>神経膠腫患者におけるロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併用療法の安全...</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>No limit</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>&lt;cohort1&gt; Lomustine 130 mg/m2 orally every 6 w...</td>\n",
       "      <td>['Glioma']</td>\n",
       "      <td>[[-0.21631155908107758, -0.5687925219535828, -...</td>\n",
       "      <td>Based on the provided information, the patient...</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>414</th>\n",
       "      <td>jRCT2031230007</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>BRAF融合遺伝子陽性の進行・再発の低悪性度神経膠腫または膵癌に対するビニメチニブの第Ⅱ相医...</td>\n",
       "      <td>低悪性度神経膠腫、膵癌</td>\n",
       "      <td>低悪性度神経膠腫、膵癌</td>\n",
       "      <td>Low-grade glioma, pancreatic cancer</td>\n",
       "      <td>BRAF融合遺伝子または遺伝子再構成陽性の切除不能または再発の低悪性度神経膠腫(コホート A...</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>12age old over</td>\n",
       "      <td>No limit</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>BRAF fusion gene, BRAF rearrangement, low-grad...</td>\n",
       "      <td>Binimetinib is administered 45 mg orally, twic...</td>\n",
       "      <td>['Low-Grade Glioma', 'Pancreatic Cancer']</td>\n",
       "      <td>[[-0.18604964017868042, -0.547483503818512, -0...</td>\n",
       "      <td>The patient is not eligible for this clinical ...</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>636</th>\n",
       "      <td>jRCT2031210299</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>再発悪性神経膠腫患者を対象としたDSP-0390の第1相試験</td>\n",
       "      <td>再発悪性神経膠腫</td>\n",
       "      <td>再発悪性神経膠腫</td>\n",
       "      <td>Recurrent High-Grade Glioma</td>\n",
       "      <td>再発悪性神経膠腫患者を対象にDSP-0390を経口投与したときの安全性、薬物動態、薬力学及び...</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>No limit</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Patients will receive DSP-0390 orally once dai...</td>\n",
       "      <td>['Recurrent', 'High-Grade Glioma']</td>\n",
       "      <td>[[-0.2750183045864105, -0.5264511704444885, -0...</td>\n",
       "      <td>Based on the provided criteria, the 65-year-ol...</td>\n",
       "      <td>unclear</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>712</th>\n",
       "      <td>jRCT2031200153</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Cellm-001による初発膠芽腫治療効果無作為比較対照試験</td>\n",
       "      <td>膠芽腫</td>\n",
       "      <td>膠芽腫</td>\n",
       "      <td>glioblastoma</td>\n",
       "      <td>脳腫瘍のうち、初発悪性膠芽腫に対する自家脳腫瘍免疫賦活剤であるCellm-001について、術...</td>\n",
       "      <td>3</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18age old over</td>\n",
       "      <td>75age old under</td>\n",
       "      <td>Both</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Inject the investigational drug (Cellm-001 or ...</td>\n",
       "      <td>['Glioblastoma']</td>\n",
       "      <td>[[-0.15113382041454315, -0.5002245306968689, -...</td>\n",
       "      <td>The patient is eligible for this clinical tria...</td>\n",
       "      <td>unclear</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7 rows × 43 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            JRCT ID       NCT No JapicCTI No  \\\n",
       "82   jRCT2051240121  NCT06413706         NaN   \n",
       "175  jRCT2031240090          NaN         NaN   \n",
       "263  jRCT2041230136          NaN         NaN   \n",
       "361  jRCT2051230069          NaN         NaN   \n",
       "414  jRCT2031230007          NaN         NaN   \n",
       "636  jRCT2031210299          NaN         NaN   \n",
       "712  jRCT2031200153          NaN         NaN   \n",
       "\n",
       "                                                 Title      TargetJ  \\\n",
       "82   放射線療法後の悪性神経膠腫の小児および若年成人を対象に、アベマシクリブ+テモゾロミドとテモゾ...       悪性神経膠腫   \n",
       "175  再発悪性神経膠腫に対する治療用放射性薬剤64Cu-ATSMの有効性を検証するランダム化比較医...       悪性神経膠腫   \n",
       "263                   再発膠芽腫に対するTUG1を標的とした核酸医薬医師主導第I相試験        再発膠芽腫   \n",
       "361  神経膠腫患者に対するロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併⽤療法の安全...         神経膠腫   \n",
       "414  BRAF融合遺伝子陽性の進行・再発の低悪性度神経膠腫または膵癌に対するビニメチニブの第Ⅱ相医...  低悪性度神経膠腫、膵癌   \n",
       "636                     再発悪性神経膠腫患者を対象としたDSP-0390の第1相試験     再発悪性神経膠腫   \n",
       "712                     Cellm-001による初発膠芽腫治療効果無作為比較対照試験          膠芽腫   \n",
       "\n",
       "          Target                        TargetEnglish  \\\n",
       "82        悪性神経膠腫                    High-Grade Glioma   \n",
       "175       悪性神経膠腫                     Malignant glioma   \n",
       "263        再発膠芽腫               recurrent glioblastoma   \n",
       "361         神経膠腫                               Glioma   \n",
       "414  低悪性度神経膠腫、膵癌  Low-grade glioma, pancreatic cancer   \n",
       "636     再発悪性神経膠腫          Recurrent High-Grade Glioma   \n",
       "712          膠芽腫                         glioblastoma   \n",
       "\n",
       "                                              研究・治験の目的 試験等のフェーズ  試験の種類  ...  \\\n",
       "82   放射線療法後の悪性神経膠腫を有する小児および若年成人を対象に、アベマシクリブとテモゾロミドの...        2    NaN  ...   \n",
       "175  再発・難治性悪性神経膠腫を対象として、64Cu-diacetyl-bis(N4-methyl...        3    NaN  ...   \n",
       "263  再発膠芽腫患者を対象としてTUG1ASOを投与した場合の投与時の安全性を検討し、至適投与量を...        1    NaN  ...   \n",
       "361  神経膠腫患者におけるロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併用療法の安全...        1    NaN  ...   \n",
       "414  BRAF融合遺伝子または遺伝子再構成陽性の切除不能または再発の低悪性度神経膠腫(コホート A...        2    NaN  ...   \n",
       "636  再発悪性神経膠腫患者を対象にDSP-0390を経口投与したときの安全性、薬物動態、薬力学及び...        1    NaN  ...   \n",
       "712  脳腫瘍のうち、初発悪性膠芽腫に対する自家脳腫瘍免疫賦活剤であるCellm-001について、術...        3    NaN  ...   \n",
       "\n",
       "        Age Minimum      Age Maximum Gender Discontinuation Criteria  \\\n",
       "82         No limit    21age old not    NaN                      NaN   \n",
       "175  18age old over  75age old under   Both                      NaN   \n",
       "263  18age old over  75age old under   Both                      NaN   \n",
       "361  18age old over         No limit   Both                      NaN   \n",
       "414  12age old over         No limit   Both                      NaN   \n",
       "636  18age old over         No limit   Both                      NaN   \n",
       "712  18age old over  75age old under   Both                      NaN   \n",
       "\n",
       "                                               Keyword  \\\n",
       "82                                                 NaN   \n",
       "175  glioblastoma, grade3/4 astrocytoma, grade3 oli...   \n",
       "263                                                NaN   \n",
       "361                                                NaN   \n",
       "414  BRAF fusion gene, BRAF rearrangement, low-grad...   \n",
       "636                                                NaN   \n",
       "712                                                NaN   \n",
       "\n",
       "                                       Intervention(s)  \\\n",
       "82   Drug: Abemaciclib Administered orally Other Na...   \n",
       "175  Group A: BPC Therapy Depending on the patient'...   \n",
       "263  Dosing frequency: 1 time /week Dose Levels Lev...   \n",
       "361  <cohort1> Lomustine 130 mg/m2 orally every 6 w...   \n",
       "414  Binimetinib is administered 45 mg orally, twic...   \n",
       "636  Patients will receive DSP-0390 orally once dai...   \n",
       "712  Inject the investigational drug (Cellm-001 or ...   \n",
       "\n",
       "                                    TargetWord  \\\n",
       "82                       ['High-Grade Glioma']   \n",
       "175                       ['Malignant Glioma']   \n",
       "263              ['Recurrent', 'Glioblastoma']   \n",
       "361                                 ['Glioma']   \n",
       "414  ['Low-Grade Glioma', 'Pancreatic Cancer']   \n",
       "636         ['Recurrent', 'High-Grade Glioma']   \n",
       "712                           ['Glioblastoma']   \n",
       "\n",
       "                                             TargetVec  \\\n",
       "82   [[-0.12244764715433121, -0.5778073668479919, -...   \n",
       "175  [[-0.33767956495285034, -0.4648125171661377, -...   \n",
       "263  [[-0.27501848340034485, -0.5264514088630676, -...   \n",
       "361  [[-0.21631155908107758, -0.5687925219535828, -...   \n",
       "414  [[-0.18604964017868042, -0.547483503818512, -0...   \n",
       "636  [[-0.2750183045864105, -0.5264511704444885, -0...   \n",
       "712  [[-0.15113382041454315, -0.5002245306968689, -...   \n",
       "\n",
       "                                         AgentJudgment AgentGrade  \n",
       "82   The patient is eligible for this clinical tria...        yes  \n",
       "175  The patient is eligible for this clinical tria...        yes  \n",
       "263  The patient is not eligible for this clinical ...         no  \n",
       "361  Based on the provided information, the patient...        yes  \n",
       "414  The patient is not eligible for this clinical ...         no  \n",
       "636  Based on the provided criteria, the 65-year-ol...    unclear  \n",
       "712  The patient is eligible for this clinical tria...    unclear  \n",
       "\n",
       "[7 rows x 43 columns]"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['JRCT ID', 'NCT No', 'JapicCTI No', 'Title', 'TargetJ', 'Target',\n",
       "       'TargetEnglish', '研究・治験の目的', '試験等のフェーズ', '試験の種類', '無作為化', '盲検化', '対照',\n",
       "       '割付け', '研究目的', '主たる選択基準', '主たる除外基準', '年齢下限', '年齢上限', '性別', '中止基準',\n",
       "       '対象疾患キーワード', '介入の内容', 'URL', 'Phase', 'Study Type', 'allocation',\n",
       "       'masking', 'control', 'assignment', 'purpose', 'Inclusion Criteria',\n",
       "       'Exclusion Criteria', 'Age Minimum', 'Age Maximum', 'Gender',\n",
       "       'Discontinuation Criteria', 'Keyword', 'Intervention(s)', 'TargetWord',\n",
       "       'TargetVec', 'AgentJudgment', 'AgentGrade'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    " # 列を指定した順に並び替え\n",
    "columns_order = ['JRCT ID', 'Title', '研究・治験の目的','AgentJudgment', 'AgentGrade','主たる選択基準', '主たる除外基準','Inclusion Criteria','Exclusion Criteria','NCT No', 'JapicCTI No']\n",
    "df = df[columns_order]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>JRCT ID</th>\n",
       "      <th>Title</th>\n",
       "      <th>研究・治験の目的</th>\n",
       "      <th>AgentJudgment</th>\n",
       "      <th>AgentGrade</th>\n",
       "      <th>主たる選択基準</th>\n",
       "      <th>主たる除外基準</th>\n",
       "      <th>Inclusion Criteria</th>\n",
       "      <th>Exclusion Criteria</th>\n",
       "      <th>NCT No</th>\n",
       "      <th>JapicCTI No</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>jRCT2051240121</td>\n",
       "      <td>放射線療法後の悪性神経膠腫の小児および若年成人を対象に、アベマシクリブ+テモゾロミドとテモゾ...</td>\n",
       "      <td>放射線療法後の悪性神経膠腫を有する小児および若年成人を対象に、アベマシクリブとテモゾロミドの...</td>\n",
       "      <td>The patient is eligible for this clinical tria...</td>\n",
       "      <td>yes</td>\n",
       "      <td>以下の基準をすべて満たす必要がある ‐生検によって、以下に示す2016 年WHO分類グレード...</td>\n",
       "      <td>以下の基準のいずれかに該当する場合、本治験へ参加できない。 ‐びまん性橋膠腫(diffuse...</td>\n",
       "      <td>Subjects required to meet all the folloiwng cr...</td>\n",
       "      <td>Patients who meets any of the following criter...</td>\n",
       "      <td>NCT06413706</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>175</th>\n",
       "      <td>jRCT2031240090</td>\n",
       "      <td>再発悪性神経膠腫に対する治療用放射性薬剤64Cu-ATSMの有効性を検証するランダム化比較医...</td>\n",
       "      <td>再発・難治性悪性神経膠腫を対象として、64Cu-diacetyl-bis(N4-methyl...</td>\n",
       "      <td>The patient is eligible for this clinical tria...</td>\n",
       "      <td>yes</td>\n",
       "      <td>1) 登録前直近の病理診断により組織学的にWHO2021に基づく悪性神経膠腫(膠芽腫または、...</td>\n",
       "      <td>1) 登録前2年以内の他の悪性腫瘍の既往または合併を有する。ただし局所治療により治癒と判断さ...</td>\n",
       "      <td>1) Histologically diagnosed as high grade glio...</td>\n",
       "      <td>1) Have a history or merger of other malignanc...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>263</th>\n",
       "      <td>jRCT2041230136</td>\n",
       "      <td>再発膠芽腫に対するTUG1を標的とした核酸医薬医師主導第I相試験</td>\n",
       "      <td>再発膠芽腫患者を対象としてTUG1ASOを投与した場合の投与時の安全性を検討し、至適投与量を...</td>\n",
       "      <td>The patient is not eligible for this clinical ...</td>\n",
       "      <td>no</td>\n",
       "      <td>(1)手術摘出検体又は生検検体の永久標本にて、組織学的に膠芽腫と診断されている患者 (2)標...</td>\n",
       "      <td>(1)脳外転移のある患者 (2)著明な頭蓋内圧亢進症状のある患者 (3)初発時又は再発・増悪...</td>\n",
       "      <td>(1) Patients with a histological diagnosis of ...</td>\n",
       "      <td>(1) Patients with extracerebral metastases. (2...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>361</th>\n",
       "      <td>jRCT2051230069</td>\n",
       "      <td>神経膠腫患者に対するロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併⽤療法の安全...</td>\n",
       "      <td>神経膠腫患者におけるロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併用療法の安全...</td>\n",
       "      <td>Based on the provided information, the patient...</td>\n",
       "      <td>yes</td>\n",
       "      <td>&lt;コホート1&gt;以下のすべての項目を満たすものとする。 1)摘出術又は生検の病理診断にて、神経...</td>\n",
       "      <td>&lt;コホート1、コホート2共通&gt; 1) 活動性の重複がんを有する(同時性重複がん/多発がん及び...</td>\n",
       "      <td>&lt;Cohort 1&gt; All of the following items shall be...</td>\n",
       "      <td>&lt;Common to Cohort 1 and Cohort 2&gt; 1) Active mu...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>414</th>\n",
       "      <td>jRCT2031230007</td>\n",
       "      <td>BRAF融合遺伝子陽性の進行・再発の低悪性度神経膠腫または膵癌に対するビニメチニブの第Ⅱ相医...</td>\n",
       "      <td>BRAF融合遺伝子または遺伝子再構成陽性の切除不能または再発の低悪性度神経膠腫(コホート A...</td>\n",
       "      <td>The patient is not eligible for this clinical ...</td>\n",
       "      <td>no</td>\n",
       "      <td>コホートA、コホートB共通の適格規準 1) 保険診療下で行われているNGSを用いたがん遺伝子...</td>\n",
       "      <td>1) 活動性の重複がんを有する(ただし、次の1~3は除外しない:1完全切除された以下のがん:...</td>\n",
       "      <td>Inclusion criteria for both cohort A and B 1) ...</td>\n",
       "      <td>1) Active double primary cancer (but not (1)-(...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>636</th>\n",
       "      <td>jRCT2031210299</td>\n",
       "      <td>再発悪性神経膠腫患者を対象としたDSP-0390の第1相試験</td>\n",
       "      <td>再発悪性神経膠腫患者を対象にDSP-0390を経口投与したときの安全性、薬物動態、薬力学及び...</td>\n",
       "      <td>Based on the provided criteria, the 65-year-ol...</td>\n",
       "      <td>unclear</td>\n",
       "      <td>1. 3ヵ月以上の生存が見込める患者 2. 前治療(化学療法、手術又は放射線療法)による副作...</td>\n",
       "      <td>1. Day 1前の3ヵ月以内にベバシズマブ又はその他の血管内皮増殖因子(VEGF)阻害薬に...</td>\n",
       "      <td>1. Estimated life expectancy &gt;= 3 months 2. Re...</td>\n",
       "      <td>1. Prior therapy with bevacizumab or other ant...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>712</th>\n",
       "      <td>jRCT2031200153</td>\n",
       "      <td>Cellm-001による初発膠芽腫治療効果無作為比較対照試験</td>\n",
       "      <td>脳腫瘍のうち、初発悪性膠芽腫に対する自家脳腫瘍免疫賦活剤であるCellm-001について、術...</td>\n",
       "      <td>The patient is eligible for this clinical tria...</td>\n",
       "      <td>unclear</td>\n",
       "      <td>(1)年齢は満18歳以上、75歳以下である。 (2)テント上の膠芽腫(WHO Grade I...</td>\n",
       "      <td>(1)登録前14日以内の副腎皮質ステロイド剤(10mg/日超のプレドニゾロン、あるいは相当量...</td>\n",
       "      <td>(1) 18 years old or older and 75 years old or ...</td>\n",
       "      <td>(1) Systemic administration of corticosteroids...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            JRCT ID                                              Title  \\\n",
       "82   jRCT2051240121  放射線療法後の悪性神経膠腫の小児および若年成人を対象に、アベマシクリブ+テモゾロミドとテモゾ...   \n",
       "175  jRCT2031240090  再発悪性神経膠腫に対する治療用放射性薬剤64Cu-ATSMの有効性を検証するランダム化比較医...   \n",
       "263  jRCT2041230136                   再発膠芽腫に対するTUG1を標的とした核酸医薬医師主導第I相試験   \n",
       "361  jRCT2051230069  神経膠腫患者に対するロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併⽤療法の安全...   \n",
       "414  jRCT2031230007  BRAF融合遺伝子陽性の進行・再発の低悪性度神経膠腫または膵癌に対するビニメチニブの第Ⅱ相医...   \n",
       "636  jRCT2031210299                     再発悪性神経膠腫患者を対象としたDSP-0390の第1相試験   \n",
       "712  jRCT2031200153                     Cellm-001による初発膠芽腫治療効果無作為比較対照試験   \n",
       "\n",
       "                                              研究・治験の目的  \\\n",
       "82   放射線療法後の悪性神経膠腫を有する小児および若年成人を対象に、アベマシクリブとテモゾロミドの...   \n",
       "175  再発・難治性悪性神経膠腫を対象として、64Cu-diacetyl-bis(N4-methyl...   \n",
       "263  再発膠芽腫患者を対象としてTUG1ASOを投与した場合の投与時の安全性を検討し、至適投与量を...   \n",
       "361  神経膠腫患者におけるロムスチン療法とプロカルバジン、ロムスチン、ビンクリスチン併用療法の安全...   \n",
       "414  BRAF融合遺伝子または遺伝子再構成陽性の切除不能または再発の低悪性度神経膠腫(コホート A...   \n",
       "636  再発悪性神経膠腫患者を対象にDSP-0390を経口投与したときの安全性、薬物動態、薬力学及び...   \n",
       "712  脳腫瘍のうち、初発悪性膠芽腫に対する自家脳腫瘍免疫賦活剤であるCellm-001について、術...   \n",
       "\n",
       "                                         AgentJudgment AgentGrade  \\\n",
       "82   The patient is eligible for this clinical tria...        yes   \n",
       "175  The patient is eligible for this clinical tria...        yes   \n",
       "263  The patient is not eligible for this clinical ...         no   \n",
       "361  Based on the provided information, the patient...        yes   \n",
       "414  The patient is not eligible for this clinical ...         no   \n",
       "636  Based on the provided criteria, the 65-year-ol...    unclear   \n",
       "712  The patient is eligible for this clinical tria...    unclear   \n",
       "\n",
       "                                               主たる選択基準  \\\n",
       "82   以下の基準をすべて満たす必要がある ‐生検によって、以下に示す2016 年WHO分類グレード...   \n",
       "175  1) 登録前直近の病理診断により組織学的にWHO2021に基づく悪性神経膠腫(膠芽腫または、...   \n",
       "263  (1)手術摘出検体又は生検検体の永久標本にて、組織学的に膠芽腫と診断されている患者 (2)標...   \n",
       "361  <コホート1>以下のすべての項目を満たすものとする。 1)摘出術又は生検の病理診断にて、神経...   \n",
       "414  コホートA、コホートB共通の適格規準 1) 保険診療下で行われているNGSを用いたがん遺伝子...   \n",
       "636  1. 3ヵ月以上の生存が見込める患者 2. 前治療(化学療法、手術又は放射線療法)による副作...   \n",
       "712  (1)年齢は満18歳以上、75歳以下である。 (2)テント上の膠芽腫(WHO Grade I...   \n",
       "\n",
       "                                               主たる除外基準  \\\n",
       "82   以下の基準のいずれかに該当する場合、本治験へ参加できない。 ‐びまん性橋膠腫(diffuse...   \n",
       "175  1) 登録前2年以内の他の悪性腫瘍の既往または合併を有する。ただし局所治療により治癒と判断さ...   \n",
       "263  (1)脳外転移のある患者 (2)著明な頭蓋内圧亢進症状のある患者 (3)初発時又は再発・増悪...   \n",
       "361  <コホート1、コホート2共通> 1) 活動性の重複がんを有する(同時性重複がん/多発がん及び...   \n",
       "414  1) 活動性の重複がんを有する(ただし、次の1~3は除外しない:1完全切除された以下のがん:...   \n",
       "636  1. Day 1前の3ヵ月以内にベバシズマブ又はその他の血管内皮増殖因子(VEGF)阻害薬に...   \n",
       "712  (1)登録前14日以内の副腎皮質ステロイド剤(10mg/日超のプレドニゾロン、あるいは相当量...   \n",
       "\n",
       "                                    Inclusion Criteria  \\\n",
       "82   Subjects required to meet all the folloiwng cr...   \n",
       "175  1) Histologically diagnosed as high grade glio...   \n",
       "263  (1) Patients with a histological diagnosis of ...   \n",
       "361  <Cohort 1> All of the following items shall be...   \n",
       "414  Inclusion criteria for both cohort A and B 1) ...   \n",
       "636  1. Estimated life expectancy >= 3 months 2. Re...   \n",
       "712  (1) 18 years old or older and 75 years old or ...   \n",
       "\n",
       "                                    Exclusion Criteria       NCT No  \\\n",
       "82   Patients who meets any of the following criter...  NCT06413706   \n",
       "175  1) Have a history or merger of other malignanc...          NaN   \n",
       "263  (1) Patients with extracerebral metastases. (2...          NaN   \n",
       "361  <Common to Cohort 1 and Cohort 2> 1) Active mu...          NaN   \n",
       "414  1) Active double primary cancer (but not (1)-(...          NaN   \n",
       "636  1. Prior therapy with bevacizumab or other ant...          NaN   \n",
       "712  (1) Systemic administration of corticosteroids...          NaN   \n",
       "\n",
       "    JapicCTI No  \n",
       "82          NaN  \n",
       "175         NaN  \n",
       "263         NaN  \n",
       "361         NaN  \n",
       "414         NaN  \n",
       "636         NaN  \n",
       "712         NaN  "
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    " # 列を指定した順に並び替え\n",
    "columns_order = ['NCTID', 'AgentGrade', 'Title', 'AgentJudgment', 'Japanes Locations', \n",
    "                     'Primary Completion Date', 'Cancer', 'Summary', 'Eligibility Criteria']\n",
    "df = df[columns_order]        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NCTID</th>\n",
       "      <th>AgentGrade</th>\n",
       "      <th>Title</th>\n",
       "      <th>AgentJudgment</th>\n",
       "      <th>Japanes Locations</th>\n",
       "      <th>Primary Completion Date</th>\n",
       "      <th>Cancer</th>\n",
       "      <th>Summary</th>\n",
       "      <th>Eligibility Criteria</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NCT05580562</td>\n",
       "      <td>no</td>\n",
       "      <td>ONC201 in H3 K27M-mutant Diffuse Glioma Follow...</td>\n",
       "      <td>The patient is not eligible for this clinical ...</td>\n",
       "      <td>Chuo City, Fukuoka, Kyoto, Osaka, Sapporo</td>\n",
       "      <td>2026-08</td>\n",
       "      <td>H3 K27M, Glioma</td>\n",
       "      <td>This is a randomized, double-blind, placebo-co...</td>\n",
       "      <td>Inclusion Criteria:\\n\\n1. Able to understand t...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NCT06413706</td>\n",
       "      <td>yes</td>\n",
       "      <td>A Study Comparing Abemaciclib Plus Temozolomid...</td>\n",
       "      <td>The patient is eligible for this clinical tria...</td>\n",
       "      <td>Nagoya, Osaka, Tokyo</td>\n",
       "      <td>2027-07</td>\n",
       "      <td>Glioma</td>\n",
       "      <td>The purpose of this study is to measure the be...</td>\n",
       "      <td>Inclusion Criteria:\\n\\n* Biopsy proven high-gr...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NCT05503264</td>\n",
       "      <td>no</td>\n",
       "      <td>A Study To Evaluate The Efficacy, Safety, Phar...</td>\n",
       "      <td>The patient is not eligible for this clinical ...</td>\n",
       "      <td>Aichi, Chiba, Fukuoka, Gifu, Hokkaido, Hyogo, ...</td>\n",
       "      <td>2026-06-23</td>\n",
       "      <td>NMDAR Autoimmune Encephalitis, LGI1 Autoimmune...</td>\n",
       "      <td>The purpose of this study is to assess the eff...</td>\n",
       "      <td>Inclusion Criteria:\\n\\n* Reasonable exclusion ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NCT06159478</td>\n",
       "      <td>no</td>\n",
       "      <td>Binimetinib in Patients With BRAF Fusion-posit...</td>\n",
       "      <td>The patient is not eligible for this clinical ...</td>\n",
       "      <td>Fukuoka, Kashiwa, Kyoto City, Sapporo, Sendai, ku</td>\n",
       "      <td>2027-02-28</td>\n",
       "      <td>Low-grade Glioma, Pancreatic Cancer</td>\n",
       "      <td>This study is an open-label, parallel, 2-cohor...</td>\n",
       "      <td>Inclusion Criteria:\\n\\nInclusion criteria for ...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         NCTID AgentGrade                                              Title  \\\n",
       "0  NCT05580562         no  ONC201 in H3 K27M-mutant Diffuse Glioma Follow...   \n",
       "1  NCT06413706        yes  A Study Comparing Abemaciclib Plus Temozolomid...   \n",
       "2  NCT05503264         no  A Study To Evaluate The Efficacy, Safety, Phar...   \n",
       "3  NCT06159478         no  Binimetinib in Patients With BRAF Fusion-posit...   \n",
       "\n",
       "                                       AgentJudgment  \\\n",
       "0  The patient is not eligible for this clinical ...   \n",
       "1  The patient is eligible for this clinical tria...   \n",
       "2  The patient is not eligible for this clinical ...   \n",
       "3  The patient is not eligible for this clinical ...   \n",
       "\n",
       "                                   Japanes Locations Primary Completion Date  \\\n",
       "0          Chuo City, Fukuoka, Kyoto, Osaka, Sapporo                 2026-08   \n",
       "1                               Nagoya, Osaka, Tokyo                 2027-07   \n",
       "2  Aichi, Chiba, Fukuoka, Gifu, Hokkaido, Hyogo, ...              2026-06-23   \n",
       "3  Fukuoka, Kashiwa, Kyoto City, Sapporo, Sendai, ku              2027-02-28   \n",
       "\n",
       "                                              Cancer  \\\n",
       "0                                    H3 K27M, Glioma   \n",
       "1                                             Glioma   \n",
       "2  NMDAR Autoimmune Encephalitis, LGI1 Autoimmune...   \n",
       "3                Low-grade Glioma, Pancreatic Cancer   \n",
       "\n",
       "                                             Summary  \\\n",
       "0  This is a randomized, double-blind, placebo-co...   \n",
       "1  The purpose of this study is to measure the be...   \n",
       "2  The purpose of this study is to assess the eff...   \n",
       "3  This study is an open-label, parallel, 2-cohor...   \n",
       "\n",
       "                                Eligibility Criteria  \n",
       "0  Inclusion Criteria:\\n\\n1. Able to understand t...  \n",
       "1  Inclusion Criteria:\\n\\n* Biopsy proven high-gr...  \n",
       "2  Inclusion Criteria:\\n\\n* Reasonable exclusion ...  \n",
       "3  Inclusion Criteria:\\n\\nInclusion criteria for ...  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "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
}