|
1 | | -https://zipkinlab.github.io/#about |
2 | 1 |
|
3 | | -# rqm-template |
4 | | -[project] Webpage source code for Zipkin Lab code archive |
| 2 | +# Adding papers to the Zipkin Lab code archive front-facing page |
| 3 | +--- |
5 | 4 |
|
6 | | -Adapted from template developed by @auremoser for https://cbahlai.github.io/rqm-template/ |
| 5 | +Here are the steps and information to add a new GitHub repository to the [Zipkin Lab Code Archive](https://zipkinlab.github.io/) front-face page, if you are one of the 'GitHub people'. |
7 | 6 |
|
| 7 | +The lab archive is the website where all our code and data can 'live through eternity', and where we can direct people who ask about our analysis or data. The [Lab Code Archive](https://github.com/zipkinlab/zipkinlab.github.io) is a single repository that lives within the [Zipkin Lab's GitHub](https://github.com/zipkinlab) page. It creates and links the [Zipkin Lab Archive website](https://zipkinlab.github.io/) to all other repositories that are stored in the lab GitHub. |
| 8 | + |
| 9 | +<div align="center"> |
| 10 | +<img src="assets/images/lab_page.png" alt="lab_page" width="600"> |
| 11 | +</div> |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## These are the steps: |
| 16 | + |
| 17 | +### 1 - Fork personal repository to Zipkin Lab GitHub |
| 18 | + |
| 19 | +All repositories should be on the Zipkin Lab GitHub and linked from there (not from personal GitHub accounts) to the front-facing page. So step one is **forking** someone's repository into it. |
| 20 | + |
| 21 | +- Navigate to the repository you want to fork. |
| 22 | +- Click the **Fork** button (top-right of the page). |
| 23 | +- Choose the owner and name for the fork: it should be **ZIPKINLAB**, not your own. |
| 24 | +- You can also change the repository name at this stage. |
| 25 | +- Click **Create fork**. |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +### 2 - Gather required information |
| 30 | + |
| 31 | +There are two documents to use as references (available on the [Zipkin Lab Teams GitHub page](https://teams.microsoft.com/l/channel/19%3A15762ca26189456f989a45136b141e94%40thread.tacv2/GitHub?groupId=a1e331a0-3ad7-4671-a13e-3629dea6fd3b&tenantId=22177130-642f-41d9-9211-74237ad5687d)): |
| 32 | + |
| 33 | +- A checklist to track added papers: |
| 34 | + [GithubProjects.xlsx](https://michiganstate.sharepoint.com/:x:/r/sites/STUOT-ResearchGroup/Shared%20Documents/GitHub/GithubProjects.xlsx) |
| 35 | + |
| 36 | +- A document with detailed instructions: |
| 37 | + [Github Project Checklist.docx](https://michiganstate.sharepoint.com/:w:/r/sites/STUOT-ResearchGroup/Shared%20Documents/GitHub/Github%20Project%20Checklist.docx) |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +### 3 - Edit the front-facing page |
| 42 | + |
| 43 | +- Edits are done in the [index.html](https://github.com/zipkinlab/zipkinlab.github.io/blob/master/index.html) file. |
| 44 | +- Insert your new HTML block **within the appropriate paper category** (e.g., community models, unmarked population models). |
| 45 | +- New papers go at the top of the section. |
| 46 | +- You can add information manually, or use the code automation below: |
| 47 | + |
| 48 | +#### Automated version: |
| 49 | + |
| 50 | +- The paper metadata goes into the [github_dat.csv](https://michiganstate.sharepoint.com/:x:/r/sites/STUOT-ResearchGroup/Shared%20Documents/GitHub/github_dat.csv) file. Just download it and substitute the fields with the details of the paper you want to add. |
| 51 | + |
| 52 | + <details> |
| 53 | + <summary>Click to see code that creates github_dat.csv</summary> |
| 54 | + |
| 55 | + ````r |
| 56 | + library(tidyverse) |
| 57 | + |
| 58 | + dat <- tibble( |
| 59 | + data = c("section", "citation", "title", "year", "journal", "fig_height", "fig_width", "abstract", |
| 60 | + "author1", "github1", "author2", "github2", "author3", "github3", "author4", "github4", |
| 61 | + "numb_authors", "doi", "doi_addr"), |
| 62 | + info = c("Data integration models", "Davis_etal_2025_EcoApps", |
| 63 | + "Evaluating environmental drivers and synchrony of Arctic shorebird demographic rates to inform conservation management", |
| 64 | + "2025", "Ecological Applications", "2128", "2193", |
| 65 | + "Environmental factors affect the population dynamics of migratory species throughout their annual cycles. However, identifying the", |
| 66 | + "Davis, K.L.", "https://github.com/davisk93", "Lanctot, R.B.", "NA", "Saalfeld, S.T.", "NA", |
| 67 | + "Zipkin, E.F.", "https://github.com/zipkinlab", "4", "10.1111/2041-210X.14282", |
| 68 | + "https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.14282") |
| 69 | + ) |
| 70 | + ```` |
| 71 | + </details> |
| 72 | + |
| 73 | +<div align="center"> |
| 74 | +<img src="assets/images/git_dat.png" alt="git_dat" width="400"> |
| 75 | +</div> |
| 76 | + |
| 77 | +- Now that you have the new `github_dat.csv` file in your working directory, run [github_html.r](https://michiganstate.sharepoint.com/:u:/r/sites/STUOT-ResearchGroup/Shared%20Documents/GitHub/github_html.r) to create the HTML code snippets that should be added to [index.html](https://github.com/zipkinlab/zipkinlab.github.io/blob/master/index.html). |
| 78 | + |
| 79 | + <details> |
| 80 | + <summary>Click to see code from github_html.r</summary> |
| 81 | + |
| 82 | + ````r |
| 83 | + ## code to create html file for the lab front-facing page |
| 84 | + |
| 85 | + library(glue) |
| 86 | + library(tidyverse) |
| 87 | + |
| 88 | + dat <- read_csv("github_dat.csv") |
| 89 | + |
| 90 | + # Match section name to ID |
| 91 | + id_codes <- c("icm", "dataintegration", "other", "community", "unmarked") |
| 92 | + id_names <- c("Integrated community models", "Data integration models", "Other projects", "Community analyses", "Unmarked population models") |
| 93 | + |
| 94 | + id_cd <- cbind(id_codes, id_names) %>% as_tibble() |
| 95 | + this_id <- pull(dat[which(dat$data == "section"),2]) |
| 96 | + id <- paste0(gsub(" ", "",tolower(id_cd[which(id_cd$id_names == this_id),1])), |
| 97 | + dat[which(dat$data == "year"),2], |
| 98 | + toupper(substr(dat[which(dat$data == "author1"),2],1,1))) |
| 99 | + |
| 100 | + citation <- dat[which(dat$data == "citation"),2] %>% pull() |
| 101 | + figure <- glue("assets/images/{citation}.png") |
| 102 | + git_repo <- glue("https://github.com/zipkinlab/{citation}") |
| 103 | + title <- pull(dat[which(dat$data == "title"),2]) |
| 104 | + fig_height <- as.numeric(pull(dat[which(dat$data == "fig_height"),2])) |
| 105 | + fig_width <- as.numeric(pull(dat[which(dat$data == "fig_width"),2])) |
| 106 | + |
| 107 | + FigSize <- function(OriginalWidth, OriginalHeight, OutputWidth = 200){ |
| 108 | + WidthRatio <- OutputWidth / OriginalWidth |
| 109 | + OutputHeight <- OriginalHeight * WidthRatio |
| 110 | + return(list(round(OutputWidth), round(OutputHeight))) |
| 111 | + } |
| 112 | + |
| 113 | + res_fig <- FigSize(fig_width, fig_height) |
| 114 | + fig_width2 <- res_fig[[1]][1] |
| 115 | + fig_height2 <- res_fig[[2]][1] |
| 116 | + |
| 117 | + journal <- pull(dat[which(dat$data == "journal"),2]) |
| 118 | + year <- pull(dat[which(dat$data == "year"),2]) |
| 119 | + doi <- pull(dat[which(dat$data == "doi"),2]) |
| 120 | + doi_addr <- pull(dat[which(dat$data == "doi_addr"),2]) |
| 121 | + abstract <- pull(dat[which(dat$data == "abstract"),2]) |
| 122 | + numb_authors <- as.numeric(pull(dat[which(dat$data == "numb_authors"),2])) |
| 123 | + |
| 124 | + # Build author list with optional GitHub links |
| 125 | + ht2 <- c() |
| 126 | + for(i in 1:numb_authors){ |
| 127 | + author <- pull(dat[dat$data == paste0("author", i), 2]) |
| 128 | + github <- pull(dat[dat$data == paste0("github", i), 2]) |
| 129 | + if (is.na(github)) { |
| 130 | + ht2 <- c(ht2, paste0(author, ifelse(i < numb_authors, ", ", ""))) |
| 131 | + } else { |
| 132 | + link <- glue("<a href='{github}'>{author}</a>") |
| 133 | + ht2 <- c(ht2, ifelse(i == numb_authors && i > 1, paste0("and ", link), paste0(link, ", "))) |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + authors_html <- paste(ht2, collapse = "") |
| 138 | + html_content <- glue(" |
| 139 | + <h3 id='{id}'>{citation}</h3> |
| 140 | + <section class='example'> |
| 141 | + <section class='title'> |
| 142 | + <h1>{title}</h1> |
| 143 | + <img class='modal-img' src='{figure}' alt='{citation}' height='{fig_height2}' width='{fig_width2}' style='background-color:white;' > |
| 144 | + </section> |
| 145 | + <section class='content'> |
| 146 | + <p><strong>Citation</strong> - {authors_html} ({year}) {title}. <em>{journal}</em>. <a href='{doi_addr}'>DOI: {doi}</a></p> |
| 147 | + <p><strong>Abstract</strong> - {abstract}</p> |
| 148 | + <p><strong>Code and Data</strong> - <a href='{git_repo}'>Link to repo</a></p> |
| 149 | + </section> |
| 150 | + </section> |
| 151 | + ") |
| 152 | + |
| 153 | + writeLines(html_content, "git_text.txt") |
| 154 | + writeLines(glue("<em> <a href='#{id}'>{citation}</a></em> |"), "git_title.txt") |
| 155 | + ```` |
| 156 | + |
| 157 | + </details><br> |
| 158 | + |
| 159 | +- Paste the text from `git_text.txt` and `git_title.txt` into the `index.html` file (you have to hit 'edit' and commit it!). |
| 160 | + <br> |
| 161 | +- Add a figure (.PNG) to the [assets/images/](https://github.com/zipkinlab/zipkinlab.github.io/tree/master/assets/images) folder on GitHub. The figure name should match the citation (e.g., `Zipkin_etal_2025_MEE.png`). |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +### 4 - Add metadata to the `Archived-data` repository |
| 166 | + |
| 167 | +- Upload the relevant data/code links to the [Archived-data repo](https://github.com/zipkinlab/Archived-data). |
| 168 | + |
| 169 | +--- |
| 170 | + |
| 171 | +#### Open the [Zipkin Lab Code Archive](https://zipkinlab.github.io/) to check if your edits are correct and... |
| 172 | + |
| 173 | +## 🎉 YAY, you are done!!! |
| 174 | +--- |
| 175 | +**Author:** Bruna Amaral |
0 commit comments