-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚒️ finish refactoring of moving types into their own package
- Loading branch information
Showing
39 changed files
with
762 additions
and
520 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import { OwidOrigin } from "./OwidOrigin.js" | ||
import { OwidSource } from "./OwidSource.js" | ||
import { OwidVariableDisplayConfigInterface } from "./OwidVariableDisplayConfigInterface.js" | ||
|
||
export interface OwidVariableWithSource { | ||
id: number | ||
name?: string | ||
description?: string | ||
descriptionShort?: string | ||
descriptionFromProducer?: string | ||
descriptionKey?: string[] | ||
descriptionProcessing?: string | ||
unit?: string | ||
display?: OwidVariableDisplayConfigInterface | ||
shortUnit?: string | ||
datasetName?: string | ||
datasetId?: number | ||
coverage?: string | ||
nonRedistributable?: boolean | ||
source?: OwidSource | ||
origins?: OwidOrigin[] | ||
schemaVersion?: number | ||
processingLevel?: OwidProcessingLevel | ||
presentation?: OwidVariablePresentation | ||
shortName?: string | ||
timespan?: string | ||
catalogPath?: string | ||
license?: OwidLicense | ||
updatePeriodDays?: number | ||
datasetVersion?: string | ||
licenses?: OwidLicense[] | ||
|
||
// omitted: | ||
// code | ||
// coverage | ||
// dataPath | ||
// metadataPath | ||
} | ||
|
||
export interface IndicatorTitleWithFragments { | ||
title: string | ||
attributionShort?: string | ||
titleVariant?: string | ||
} | ||
|
||
export function joinTitleFragments( | ||
attributionShort: string | undefined, | ||
titleVariant: string | undefined | ||
): string | undefined { | ||
if (attributionShort && titleVariant && attributionShort !== titleVariant) { | ||
return `${titleVariant} – ${attributionShort}` | ||
} | ||
if (attributionShort) { | ||
return attributionShort | ||
} | ||
if (titleVariant) { | ||
return titleVariant | ||
} | ||
return undefined | ||
} | ||
|
||
export interface OwidLicense { | ||
name: string | ||
url: string | ||
} | ||
|
||
export interface OwidVariablePresentation { | ||
titlePublic?: string | ||
titleVariant?: string | ||
attributionShort?: string | ||
attribution?: string | ||
topicTagsLinks?: string[] | ||
faqs?: FaqLink[] | ||
grapherConfigETL?: string | ||
} | ||
|
||
export type OwidProcessingLevel = "minor" | "major" | ||
|
||
export interface FaqLink { | ||
gdocId: string | ||
fragmentId: string | ||
} | ||
|
||
export type OwidVariableWithSourceAndDimension = OwidVariableWithSource & { | ||
dimensions: OwidVariableDimensions | ||
} | ||
|
||
export type OwidVariableWithSourceAndDimensionWithoutId = Omit< | ||
OwidVariableWithSourceAndDimension, | ||
"id" | ||
> | ||
|
||
export interface OwidVariableMixedData { | ||
years: number[] | ||
entities: number[] | ||
values: (string | number)[] | ||
} | ||
|
||
export type OwidVariableWithDataAndSource = OwidVariableWithSource & | ||
OwidVariableMixedData | ||
|
||
export interface OwidVariableDimension { | ||
values: OwidVariableDimensionValuePartial[] | ||
} | ||
|
||
export interface OwidVariableDimensions { | ||
years: OwidVariableDimension | ||
entities: OwidVariableDimension | ||
} | ||
|
||
export type OwidVariableDataMetadataDimensions = { | ||
data: OwidVariableMixedData | ||
metadata: OwidVariableWithSourceAndDimension | ||
} | ||
export type MultipleOwidVariableDataDimensionsMap = Map< | ||
number, | ||
OwidVariableDataMetadataDimensions | ||
> | ||
|
||
export interface OwidVariableDimensionValuePartial { | ||
id: number | ||
name?: string | ||
code?: string | ||
} | ||
export type OwidVariableDimensionValueFull = | ||
Required<OwidVariableDimensionValuePartial> | ||
|
||
export interface OwidEntityKey { | ||
[id: string]: OwidVariableDimensionValuePartial | ||
} |
4 changes: 2 additions & 2 deletions
4
...src/OwidVariableDisplayConfigInterface.ts → ...src/OwidVariableDisplayConfigInterface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...orldindata/utils/src/dbTypes/ChartTags.ts → ...orldindata/types/src/dbTypes/ChartTags.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ourworldindata/utils/src/dbTypes/Posts.ts → ...ourworldindata/types/src/dbTypes/Posts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ndata/utils/src/dbTypes/PostsUtilities.ts → ...ndata/types/src/dbTypes/PostsUtilities.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...orldindata/utils/src/domainTypes/Posts.ts → ...orldindata/types/src/domainTypes/Posts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...urworldindata/utils/src/gdocTypes/Gdoc.ts → ...urworldindata/types/src/gdocTypes/Gdoc.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This is the JSON we get from Google's API before remapping the keys to be consistent with the rest of our interfaces | ||
export interface GDriveImageMetadata { | ||
name: string // -> filename | ||
modifiedTime: string // -> updatedAt e.g. "2023-01-11T19:45:27.000Z" | ||
id: string // -> googleId e.g. "1dfArzg3JrAJupVl4YyJpb2FOnBn4irPX" | ||
description?: string // -> defaultAlt | ||
imageMediaMetadata?: { | ||
width?: number // -> originalWidth | ||
} | ||
} | ||
|
||
export interface ImageMetadata { | ||
googleId: string | ||
filename: string | ||
defaultAlt: string | ||
// MySQL Date objects round to the nearest second, whereas Google includes milliseconds | ||
// so we store as an epoch to avoid any conversion issues | ||
updatedAt: number | ||
originalWidth?: number | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.