quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.77k stars 309 forks source link

ERROR: API Error: Bad Request when trying to create Quarto website #10466

Closed PragnyaSankar7 closed 1 month ago

PragnyaSankar7 commented 1 month ago

Bug description

$ quarto publish quarto-pub ? Publish with account: » psansubram@gmail.com ? Site name: » Use another name... ? Publish with name: » heart-attack-prediction

[>] Creating quarto-pub site

Rendering for publish:

[1/6] about.qmd [2/6] analysis.qmd

processing file: analysis.qmd |... | 5% |..... | 11% [unnamed- |........ | 16% |........... | 21% [unnamed- |.............. | 26% |................ | 32% [unnamed- |................... | 37% |...................... | 42% [unnamed- |......................... | 47% |........................... | 53% [unnamed- |.............................. | 58% |................................. | 63% [unnamed- |.................................... | 68% |...................................... | 74% [unnamed- |......................................... | 79% |............................................ | 84% [unnamed- |............................................... | 89% |................................................. | 95% [unnamed- | output file: analysis.knit.md

|....................................................| 100%

[3/6] heart-attack-prediction\about.qmd [4/6] heart-attack-prediction\index.qmd [5/6] index.qmd [6/6] sources.qmd

[>] Preparing to publish site ERROR: API Error: 500 - Internal Server Error

Stack trace: at QuartoPubClient.uploadDeployFile (file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:102993:23) at eventLoopTick (ext:core/01_core.js:183:11) at async file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:102097:13 at async withSpinner (file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:75276:16) at async handlePublish (file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:102090:5) at async publishSite (file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:106493:38) at async publish6 (file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:106712:61) at async doPublish (file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:106672:13) at async publishAction (file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:106704:13) at async Command.fn (file:///C:/Program%20Files/RStudio/resources/app/bin/quarto/bin/quarto.js:106660:9)

Steps to reproduce


title: "Heart Attack" author: "Pragnyasri Sankar" format: html editor: visual

#|label: setup
library(tidyverse)
library(primer.data)
library(tidybayes)
library(brms)
library(gtsummary)
library(patchwork)
library(grid)
library(gridExtra)
heart_data <- read.csv("heart.csv")
head(heart_data)

head(heart_data)
summary(heart_data)
plot_age <- ggplot(heart_data, aes(x = age, fill = factor(output))) +
  geom_bar(position = "dodge") +
  labs(title = "Distribution of Heart Attack Presence by Age",
       x = "Age",
       y = "Count",
       fill = "Heart Attack Presence") +
  theme_minimal()
# Create a bar plot for the distribution of heart attack presence by sex
plot_sex <- ggplot(heart_data, aes(x = factor(sex), fill = factor(output))) +
  geom_bar(position = "dodge") +
  labs(title = "Distribution of Heart Attack Presence by Sex",
       x = "Sex",
       y = "Count",
       fill = "Heart Attack Presence") +
  scale_x_discrete(labels = c("0" = "Female", "1" = "Male")) +
  theme_minimal()

# Create a scatter plot for age vs. maximum heart rate achieved
plot_thalachh <- ggplot(heart_data, aes(x = age, y = thalachh, color = factor(output))) +
  geom_point() +
  labs(title = "Age vs. Maximum Heart Rate Achieved",
       x = "Age",
       y = "Maximum Heart Rate Achieved",
       color = "Heart Attack Presence") +
  theme_minimal()
# Combine the plots into a single layout using gridExtra
combined_plot <- grid.arrange(plot_age, plot_sex, plot_thalachh, ncol = 1)

# Print the combined plot
print(combined_plot)
# Bayesian model using brms
# Example model: Predicting heart attack presence using age and sex
 model <- brm(output ~ age + sex, data = heart_data, family = bernoulli(), prior = c(set_prior("normal(0, 1)", class = "b")))
# Summarize the model
summary(model)

# Create a table summary using gtsummary
tbl_summary(heart_data, by = output) %>%
  add_p() %>%
  modify_header(label ~ "**Variable**") %>%
  modify_spanning_header(c(stat_1, stat_2) ~ "**Heart Attack Presence**") %>%
  bold_labels()

geom_bar(position = "dodge") + labs(title = "Distribution of Heart Attack Presence by Age", x = "Age", y = "Count", fill = "Heart Attack Presence") + theme_minimal()

Histogram of Age

ggplot(heart_data, aes(x = age)) + geom_histogram(binwidth = 5, fill = "blue", color = "black") + labs(title = "Age Distribution", x = "Age", y = "Frequency")

ggplot(heart_data, aes(x = sex)) + geom_bar(fill = "black", color = "black") + labs(title = "Gender Distribution", x = "Gender", y = "Count")

Logistic regression model for Age

age_model <- glm(output ~ age, data = heart_data, family = binomial)

Predict probabilities

heart_data <- heart_data %>% mutate(predicted_prob_age = predict(age_model, type = "response"))

Plot Age vs. Predicted Probability of Heart Attack

ggplot(heart_data, aes(x = age, y = predicted_prob_age)) + geom_point(alpha = 0.5) + geom_smooth(method = "loess", color = "blue") + labs(title = "Predicted Probability of Heart Attack by Age", x = "Age", y = "Predicted Probability")

Logistic regression model for Gender

gender_model <- glm(output ~ sex, data = heart_data, family = binomial)

Predict probabilities

heart_data <- heart_data %>% mutate(predicted_prob_gender = predict(gender_model, type = "response"))

Plot Gender vs. Predicted Probability of Heart Attack

ggplot(heart_data, aes(x = sex, y = predicted_prob_gender, fill = sex)) + geom_bar(stat = "identity", position = "dodge") + labs(title = "Predicted Probability of Heart Attack by Gender", x = "Gender", y = "Predicted Probability")

Fit a Bayesian logistic regression model

heart_model <- brm( formula = output ~ age + sex + chol + trtbps + Diabetes + Family_History + Smoking + Obesity + Alcohol_Consumption + Exercise_Hours_Per_Week + Diet + Previous_Heart_Problems + Medication_Use + Stress_Level + Sedentary_Hours_Per_Day + BMI + Triglycerides + Physical_Activity_Days_Per_Week + Sleep_Hours_Per_Day + Income, data = heart_data, family = bernoulli(link = "logit"), prior = set_prior("normal(0, 10)", class = "b"), chains = 4, iter = 2000, warmup = 1000, seed = 123 )

Summary of the model

summary(heart_model)

Plot diagnostics

plot(heart_model)

Create a summary table

tbl_summary( heart_data, by = Heart_Attack_Risk, statistic = list(all_continuous() ~ "{mean} ({sd})", all_categorical() ~ "{n} / {N} ({p}%)"), digits = all_continuous() ~ 2 ) %>% add_p() %>% modify_header(label = "Variable") %>% modify_spanning_header(c("stat_1", "stat_2") ~ "Heart Attack Risk")

Expected behavior

No response

Actual behavior

No response

Your environment

RStudio

Quarto check output

$ quarto check Quarto 1.4.555 [>] Checking versions of quarto binary dependencies... Pandoc version 3.1.11: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [>] Checking versions of quarto dependencies......OK [>] Checking Quarto installation......OK Version: 1.4.555 Path: C:\Program Files\RStudio\resources\app\bin\quarto\bin CodePage: 1252

[>] Checking tools....................OK TinyTeX: (not installed) Chromium: (not installed)

[>] Checking LaTeX....................OK Tex: (not detected)

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK Version: 3.11.3 Path: C:/Users/sanka/AppData/Local/Programs/Python/Python311/python.exe Jupyter: (None)

  Jupyter is not available in this Python installation.
  Install with py -m pip install jupyter

[>] Checking R installation...........OK Version: 4.4.0 Path: C:/PROGRA~1/R/R-44~1.0 LibPaths:

[>] Checking Knitr engine render......OK

mcanouil commented 1 month ago

Duplicate of https://github.com/quarto-dev/quarto-cli/issues/10461

mcanouil commented 1 month ago

@PragnyaSankar7 next time, could you follow the guidelines when opening an issue, i.e., provide a small reproducible example and format your post properly for it to be legible. Anyhow, this is a duplicate report and we are working to resolve the issue.