diff --git a/src/app/data/README.md b/src/app/data/README.md index 6b08b6a0..14b877f7 100644 --- a/src/app/data/README.md +++ b/src/app/data/README.md @@ -14,6 +14,9 @@ https://ld.admin.ch/sparql/#query=PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.or 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 ``` +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! + + It can be (re-)generated by running: ```bash diff --git a/src/app/data/additional-organisations.json b/src/app/data/additional-organisations.json new file mode 100644 index 00000000..18d79663 --- /dev/null +++ b/src/app/data/additional-organisations.json @@ -0,0 +1,118 @@ +[ + { + "id": "https://ld.admin.ch/department/I", + "organisations": [ ] + }, + { + "id": "https://ld.admin.ch/department/II", + "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" + } + } + ] + }, + { + "id": "https://ld.admin.ch/department/IV", + "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" + } + }, + { + "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" + } + }, + { + "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" + } + }, + { + "id": "https://ld.admin.ch/ou/10003314", + "name": { + "de": "Eidgenössische Münzstätte Swissmint", + "fr": "Monnaie fédérale Swissmint", + "it": "Zecca federale Swissmint", + "en": "Eidgenössische Münzstätte Swissmint" + } + } + ] + }, + { + "id": "https://ld.admin.ch/department/VI", + "organisations": [ + { + "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" + } + }, + { + "id": "hhttps://ld.admin.ch/ou/10002660", + "name": { + "de": "Büro für Konsumentenfragen", + "fr": "Bureau de la consommation", + "it": "Ufficio del consumo", + "en": "Büro für Konsumentenfragen" + } + }, + { + "id": "https://ld.admin.ch/ou/10009853", + "name": { + "de": "Information Service Center WBF ISCeco", + "fr": "Centre de services informatiques DEFR", + "it": "Informatica Centro Servizi DEFR", + "en": "Information Service Center WBF ISCeco" + } + }, + { + "id": "https://ld.admin.ch/ou/10003634", + "name": { + "de": "Agroscope", + "fr": "Agroscope", + "it": "Agroscope", + "en": "Agroscope" + } + } + ] + }, + { + "id": "https://ld.admin.ch/department/VII", + "organisations": [ ] + }, + { + "id": "https://ld.admin.ch/FCh", + "organisations": [ ] + } +] \ No newline at end of file diff --git a/src/app/data/generateOrganisations.ts b/src/app/data/generateOrganisations.ts index b3151918..b629b7c8 100644 --- a/src/app/data/generateOrganisations.ts +++ b/src/app/data/generateOrganisations.ts @@ -54,10 +54,12 @@ interface Department { function generateOrganisations(): void { const officesPath = path.join(__dirname, 'offices.json'); const departementsPath = path.join(__dirname, 'departements.json'); + const additionalOrganisationsPath = path.join(__dirname, 'additional-organisations.json'); const outputPath = path.join(__dirname, 'organisations.json'); const officesData: SPARQLResult = JSON.parse(fs.readFileSync(officesPath, 'utf-8')); const departementsData: SPARQLResult = JSON.parse(fs.readFileSync(departementsPath, 'utf-8')); + const additionalOrganisationsData: { id: string; organisations: Organisation[] }[] = JSON.parse(fs.readFileSync(additionalOrganisationsPath, 'utf-8')); // Group offices by department const departmentMap = new Map d.id === additional.id); + if (!department) continue; + + for (const org of additional.organisations) { + const exists = department.organisations.some(existing => existing.id === org.id); + if (!exists) { + department.organisations.push(org); + } + } + } + fs.writeFileSync(outputPath, JSON.stringify(departments, null, 2) + '\n'); console.log(`✓ Successfully generated ${outputPath}`); diff --git a/src/app/data/organisations.json b/src/app/data/organisations.json index 766ee121..9594bbd7 100644 --- a/src/app/data/organisations.json +++ b/src/app/data/organisations.json @@ -317,6 +317,15 @@ "it": "Ufficio federale di polizia", "en": "Federal Office of Police" } + }, + { + "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" + } } ] }, @@ -558,6 +567,42 @@ "it": "Amministrazione federale delle contribuzioni", "en": "Federal Tax Administration" } + }, + { + "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" + } + }, + { + "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" + } + }, + { + "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" + } + }, + { + "id": "https://ld.admin.ch/ou/10003314", + "name": { + "de": "Eidgenössische Münzstätte Swissmint", + "fr": "Monnaie fédérale Swissmint", + "it": "Zecca federale Swissmint", + "en": "Eidgenössische Münzstätte Swissmint" + } } ] }, @@ -764,6 +809,42 @@ "it": "Segreteria di Stato per la formazione, la ricerca e l'innovazione", "en": "State Secretariat for Education, Research and Innovation" } + }, + { + "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" + } + }, + { + "id": "hhttps://ld.admin.ch/ou/10002660", + "name": { + "de": "Büro für Konsumentenfragen", + "fr": "Bureau de la consommation", + "it": "Ufficio del consumo", + "en": "Büro für Konsumentenfragen" + } + }, + { + "id": "https://ld.admin.ch/ou/10009853", + "name": { + "de": "Information Service Center WBF ISCeco", + "fr": "Centre de services informatiques DEFR", + "it": "Informatica Centro Servizi DEFR", + "en": "Information Service Center WBF ISCeco" + } + }, + { + "id": "https://ld.admin.ch/ou/10003634", + "name": { + "de": "Agroscope", + "fr": "Agroscope", + "it": "Agroscope", + "en": "Agroscope" + } } ] },