Skip to content

Commit

Permalink
Add trained_by field to metadata.yml and
Browse files Browse the repository at this point in the history
ModelCard.svelte

extract AuthorBrief.svelte from ModelCard
  • Loading branch information
janosh committed Nov 4, 2023
1 parent 31bac2d commit c778a03
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 21 deletions.
5 changes: 3 additions & 2 deletions models/alignn/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ authors:
- name: Brian DeCost
affiliation: National Institute of Standards and Technology
orcid: https://orcid.org/0000-0002-3459-5888
trained_by:
- name: Philipp Benner
affiliation: Bundesanstalt für Materialforschung und -prüfung BAM
orcid: https://orcid.org/0000-0002-0912-8137
affiliation: German Federal Institute of Materials Research and Testing (BAM)
orcid: 0000-0002-0912-8137
github: https://github.com/pbenner
repo: https://github.com/usnistgov/alignn
url: https://jarvis.nist.gov/jalignn
Expand Down
9 changes: 9 additions & 0 deletions models/mace/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ authors:
- name: Gabor Csanyi
affiliation: University of Cambridge
orcid: https://orcid.org/0000-0002-8180-2034
trained_by:
- name: Philipp Benner
affiliation: German Federal Institute of Materials Research and Testing (BAM)
orcid: 0000-0002-0912-8137
github: https://github.com/pbenner
- name: Yuan Chiang
affiliation: Lawrence Berkeley National Laboratory
orcid: 0000-0002-4017-7084
github: https://github.com/chiang-yuan
repo: https://github.com/ACEsuit/mace
doi: https://doi.org/10.48550/arXiv.2205.06643
preprint: https://arxiv.org/abs/2205.06643
Expand Down
29 changes: 29 additions & 0 deletions site/src/lib/AuthorBrief.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script lang="ts">
import type { Author } from '$lib'
import Icon from '@iconify/svelte'
export let author: Author
</script>

{#if author}
{@const { name, email, orcid, affiliation, url, github } = author}
<span title={affiliation}>{name}</span>
{#if email}
<a href="mailto:{email}"><Icon icon="ion:ios-mail" inline /></a>
{/if}
{#if orcid}
<a href={orcid}><Icon icon="fa-brands:orcid" inline /></a>
{/if}
{#if url}
<a href={url}><Icon icon="ion:ios-globe" inline /></a>
{/if}
{#if github}
<a href={github}><Icon icon="octicon:mark-github" inline /></a>
{/if}
{/if}

<style>
span {
font-size: smaller;
}
</style>
26 changes: 14 additions & 12 deletions site/src/lib/ModelCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { pretty_num } from 'elementari'
import { fade, slide } from 'svelte/transition'
import type { ModelData, ModelStatLabel } from '.'
import AuthorBrief from './AuthorBrief.svelte'
export let data: ModelData
export let stats: ModelStatLabel[] // [key, label, unit][]
Expand Down Expand Up @@ -86,27 +87,28 @@
<section transition:slide={{ duration: 200 }}>
<h3>Authors</h3>
<ul>
{#each data.authors as { name, email, orcid, affiliation, url }}
{#each data.authors as author (author.name)}
<li>
<span title={affiliation}>{name}</span>
{#if email}
<a href="mailto:{email}"><Icon icon="ion:ios-mail" inline /></a>
{/if}
{#if orcid}
<a href={orcid}><Icon icon="fa-brands:orcid" inline /></a>
{/if}
{#if url}
<a href={url}><Icon icon="ion:ios-globe" inline /></a>
{/if}
<AuthorBrief {author} />
</li>
{/each}
</ul>
{#if data.trained_by}
<h3>Trained By</h3>
<ul>
{#each data.trained_by as author (author.name)}
<li>
<AuthorBrief {author} />
</li>
{/each}
</ul>
{/if}
</section>
<section transition:slide={{ duration: 200 }}>
<h3>Package versions</h3>
<ul>
{#each Object.entries(data.requirements ?? {}) as [name, version]}
<li>
<li style="font-size: smaller;">
{#if ![`aviary`].includes(name)}
{@const href = `https://pypi.org/project/${name}/${version}`}
{name}: <a {href} {...target}>{version}</a>
Expand Down
18 changes: 11 additions & 7 deletions site/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as AuthorBrief } from './AuthorBrief.svelte'
export { default as CaptionedMetricsTable } from './CaptionedMetricsTable.svelte'
export { default as Footer } from './Footer.svelte'
export { default as ModelCard } from './ModelCard.svelte'
Expand All @@ -14,6 +15,7 @@ export type ModelMetadata = {
date_added: string
date_published?: string
authors: Author[]
trained_by?: Author[]
repo: string
url?: string
doi?: string
Expand Down Expand Up @@ -68,6 +70,14 @@ export type Author = {
orcid?: string
url?: string
twitter?: string
github?: string
}

// used in citation.cff
export type CffAuthor = Omit<Author, 'name'> & {
'family-names': string
'given-names': string
affil_key: string
}

export type Reference = {
Expand All @@ -86,13 +96,7 @@ export type Reference = {
export type Citation = {
title: string
subtitle?: string
authors: {
'family-names': string
'given-names': string
affiliation: string
affil_key: string
orcid: string
}[]
authors: CffAuthor[]
affiliations: string[]
'date-released': string
license: string
Expand Down

0 comments on commit c778a03

Please sign in to comment.