nextstrain / auspice

Web app for visualizing pathogen evolution
https://docs.nextstrain.org/projects/auspice/
GNU Affero General Public License v3.0
290 stars 159 forks source link

Allow multiple affiliations for authors & translators #951

Open jameshadfield opened 4 years ago

jameshadfield commented 4 years ago

Background

Currently the YAML frontmatter at the start of each narrative markdown file is parsed by this code into HTML to be rendered by the client as the fist page of the narrative. E.g. this YAML tuns into this narrative page.

Currently we display YAML fields title, authors, authorLinks, affiliations, translators, translatorLinks, date and updated.

PR #937 created a function which allowed authors+authorLinks (or translators+translatorLinks) to be arrays. However affiliations must be a string and represents all authors.

Changes requested

  1. We should extend the functions created in #937 to allow parsing of multiple affiliations. I think the cleanest way to do this is to require that if the type is an array then it must be the same length as authors. Duplicate affiliations (which will be the norm) should be specified separately by the frontmatter and grouped together by the parsing code. Unique affiliations should receive superscript arabic numerals (as we currently do, but it's always 1!), in a first-come-first-served fashion. Empty elements in the array should be allowed for authors without an affiliation.

  2. The key names should change to authorAffiliations and translatorAffiliations. For simplicity, they should be treated as independent objects for rendering purposes. For backwards compatibility, if affiliations is set it should be interpreted as authorAffiliations.

Note: It's possible for authors to have multiple affiliations. This would naturally be supported by nested arrays in YAML. This functionality isn't required for this issue, but could be part of it if you want!

@ncallaway would you be interested in this? (no problem if not)

ncallaway commented 4 years ago

@jameshadfield I'd be happy to take a look at this. I'm pretty busy Monday, but should be able to take a look at this on Tuesday.

CameronDevine commented 4 years ago

@jameshadfield

What do you think of the format JOSS uses for it's authors and affiliations?

Below is an excerpt from the frontmatter of their example paper, documented here:

authors:
  - name: Adrian M. Price-Whelan
    orcid: 0000-0003-0872-7098
    affiliation: "1, 2" # (Multiple affiliations must be quoted)
  - name: Author Without ORCID
    affiliation: 2
affiliations:
 - name: Lyman Spitzer, Jr. Fellow, Princeton University
   index: 1
 - name: Institution 2
   index: 2
tsibley commented 4 years ago

There's also the pandoc-scholar format as prior art.

CameronDevine commented 4 years ago

Below is an example of the pandoc-scholar format,

author:
  - Jane Doe:
      institute:
        - fosg
        - fop
      email: jane.doe@example.com
      orcid: 0000-0000-0000-0000
      equal_contributor: "yes"
      correspondence: "yes"
  - John Q. Doe:
      institute: fosg
      equal_contributor: "yes"
  - Peder Ås:
      institute: fosg
  - Juan Pérez:
      institute: acme
      email: juan.perez@example.edu
      correspondence: "yes"
institute:
  - fosg:
      name: Formatting Open Science Group
      address: 23 Science Street, Eureka, Mississippi, USA
      phone: +1 (555) 423 1338
      email: '{firstname}.{lastname}\@fosg.example.com'
  - fop: Federation of Planets
  - acme:
      name: Acme Corporation
CameronDevine commented 4 years ago

I think the JOSS format would be a little bit easier to parse, however neither one would be too difficult. With the number of authors on the narratives keeping track of the affiliations by index could prove difficult and error prone.

Also, does this need to be backwards compatible?

jameshadfield commented 4 years ago

Also, does this need to be backwards compatible?

Yes, any changes / additions to the narratives must be backwards compatible.

CameronDevine commented 4 years ago

@jameshadfield Do you have an opinion on what format to use for specifying names and affiliations?

CameronDevine commented 4 years ago

I tried to start working on this today, but I couldn't find where the YAML frontmatter is converted into HTML. Does anyone know where this happens?

tsibley commented 4 years ago

@CameronDevine https://github.com/nextstrain/auspice/blob/master/cli/server/parseNarrative.js