Skip to content

Assignment 4 pdf, Rmd, and screenshot #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
94 changes: 94 additions & 0 deletions StudentNotebooks/Assignment04/liux30-assignment4-f24.Rmd
@@ -0,0 +1,94 @@
---
title: "DAR F24 Project Status Notebook 4"
author: "Xiheng Liu"
date: "`r Sys.Date()`"
output:
pdf_document:
toc: yes
html_document:
toc: yes
subtitle: "CTBench"
---

## Weekly Work Summary

* RCS ID: liux30
* Project Name: DAR-CTEval-F24
* Summary of work since last week

* Understand the structure of ChatBS's code and the logic of the code running after clicking the submit button.
* Make a search button that can input the NCTId to obtain a zero-shot result

* NEW: Summary of github issues added and worked

* Modified the introduction in the ChatBS code and commented out the RDF part
* Modified systemPromptText.default and promptText.startup
* Make a search button that can input the NCTId to obtain a zero-shot result

* Summary of github commits

* Branch name: dar-foo
* The link to the branch: https://github.rpi.edu/DataINCITE/DAR-CTBSApp-F24/tree/dar-foo.


## Personal Contribution

* Use Shiny app to create CTBS based on ChatBS. Place a text box on the web page to enter NCTid. Click the ‘Search’ button to get the title, brief summary, condition under study, inclusion and exclusion criteria, intervention, and outcomes of the corresponding NCTid in CT_repo. Then put them in a templete in user prompt and give it to LLM to get the result for zero-shot, and shows in result.


## Analysis: Question 1 (Understanding ChatBS's code)

### Question being asked

What is the structure of ChatBS's code, and what is the logic of the code running after clicking the submit button?

### Data Preparation

I clone the ChatBS project in https://github.rpi.edu/DataINCITE/DAR-CTBSApp-F24.


### Analysis: Methods and Results

After participating in RPIrates and getting a general idea of the structure, I read the code line by line and tried to modify it to determine whether my understanding was correct. And I modified the introduction in the ChatBS code and commented out the RDF part.

```{r, result01_analysis, echo=FALSE}
library(knitr)
include_graphics("pic0.png")
```

### Discussion of results

ChatBS made with Shiny app is roughly divided into three parts: preparation, UI, and server. In the preparation, there are some basic parameters and default values. The UI part includes all the elements we can see on the web page, including input text boxes, buttons, result placement, etc. The server part is the internal logic of the code running, including how the code runs, using observeEvent function to observe the reaction after the button is pressed and return the result to the UI, etc.

So basicly, the ChatBS is that placing input boxes and other options of the system prompt and user prompt from the UI and transferring the input to the server. In the server, after getting the input of the submit button, submit the prompt input to the LLM. Get the result and update the result in the UI.


## Analysis: Question 2 (Search button)

### Question being asked

In CTBS, how to make a search button that can input the NCTId to obtain a zero-shot result?

### Data Preparation

I created a new branch dar-foo on CTBS project in github, backed up the previous ChatBS app.R code as app.R.bak, and then start to modified the app.R code. I modified the introduction and commented out the part about RDF in UI. I read the data from CT_repo and CT_pub in preparation part.


### Analysis methods used and Discussion of results

I placed a fluidRow in UI part. On the left side of fluidRow is a text box, which is resized to perfect enter a complete NCTid, and has the characters ‘NCT’ by default. On the right side of fluidRow is the ‘Search’ button, which has also been adjusted in position. In server part, I created an observeEvent function for the ‘Search’ button. After clicking the button, it will first determine whether the input NCTid is in the database. If not, it will return ‘Cannot find this NCTId.’. If it is, the row where the NCTid is located will be extracted, and Title, BriefSummary, Condition, EligibilityCriteria, Intervention, and Outcome will be stored separately according to the column names. Then put it in the user prompt template that starts with ‘##Question:’ and ends with ‘##Answer:’. It will then be transmitted to LLM in the same format as 'Submit' button.

```{r, result02_analysis, echo=FALSE}
library(knitr)
include_graphics("pic.png")
```


## Summary and next steps

Continue working on CTBS. Try to modify the interface and feedback of the ‘search’ button. Try to modify the display method of the result.

Binary file not shown.
Binary file added StudentNotebooks/Assignment04/pic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added StudentNotebooks/Assignment04/pic0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.