Skip to content

Commit

Permalink
Merge pull request #865 from CorrelAid/864-projects-db-adjust-to-sche…
Browse files Browse the repository at this point in the history
…ma-changes-for-data-types-and-project-types-and-add-translation-dict

close #864
  • Loading branch information
jstet authored Jan 21, 2025
2 parents 1546626 + 8d04d21 commit 52badfa
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 13 deletions.
58 changes: 58 additions & 0 deletions src/lib/data/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,35 @@ export default {
'contractType.contract': {text: 'Vertrag'},
'contractType.temporary': {text: 'Zeitlich begrenzt'},
'ics.cta': {text: 'Bleibe auf dem Laufenden mit unserem ICS-Feed:'},

// Project Types
'project_type.reporting': {text: 'Reporting'},
'project_type.visualization': {text: 'Visualisierung'},
'project_type.automation': {text: 'Automatisierung'},
'project_type.exploratory': {text: 'Explorative Analyse'},
'project_type.impact': {text: 'Wirkungsmessung'},
'project_type.modeling': {text: 'Modellierung'},
'project_type.ai': {text: 'KI'},
'project_type.nlp': {text: 'NLP'},
'project_type.open_source': {text: 'Open Source'},
'project_type.data_management': {text: 'Datenmanagement'},
'project_type.web_development': {text: 'Webentwicklung'},
'project_type.data_collection': {text: 'Datenerhebung'},

// Data Types
'data_type.survey': {text: 'Umfrage'},
'data_type.process': {text: 'Prozess'},
'data_type.open': {text: 'Open Data'},
'data_type.panel': {text: 'Panel'},
'data_type.administrative': {text: 'Verwaltung'},
'data_type.geospatial': {text: 'Geo'},
'data_type.time_series': {text: 'Time Series'},
'data_type.sensor': {text: 'Sensor'},
'data_type.multimedia': {text: 'Multimedia'},
'data_type.metadata': {text: 'Metadaten'},
'data_type.text': {text: 'Text'},
'data_type.graph': {text: 'Graph'},
'data_type.behavioral': {text: 'Verhalten'},
},
en: {
'misc.desc': {
Expand Down Expand Up @@ -138,5 +167,34 @@ export default {
'contractType.contract': {text: 'Contract'},
'contractType.temporary': {text: 'Temporary'},
'ics.cta': {text: 'Stay up to date with our ICS feed:'},

// Project Types
'project_type.reporting': {text: 'Reporting'},
'project_type.visualization': {text: 'Visualization'},
'project_type.automation': {text: 'Automation'},
'project_type.exploratory': {text: 'Exploratory Analysis'},
'project_type.impact': {text: 'Impact Measurement'},
'project_type.modeling': {text: 'Modeling'},
'project_type.ai': {text: 'AI'},
'project_type.nlp': {text: 'NLP'},
'project_type.open_source': {text: 'Open Source'},
'project_type.data_management': {text: 'Data Management'},
'project_type.web_development': {text: 'Web Development'},
'project_type.data_collection': {text: 'Data Collection'},

// Data Types
'data_type.survey': {text: 'Survey'},
'data_type.process': {text: 'Process'},
'data_type.open': {text: 'Open Data'},
'data_type.panel': {text: 'Panel'},
'data_type.administrative': {text: 'Administrative'},
'data_type.geospatial': {text: 'Geospatial'},
'data_type.time_series': {text: 'Time Series'},
'data_type.sensor': {text: 'Sensor'},
'data_type.multimedia': {text: 'Multimedia'},
'data_type.metadata': {text: 'Metadata'},
'data_type.text': {text: 'Text'},
'data_type.graph': {text: 'Graph'},
'data_type.behavioral': {text: 'Behavioral'},
},
};
6 changes: 4 additions & 2 deletions src/lib/js/parsing/processing/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
processPeople,
processOrganizations,
processProjectOutputs,
getProjectTypeTranslations,
getDataTypeTranslations,
} from './processingHelpers.js';

export function processLocalChapters(lc, locale) {
Expand Down Expand Up @@ -147,9 +149,9 @@ export function processProjects(project, locale) {
teaser: project.translations[0].teaser,
href: href,
teamSelection: teamSelection,
projectTypes: transformTypes(project.translations[0].type),
projectTypes: getProjectTypeTranslations(project.project_types, locale),
dataTypes: getDataTypeTranslations(project.data_types, locale),
organizationSector: sector,
dataTypes: transformTypes(project.translations[0].data),
endDate: project.end_date
? new Date(project.end_date)
: new Date(project.end_date_predicted),
Expand Down
12 changes: 12 additions & 0 deletions src/lib/js/parsing/processing/processingHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ export function processPeople(data, personOnly) {
return personParams;
}

export function getProjectTypeTranslations(projectTypes, locale) {
return projectTypes.map(
(type) => translate(locale, `project_type.${type}`, {}).text,
);
}

export function getDataTypeTranslations(dataTypes, locale) {
return dataTypes.map(
(type) => translate(locale, `data_type.${type}`, {}).text,
);
}

export function processOrganizations(project, locale, single) {
let procOrganization;
let description;
Expand Down
9 changes: 4 additions & 5 deletions src/lib/js/parsing/processing/single.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
translate,
transformTypes,
genWebsiteUrl,
processHtml,
getTranslation,
Expand All @@ -17,6 +16,8 @@ import {
processPeople,
processOrganizations,
processProjectOutputs,
getProjectTypeTranslations,
getDataTypeTranslations,
} from './processingHelpers.js';

import _ from 'lodash';
Expand Down Expand Up @@ -70,8 +71,6 @@ export function processBlogPost(blogPost, locale) {
}

export function processProject(project, locale) {
const projectTypes = transformTypes(project.translations[0].type, locale);
const dataTypes = transformTypes(project.translations[0].data, locale);
const lang = getLang(locale);

let teamSelection = void 0;
Expand All @@ -86,10 +85,10 @@ export function processProject(project, locale) {
return {
title: project.translations[0].title,
organization: processOrganizations(project, locale, true),
projectTypes: projectTypes,
teamSelection: teamSelection,
applicationLink: applicationLink,
dataTypes: dataTypes,
projectTypes: getProjectTypeTranslations(project.project_types, locale),
dataTypes: getDataTypeTranslations(project.data_types, locale),
description: project.translations[0].description
? processHtml(project.translations[0].description)
: void 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ query Project(
project_status
application_link
is_internal
data_types
project_types
Podcast {
soundcloud_link
}
Expand Down Expand Up @@ -65,8 +67,6 @@ query Project(
description
summary
teaser
type
data
}
Local_Chapters {
Local_Chapters_id {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ query ProjectOverview($language: String = "de-DE", $status: [String] = ["publish
is_internal
end_date_predicted
end_date
project_types
data_types
Podcast {
language
soundcloud_link
Expand Down Expand Up @@ -42,8 +44,6 @@ query ProjectOverview($language: String = "de-DE", $status: [String] = ["publish
translations(filter: { languages_code: { code: { _eq: $language } } }) {
title
teaser
type
data
}
Local_Chapters {
Local_Chapters_id (filter: { status: { _in: $status } }){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ query LocalChapterDetails($slug: String, $language: String = "de-DE", $status: [
end_date
end_date_predicted
project_id
data_types
project_types
Podcast {
language
soundcloud_link
Expand Down Expand Up @@ -84,8 +86,6 @@ query LocalChapterDetails($slug: String, $language: String = "de-DE", $status: [
description
summary
teaser
type
data
}
Local_Chapters {
Local_Chapters_id{
Expand Down

0 comments on commit 52badfa

Please sign in to comment.