Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@

const organisations = organisationData.flatMap(data =>
data.organisations.map(organisation => ({
text: getLocalizedText(organisation.name, i18n.language),
text: getLocalizedText(organisation.name, i18n.language) + (organisation.alternativeName ? ` (${getLocalizedText(organisation.alternativeName, i18n.language)})` : ""),
value: organisation.id,
group: getLocalizedText(data.name, i18n.language) + " (" + getLocalizedText(data.abbreviation, i18n.language) + ")",
group: `${getLocalizedText(data.name, i18n.language)} (${getLocalizedText(data.abbreviation, i18n.language)})`,
}))
);

Expand Down Expand Up @@ -235,7 +235,7 @@
const checkPubliccodeYmlVersion = useCallback((publicCode: PublicCode) => {
const { publiccodeYmlVersion } = publicCode;
setPubliccodeYmlVersion(publiccodeYmlVersion);
}, []);

Check warning on line 238 in src/app/components/Editor.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useCallback has a missing dependency: 'setPubliccodeYmlVersion'. Either include it or remove the dependency array

Check warning on line 238 in src/app/components/Editor.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useCallback has a missing dependency: 'setPubliccodeYmlVersion'. Either include it or remove the dependency array

const checkItCountryExtensionVersion = useCallback(
(publicCode: PublicCode) => {
Expand All @@ -255,7 +255,7 @@

setShowCountryExtensionVersion(countryExtensionVersionVisible);
},
[]

Check warning on line 258 in src/app/components/Editor.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useCallback has a missing dependency: 'setShowCountryExtensionVersion'. Either include it or remove the dependency array

Check warning on line 258 in src/app/components/Editor.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useCallback has a missing dependency: 'setShowCountryExtensionVersion'. Either include it or remove the dependency array
);

useFormPersist("form-values", {
Expand All @@ -267,7 +267,7 @@
checkPubliccodeYmlVersion(pc);
checkItCountryExtensionVersion(pc);
},
[setLanguages]

Check warning on line 270 in src/app/components/Editor.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useCallback has missing dependencies: 'checkItCountryExtensionVersion' and 'checkPubliccodeYmlVersion'. Either include them or remove the dependency array

Check warning on line 270 in src/app/components/Editor.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useCallback has missing dependencies: 'checkItCountryExtensionVersion' and 'checkPubliccodeYmlVersion'. Either include them or remove the dependency array
),
storage: window?.localStorage, // default window.sessionStorage
exclude: [],
Expand Down Expand Up @@ -485,7 +485,7 @@
yamlLoadEventBus.off("loadRemoteYaml", loadRemoteYamlHandler);
yamlLoadEventBus.off("loadFileYaml", loadFileYamlHandler);
};
}, []);

Check warning on line 488 in src/app/components/Editor.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useEffect has missing dependencies: 'loadFileYamlHandler' and 'loadRemoteYamlHandler'. Either include them or remove the dependency array

Check warning on line 488 in src/app/components/Editor.tsx

View workflow job for this annotation

GitHub Actions / test

React Hook useEffect has missing dependencies: 'loadFileYamlHandler' and 'loadRemoteYamlHandler'. Either include them or remove the dependency array

return (
<div className="content__editor-wrapper">
Expand Down
6 changes: 3 additions & 3 deletions src/app/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

The data in the file `organisations.json` originates from the following sources:

- The seven departements and the Federal Chancellery (`departements.json`)
- The seven departments and the Federal Chancellery (`departements.json`)
```
https://ld.admin.ch/sparql/#query=PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0APREFIX%20rdf%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0ASELECT%20DISTINCT%20%3Fdepartment%20%3FnameDepDe%20%3FnameDepFr%20%3FnameDepIt%20%3FnameDepEn%20%3FaltNameDepDe%20%3FaltNameDepFr%20%3FaltNameDepIt%20%3FaltNameDepEn%20%3Foffice%20%3FnameDe%20%3FnameFr%20%3FnameIt%20%3FnameEn%20WHERE%20%7B%0A%20%20%0A%20%20%3Fdepartment%20schema%3AinDefinedTermSet%20%3Chttps%3A%2F%2Fld.admin.ch%2Fdimension%2Fdepartment%3E.%0A%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDe.%20FILTER(lang(%3FnameDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameFr.%20FILTER(lang(%3FnameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameIt.%20FILTER(lang(%3FnameIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameEn.%20FILTER(lang(%3FnameEn)%20%3D%20%22en%22)%20%7D%0A%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDe.%20FILTER(lang(%3FaltNameDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameFr.%20FILTER(lang(%3FaltNameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameIt.%20FILTER(lang(%3FaltNameIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameEn.%20FILTER(lang(%3FaltNameEn)%20%3D%20%22en%22)%20%7D%0A%20%20%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepDe.%20FILTER(lang(%3FnameDepDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepFr.%20FILTER(lang(%3FnameDepFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepIt.%20FILTER(lang(%3FnameDepIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepEn.%20FILTER(lang(%3FnameDepEn)%20%3D%20%22en%22)%20%7D%0A%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepDe.%20FILTER(lang(%3FaltNameDepDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepFr.%20FILTER(lang(%3FaltNameDepFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepIt.%20FILTER(lang(%3FaltNameDepIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepEn.%20FILTER(lang(%3FaltNameDepEn)%20%3D%20%22en%22)%20%7D%0A%0A%7D%0A&endpoint=https%3A%2F%2Fld.admin.ch%2Fquery&requestMethod=POST&tabTitle=Query&headers=%7B%7D&contentTypeConstruct=text%2Fturtle&contentTypeSelect=application%2Fsparql-results%2Bjson&outputFormat=table&outputSettings=%7B%22isEllipsed%22%3Atrue%2C%22compact%22%3Afalse%7D
```

- All offices of the seven departments (`offices.json`)
```
https://ld.admin.ch/sparql/#query=PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0APREFIX%20rdf%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0ASELECT%20DISTINCT%20%3Fdepartment%20%3FnameDepDe%20%3FnameDepFr%20%3FnameDepIt%20%3FnameDepEn%20%3FaltNameDepDe%20%3FaltNameDepFr%20%3FaltNameDepIt%20%3FaltNameDepEn%20%3Foffice%20%3FnameDe%20%3FnameFr%20%3FnameIt%20%3FnameEn%20WHERE%20%7B%0A%20%0A%20%20%3Foffice%20schema%3AinDefinedTermSet%20%3Chttps%3A%2F%2Fld.admin.ch%2Foffice%3E.%0A%20%20%3Foffice%20schema%3AparentOrganization%20%3Fdepartment.%0A%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameDe.%20FILTER(lang(%3FnameDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameFr.%20FILTER(lang(%3FnameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameIt.%20FILTER(lang(%3FnameIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameEn.%20FILTER(lang(%3FnameEn)%20%3D%20%22en%22)%20%7D%0A%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameDe.%20FILTER(lang(%3FaltNameDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameFr.%20FILTER(lang(%3FaltNameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameIt.%20FILTER(lang(%3FaltNameIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameEn.%20FILTER(lang(%3FaltNameEn)%20%3D%20%22en%22)%20%7D%0A%20%20%0A%20%20%3Fdepartment%20schema%3AinDefinedTermSet%20%3Chttps%3A%2F%2Fld.admin.ch%2Fdepartment%3E.%0A%20%20%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepDe.%20FILTER(lang(%3FnameDepDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepFr.%20FILTER(lang(%3FnameDepFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepIt.%20FILTER(lang(%3FnameDepIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepEn.%20FILTER(lang(%3FnameDepEn)%20%3D%20%22en%22)%20%7D%0A%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepDe.%20FILTER(lang(%3FaltNameDepDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepFr.%20FILTER(lang(%3FaltNameDepFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepIt.%20FILTER(lang(%3FaltNameDepIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepEn.%20FILTER(lang(%3FaltNameDepEn)%20%3D%20%22en%22)%20%7D%0A%0A%7D%0A&endpoint=https%3A%2F%2Fld.admin.ch%2Fquery&requestMethod=POST&tabTitle=Query&headers=%7B%7D&contentTypeConstruct=text%2Fturtle&contentTypeSelect=application%2Fsparql-results%2Bjson&outputFormat=table&outputSettings=%7B%22pageSize%22%3A-1%7D
https://ld.admin.ch/sparql/#query=PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0APREFIX%20rdf%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0ASELECT%20DISTINCT%20%3Fdepartment%20%3FnameDepDe%20%3FnameDepFr%20%3FnameDepIt%20%3FnameDepEn%20%3FaltNameDepDe%20%3FaltNameDepFr%20%3FaltNameDepIt%20%3FaltNameDepEn%20%3Foffice%20%3FnameDe%20%3FnameFr%20%3FnameIt%20%3FnameEn%20%3FaltNameDe%20%3FaltNameFr%20%3FaltNameIt%20%3FaltNameEn%20WHERE%20%7B%0A%20%0A%20%20%3Foffice%20schema%3AinDefinedTermSet%20%3Chttps%3A%2F%2Fld.admin.ch%2Foffice%3E.%0A%20%20%3Foffice%20schema%3AparentOrganization%20%3Fdepartment.%0A%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameDe.%20FILTER(lang(%3FnameDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameFr.%20FILTER(lang(%3FnameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameIt.%20FILTER(lang(%3FnameIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameEn.%20FILTER(lang(%3FnameEn)%20%3D%20%22en%22)%20%7D%0A%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameDe.%20FILTER(lang(%3FaltNameDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameFr.%20FILTER(lang(%3FaltNameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameIt.%20FILTER(lang(%3FaltNameIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameEn.%20FILTER(lang(%3FaltNameEn)%20%3D%20%22en%22)%20%7D%0A%20%20%0A%20%20%3Fdepartment%20schema%3AinDefinedTermSet%20%3Chttps%3A%2F%2Fld.admin.ch%2Fdepartment%3E.%0A%20%20%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepDe.%20FILTER(lang(%3FnameDepDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepFr.%20FILTER(lang(%3FnameDepFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepIt.%20FILTER(lang(%3FnameDepIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepEn.%20FILTER(lang(%3FnameDepEn)%20%3D%20%22en%22)%20%7D%0A%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepDe.%20FILTER(lang(%3FaltNameDepDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepFr.%20FILTER(lang(%3FaltNameDepFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepIt.%20FILTER(lang(%3FaltNameDepIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepEn.%20FILTER(lang(%3FaltNameDepEn)%20%3D%20%22en%22)%20%7D%0A%0A%7D%0A&endpoint=https%3A%2F%2Fld.admin.ch%2Fquery&requestMethod=POST&tabTitle=Query&headers=%7B%7D&contentTypeConstruct=text%2Fturtle&contentTypeSelect=application%2Fsparql-results%2Bjson&outputFormat=table&outputSettings=%7B%22pageSize%22%3A-1%7D
```

Additionally, some special cases are added in `additional-organisations.json`. These are organisations are part of organisations returned in the above queries and must be added manually. It would be possible to fetch all organisations recursevely with the above queries, but that would yield too many organisations!
Expand All @@ -20,5 +20,5 @@ Additionally, some special cases are added in `additional-organisations.json`. T
It can be (re-)generated by running:

```bash
npx run build:organisations
npm run build:organisations
```
102 changes: 72 additions & 30 deletions src/app/data/additional-organisations.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,82 @@
[
{
"id": "https://ld.admin.ch/department/I",
"organisations": [ ]
"organisations": []
},
{
"id": "https://ld.admin.ch/department/II",
"organisations": [ ]
"organisations": []
},
{
"id": "https://ld.admin.ch/department/III",
"organisations": [
{
"id": "https://ld.admin.ch/ou/10009470",
"name": {
"de": "Informatik Service Center ISC-EJPD",
"fr": "Centre de services informatiques CSI-DFJP",
"it": "Centro servizi informatici CSI-DFGP",
"en": "Informatik Service Center ISC-EJPD"
"de": "Informatik Service Center",
"fr": "Centre de services informatiques",
"it": "Centro servizi informatici",
"en": "Informatik Service Center"
},
"alternativeName": {
"de": "ISC-EJPD",
"fr": "CSI-DFJP",
"it": "CSI-DFGP",
"en": "ISC-EJPD"
}
}
]
},
{
"id": "https://ld.admin.ch/department/IV",
"organisations": [ ]
"organisations": []
},
{
"id": "https://ld.admin.ch/department/V",
"organisations": [
{
"id": "https://ld.admin.ch/ou/20048227",
"name": {
"de": "Digitale Verwaltung Schweiz DVS",
"fr": "Administration numérique suisse ANS",
"it": "Amministrazione digitale Svizzera ADS",
"en": "Digitale Verwaltung Schweiz DVS"
"de": "Digitale Verwaltung Schweiz",
"fr": "Administration numérique suisse",
"it": "Amministrazione digitale Svizzera",
"en": "Digitale Verwaltung Schweiz"
},
"alternativeName": {
"de": "DVS",
"fr": "ANS",
"it": "ADS",
"en": "DVS"
}
},
{
"id": "https://ld.admin.ch/ou/10001962",
"name": {
"de": "Eidgenössische Ausgleichskasse EAK",
"fr": "Caisse fédérale de compensation CFC",
"it": "Cassa federale di compensazione CFC",
"en": "Eidgenössische Ausgleichskasse EAK"
"de": "Eidgenössische Ausgleichskasse",
"fr": "Caisse fédérale de compensation",
"it": "Cassa federale di compensazione",
"en": "Eidgenössische Ausgleichskasse"
},
"alternativeName": {
"de": "EAK",
"fr": "CFC",
"it": "CFC",
"en": "EAK"
}
},
{
"id": "https://ld.admin.ch/ou/10001950",
"name": {
"de": "Zentrale Ausgleichsstelle ZAS",
"fr": "Centrale de compensation CdC",
"it": "Ufficio centrale di compensazione UCC",
"en": "Zentrale Ausgleichsstelle ZAS"
"de": "Zentrale Ausgleichsstelle",
"fr": "Centrale de compensation",
"it": "Ufficio centrale di compensazione",
"en": "Zentrale Ausgleichsstelle"
},
"alternativeName": {
"de": "ZAS",
"fr": "CdC",
"it": "UCC",
"en": "ZAS"
}
},
{
Expand All @@ -62,6 +86,12 @@
"fr": "Monnaie fédérale Swissmint",
"it": "Zecca federale Swissmint",
"en": "Eidgenössische Münzstätte Swissmint"
},
"alternativeName": {
"de": "SMT",
"fr": "SMT",
"it": "SMT",
"en": "SMT"
}
}
]
Expand All @@ -72,14 +102,20 @@
{
"id": "https://ld.admin.ch/ou/10008676",
"name": {
"de": "Wettbewerbskommission WEKO",
"fr": "Commission de la concurrence COMCO",
"it": "Commissione della concorrenza COMCO",
"en": "Wettbewerbskommission WEKO"
"de": "Wettbewerbskommission",
"fr": "Commission de la concurrence",
"it": "Commissione della concorrenza",
"en": "Wettbewerbskommission"
},
"alternativeName": {
"de": "WEKO",
"fr": "COMCO",
"it": "COMCO",
"en": "WEKO"
}
},
{
"id": "hhttps://ld.admin.ch/ou/10002660",
"id": "https://ld.admin.ch/ou/10002660",
"name": {
"de": "Büro für Konsumentenfragen",
"fr": "Bureau de la consommation",
Expand All @@ -90,13 +126,19 @@
{
"id": "https://ld.admin.ch/ou/10009853",
"name": {
"de": "Information Service Center WBF ISCeco",
"de": "Information Service Center WBF",
"fr": "Centre de services informatiques DEFR",
"it": "Informatica Centro Servizi DEFR",
"en": "Information Service Center WBF ISCeco"
"en": "Information Service Center WBF"
},
"alternativeName": {
"de": "ISCeco",
"fr": "L'ISCeco",
"it": "ISCeco",
"en": "ISCeco"
}
},
{
{
"id": "https://ld.admin.ch/ou/10003634",
"name": {
"de": "Agroscope",
Expand All @@ -109,10 +151,10 @@
},
{
"id": "https://ld.admin.ch/department/VII",
"organisations": [ ]
"organisations": []
},
{
"id": "https://ld.admin.ch/FCh",
"organisations": [ ]
"organisations": []
}
]
]
55 changes: 41 additions & 14 deletions src/app/data/generateOrganisations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
import * as fs from "fs";
import * as path from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand All @@ -24,6 +24,10 @@ interface OfficeBinding {
nameFr: SPARQLBinding;
nameIt: SPARQLBinding;
nameEn?: SPARQLBinding;
altNameDe?: SPARQLBinding;
altNameFr?: SPARQLBinding;
altNameIt?: SPARQLBinding;
altNameEn?: SPARQLBinding;
}

interface SPARQLResult {
Expand All @@ -42,6 +46,7 @@ interface MultilingualName {
interface Organisation {
id: string;
name: MultilingualName;
alternativeName?: MultilingualName;
}

interface Department {
Expand Down Expand Up @@ -117,8 +122,18 @@ function generateOrganisations(): void {
fr: office.nameFr.value,
it: office.nameIt.value,
en: office.nameEn?.value || '',
}
}))
},
...((office.altNameDe?.value?.trim() || office.altNameFr?.value?.trim() || office.altNameIt?.value?.trim() || office.altNameEn?.value?.trim())
? {
alternativeName: {
de: office.altNameDe?.value || '',
fr: office.altNameFr?.value || '',
it: office.altNameIt?.value || '',
en: office.altNameEn?.value || '',
},
}
: {}),
})),
};

departments.push(dept);
Expand All @@ -141,15 +156,27 @@ function generateOrganisations(): void {
it: binding.altNameDepIt.value,
en: binding.altNameDepEn?.value,
},
organisations: [{
id: deptId,
name: {
de: binding.nameDepDe.value,
fr: binding.nameDepFr.value,
it: binding.nameDepIt.value,
en: binding.nameDepEn?.value || '',
}
}]
organisations: [
{
id: deptId,
name: {
de: binding.nameDepDe.value,
fr: binding.nameDepFr.value,
it: binding.nameDepIt.value,
en: binding.nameDepEn?.value || '',
},
...((binding.altNameDe?.value?.trim() || binding.altNameFr?.value?.trim() || binding.altNameIt?.value?.trim() || binding.altNameEn?.value?.trim())
? {
alternativeName: {
de: binding.altNameDe?.value || '',
fr: binding.altNameFr?.value || '',
it: binding.altNameIt?.value || '',
en: binding.altNameEn?.value || '',
},
}
: {}),
},
],
};

departments.push(dept);
Expand Down
Loading
Loading