Skip to content

Commit

Permalink
Merge pull request #1915 from visualize-admin/feat/confidence-interva…
Browse files Browse the repository at this point in the history
…ls-formatting

feat: Improve confidence intervals formatting
  • Loading branch information
bprusinowski authored Nov 26, 2024
2 parents e5ebe61 + e8c18e6 commit 3d066ba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
2 changes: 1 addition & 1 deletion app/charts/shared/chart-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ export const useNumericalYErrorVariables = (
const cil = getYConfidenceIntervalLower(d);
const ciu = getYConfidenceIntervalUpper(d);
const unit = yConfidenceIntervalUpperMeasure?.unit ?? "";
return ` -${cil}${unit}, +${ciu}${unit}`;
return `, [-${cil}${unit}, +${ciu}${unit}]`;
}
},
[
Expand Down
12 changes: 1 addition & 11 deletions app/rdf/light-cube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {
} from "@/domain/data";
import { getCubeMetadata } from "@/rdf/query-cube-metadata";
import { getCubePreview } from "@/rdf/query-cube-preview";
import {
getCubeComponentTermsets,
getCubeTermsets,
} from "@/rdf/query-termsets";
import { getCubeComponentTermsets } from "@/rdf/query-termsets";

type LightCubeOptions = {
iri: string;
Expand Down Expand Up @@ -48,13 +45,6 @@ export class LightCube {
return this.metadata;
}

public async fetchTermsets() {
return await getCubeTermsets(this.iri, {
locale: this.locale,
sparqlClient: this.sparqlClient,
});
}

public async fetchComponentTermsets() {
return await getCubeComponentTermsets(this.iri, {
locale: this.locale,
Expand Down
28 changes: 1 addition & 27 deletions app/rdf/query-termsets.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
import groupBy from "lodash/groupBy";
import ParsingClient from "sparql-http-client/ParsingClient";

import { ComponentTermsets, Termset } from "@/domain/data";
import { ComponentTermsets } from "@/domain/data";
import { stringifyComponentId } from "@/graphql/make-component-id";
import { queryCubeUnversionedIri } from "@/rdf/query-cube-unversioned-iri";
import { buildLocalizedSubQuery } from "@/rdf/query-utils";

export const getCubeTermsets = async (
iri: string,
options: {
locale: string;
sparqlClient: ParsingClient;
}
): Promise<Termset[]> => {
const { sparqlClient, locale } = options;
const qs = await sparqlClient.query.select(
`PREFIX meta: <https://cube.link/meta/>
PREFIX schema: <http://schema.org/>
SELECT DISTINCT ?termsetIri ?termsetLabel WHERE {
?termsetIri meta:isUsedIn <${iri}> .
${buildLocalizedSubQuery("termsetIri", "schema:name", "termsetLabel", { locale })}
}`,
{ operation: "postUrlencoded" }
);

return qs.map((result) => ({
iri: result.termsetIri.value,
label: result.termsetLabel.value,
__typename: "Termset",
}));
};

export const getCubeComponentTermsets = async (
iri: string,
options: {
Expand Down

0 comments on commit 3d066ba

Please sign in to comment.