From 4549cebc54cf4ec9ce1c7ac9d4a6b5a7db0945ca Mon Sep 17 00:00:00 2001 From: Daniel Bachler Date: Mon, 12 Aug 2024 12:38:50 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20incorporate=20feedback=20from=20?= =?UTF-8?q?Este=20-=20simplify=20metadata=20and=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/_common/grapherRenderer.ts | 19 +++++++++++++------ functions/_common/readmeTools.ts | 23 +++-------------------- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/functions/_common/grapherRenderer.ts b/functions/_common/grapherRenderer.ts index 58605d60a61..ce694861974 100644 --- a/functions/_common/grapherRenderer.ts +++ b/functions/_common/grapherRenderer.ts @@ -360,14 +360,22 @@ export async function fetchMetadataForGrapher( undefined ) + const titleShort = col.titlePublicOrDisplayName.title + const attributionShort = col.titlePublicOrDisplayName.attributionShort + const titleVariant = col.titlePublicOrDisplayName.titleVariant + const attributionString = + attributionShort && titleVariant + ? `${attributionShort} – ${titleVariant}` + : attributionShort || titleVariant + const titleModifier = attributionString ? ` - ${attributionString}` : "" + const titleLong = `${col.titlePublicOrDisplayName.title}${titleModifier}` + return [ useShortNames ? shortName : col.name, { - title: col.titlePublicOrDisplayName.title, - titleProducer: col.titlePublicOrDisplayName.attributionShort, - titleVariant: col.titlePublicOrDisplayName.titleVariant, + titleShort, + titleLong, descriptionShort, - descriptionFromProducer, descriptionKey, descriptionProcessing, shortUnit, @@ -377,14 +385,13 @@ export async function fetchMetadataForGrapher( type, conversionFactor: col.display?.conversionFactor, owidVariableId, - catalogPath, - sources: consensedOrigins, shortName, additionalInfo, lastUpdated, nextUpdate, citationShort, citationLong, + fullMetadata: `https://api.ourworldindata.org/v1/indicators/${owidVariableId}.metadata.json`, }, ] }) diff --git a/functions/_common/readmeTools.ts b/functions/_common/readmeTools.ts index d56200fa6b5..2ea9ec5468c 100644 --- a/functions/_common/readmeTools.ts +++ b/functions/_common/readmeTools.ts @@ -153,24 +153,6 @@ export function* getSources( if (source.retrievedFrom) yield `Retrieved from: ${source.retrievedFrom.trim()}` + markdownNewlineEnding - if (source.description) { - yield "" - yield "##### Description of the dataset" - yield* yieldMultilineTextAsLines(source.description).map( - (l) => `> ${l}` - ) - yield "" - } - if (source.citation) { - yield "" - yield "##### Citation" - yield "This is the citation of the original data obtained from the source, prior to any processing or adaptation by Our World in Data. We would usually prefer to use the Our World In Data citation format given at the bottom." + - markdownNewlineEnding - yield* yieldMultilineTextAsLines(source.citation).map( - (l) => `> ${l}` - ) - yield "" - } } } @@ -234,6 +216,9 @@ function* columnReadmeText(col: CoreColumn) { const attribution = getAttribution(def) const source = getSource(attribution, def) + + yield* getCitationLines(def, col) + yield `Source: ${source}` yield* getDescriptionLines(def, attribution) @@ -241,8 +226,6 @@ function* columnReadmeText(col: CoreColumn) { yield* getSources(def) yield* getDataProcessingLines(def) - - yield* getCitationLines(def, col) yield "" }