Research
  • Pipeline
  • Paper reading

Paper reading

d3 = require("d3")

papers = await fetch("https://api.andrewheiss.com/research_reading")
  .then(response => response.json())
  .then(data => data.map(d => ({
    ...d,  // Keep all existing elements in the array
    timestamp: new Date(d.timestamp_local_as_utc)  // Parse the date element as a date
  })))

Is it not a pleasure, having learned something, to try it out at due intervals?

學而時習之、不亦說乎

Analects 1:1
2024 reading goals!

I have a goal to read at least two academic articles every week in 2024 to work through the massive backlog of PDFs in my multiple “To Read” Zotero folders. Here’s where I’m tracking my progress.

Plot.plot({
  style: {
    fontSize: "16px",
    fontFamily: "Manrope",
    maxWidth: "1300px",
    overflow: "scroll"
  },
  
  marginLeft: 20,
  marginBottom: 40,
  // width,
  width: 1300,

  x: {
    label: "Week",
    domain: [new Date("2024-01-01"), new Date("2024-12-31")]
  },

  y: {
    label: "Papers read",
  },
  
  marks: [
    Plot.axisX({label: null}),
    
    Plot.ruleY([0]),
    Plot.axisY({label: null, ticks: 0, tickSize: 0}),
    
    Plot.ruleY([2], {stroke: "#E17C05", strokeDasharray: "3,2"}),
    
    Plot.rectY(papers, 
      Plot.binX(
        {y: "count"},  // Reducing function
        {
          x: "timestamp", 
          y: "total", 
          fill: "#A52C60",
          interval: d3.utcWeek,
          tip: {
            format: {
              // Format as nice date + remove 2 spaces for things like "January  2"
              x: (d) => d3.utcFormat("%B %e")(d).replace(/  +/g, ' '),
              y: true
            },
            fontSize: 14
          }
        }
      ),
    ),
    
    // Add glowy line for current date
    Plot.ruleX(
      [new Date()],
      {stroke: "#EDAD08", strokeWidth: 2, imageFilter: "drop-shadow(1px 1px 2px white)"}
    ),
  ]
})
table_settings = {
  return {
    sort: "timestamp",
    reverse: true,
    rows: 11.5,
    layout: "auto",
    columns: [
      "week_num",
      "timestamp",
      "doi_or_url",
      "citekey",
      "title",
      "author"
    ],
    header: {
      week_num: "Week",
      timestamp: "Date",
      doi_or_url: "URL",
      citekey: "Cite key",
      title: "Title",
      author: "Author"
    },
    format: {
      timestamp: x => {
        let date = new Date(x);
        return date.toLocaleString('en-US', {
          weekday: "long",
          month: "long",
          day: "numeric",
          year: "numeric"
        });
      },
      doi_or_url: url => url ? htl.html`<a href="${url}" target="_blank">${url}</a>` : ""
    }
  }
}
viewof search_table = Inputs.search(papers)
Inputs.table(search_table, table_settings)