Skip to content

Commit c23ccb4

Browse files
authored
feat: add additional organisations when generating organisation.json
* feat: add additional organisations when generating organisation.json * chore: add note on additional organisations
1 parent 775f057 commit c23ccb4

4 files changed

Lines changed: 216 additions & 0 deletions

File tree

src/app/data/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ https://ld.admin.ch/sparql/#query=PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.or
1414
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
1515
```
1616

17+
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!
18+
19+
1720
It can be (re-)generated by running:
1821

1922
```bash
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
[
2+
{
3+
"id": "https://ld.admin.ch/department/I",
4+
"organisations": [ ]
5+
},
6+
{
7+
"id": "https://ld.admin.ch/department/II",
8+
"organisations": [ ]
9+
},
10+
{
11+
"id": "https://ld.admin.ch/department/III",
12+
"organisations": [
13+
{
14+
"id": "https://ld.admin.ch/ou/10009470",
15+
"name": {
16+
"de": "Informatik Service Center ISC-EJPD",
17+
"fr": "Centre de services informatiques CSI-DFJP",
18+
"it": "Centro servizi informatici CSI-DFGP",
19+
"en": "Informatik Service Center ISC-EJPD"
20+
}
21+
}
22+
]
23+
},
24+
{
25+
"id": "https://ld.admin.ch/department/IV",
26+
"organisations": [ ]
27+
},
28+
{
29+
"id": "https://ld.admin.ch/department/V",
30+
"organisations": [
31+
{
32+
"id": "https://ld.admin.ch/ou/20048227",
33+
"name": {
34+
"de": "Digitale Verwaltung Schweiz DVS",
35+
"fr": "Administration numérique suisse ANS",
36+
"it": "Amministrazione digitale Svizzera ADS",
37+
"en": "Digitale Verwaltung Schweiz DVS"
38+
}
39+
},
40+
{
41+
"id": "https://ld.admin.ch/ou/10001962",
42+
"name": {
43+
"de": "Eidgenössische Ausgleichskasse EAK",
44+
"fr": "Caisse fédérale de compensation CFC",
45+
"it": "Cassa federale di compensazione CFC",
46+
"en": "Eidgenössische Ausgleichskasse EAK"
47+
}
48+
},
49+
{
50+
"id": "https://ld.admin.ch/ou/10001950",
51+
"name": {
52+
"de": "Zentrale Ausgleichsstelle ZAS",
53+
"fr": "Centrale de compensation CdC",
54+
"it": "Ufficio centrale di compensazione UCC",
55+
"en": "Zentrale Ausgleichsstelle ZAS"
56+
}
57+
},
58+
{
59+
"id": "https://ld.admin.ch/ou/10003314",
60+
"name": {
61+
"de": "Eidgenössische Münzstätte Swissmint",
62+
"fr": "Monnaie fédérale Swissmint",
63+
"it": "Zecca federale Swissmint",
64+
"en": "Eidgenössische Münzstätte Swissmint"
65+
}
66+
}
67+
]
68+
},
69+
{
70+
"id": "https://ld.admin.ch/department/VI",
71+
"organisations": [
72+
{
73+
"id": "https://ld.admin.ch/ou/10008676",
74+
"name": {
75+
"de": "Wettbewerbskommission WEKO",
76+
"fr": "Commission de la concurrence COMCO",
77+
"it": "Commissione della concorrenza COMCO",
78+
"en": "Wettbewerbskommission WEKO"
79+
}
80+
},
81+
{
82+
"id": "hhttps://ld.admin.ch/ou/10002660",
83+
"name": {
84+
"de": "Büro für Konsumentenfragen",
85+
"fr": "Bureau de la consommation",
86+
"it": "Ufficio del consumo",
87+
"en": "Büro für Konsumentenfragen"
88+
}
89+
},
90+
{
91+
"id": "https://ld.admin.ch/ou/10009853",
92+
"name": {
93+
"de": "Information Service Center WBF ISCeco",
94+
"fr": "Centre de services informatiques DEFR",
95+
"it": "Informatica Centro Servizi DEFR",
96+
"en": "Information Service Center WBF ISCeco"
97+
}
98+
},
99+
{
100+
"id": "https://ld.admin.ch/ou/10003634",
101+
"name": {
102+
"de": "Agroscope",
103+
"fr": "Agroscope",
104+
"it": "Agroscope",
105+
"en": "Agroscope"
106+
}
107+
}
108+
]
109+
},
110+
{
111+
"id": "https://ld.admin.ch/department/VII",
112+
"organisations": [ ]
113+
},
114+
{
115+
"id": "https://ld.admin.ch/FCh",
116+
"organisations": [ ]
117+
}
118+
]

src/app/data/generateOrganisations.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ interface Department {
5454
function generateOrganisations(): void {
5555
const officesPath = path.join(__dirname, 'offices.json');
5656
const departementsPath = path.join(__dirname, 'departements.json');
57+
const additionalOrganisationsPath = path.join(__dirname, 'additional-organisations.json');
5758
const outputPath = path.join(__dirname, 'organisations.json');
5859

5960
const officesData: SPARQLResult = JSON.parse(fs.readFileSync(officesPath, 'utf-8'));
6061
const departementsData: SPARQLResult = JSON.parse(fs.readFileSync(departementsPath, 'utf-8'));
62+
const additionalOrganisationsData: { id: string; organisations: Organisation[] }[] = JSON.parse(fs.readFileSync(additionalOrganisationsPath, 'utf-8'));
6163

6264
// Group offices by department
6365
const departmentMap = new Map<string, {
@@ -154,6 +156,18 @@ function generateOrganisations(): void {
154156
}
155157
}
156158

159+
for (const additional of additionalOrganisationsData) {
160+
const department = departments.find(d => d.id === additional.id);
161+
if (!department) continue;
162+
163+
for (const org of additional.organisations) {
164+
const exists = department.organisations.some(existing => existing.id === org.id);
165+
if (!exists) {
166+
department.organisations.push(org);
167+
}
168+
}
169+
}
170+
157171
fs.writeFileSync(outputPath, JSON.stringify(departments, null, 2) + '\n');
158172

159173
console.log(`✓ Successfully generated ${outputPath}`);

src/app/data/organisations.json

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,15 @@
317317
"it": "Ufficio federale di polizia",
318318
"en": "Federal Office of Police"
319319
}
320+
},
321+
{
322+
"id": "https://ld.admin.ch/ou/10009470",
323+
"name": {
324+
"de": "Informatik Service Center ISC-EJPD",
325+
"fr": "Centre de services informatiques CSI-DFJP",
326+
"it": "Centro servizi informatici CSI-DFGP",
327+
"en": "Informatik Service Center ISC-EJPD"
328+
}
320329
}
321330
]
322331
},
@@ -558,6 +567,42 @@
558567
"it": "Amministrazione federale delle contribuzioni",
559568
"en": "Federal Tax Administration"
560569
}
570+
},
571+
{
572+
"id": "https://ld.admin.ch/ou/20048227",
573+
"name": {
574+
"de": "Digitale Verwaltung Schweiz DVS",
575+
"fr": "Administration numérique suisse ANS",
576+
"it": "Amministrazione digitale Svizzera ADS",
577+
"en": "Digitale Verwaltung Schweiz DVS"
578+
}
579+
},
580+
{
581+
"id": "https://ld.admin.ch/ou/10001962",
582+
"name": {
583+
"de": "Eidgenössische Ausgleichskasse EAK",
584+
"fr": "Caisse fédérale de compensation CFC",
585+
"it": "Cassa federale di compensazione CFC",
586+
"en": "Eidgenössische Ausgleichskasse EAK"
587+
}
588+
},
589+
{
590+
"id": "https://ld.admin.ch/ou/10001950",
591+
"name": {
592+
"de": "Zentrale Ausgleichsstelle ZAS",
593+
"fr": "Centrale de compensation CdC",
594+
"it": "Ufficio centrale di compensazione UCC",
595+
"en": "Zentrale Ausgleichsstelle ZAS"
596+
}
597+
},
598+
{
599+
"id": "https://ld.admin.ch/ou/10003314",
600+
"name": {
601+
"de": "Eidgenössische Münzstätte Swissmint",
602+
"fr": "Monnaie fédérale Swissmint",
603+
"it": "Zecca federale Swissmint",
604+
"en": "Eidgenössische Münzstätte Swissmint"
605+
}
561606
}
562607
]
563608
},
@@ -764,6 +809,42 @@
764809
"it": "Segreteria di Stato per la formazione, la ricerca e l'innovazione",
765810
"en": "State Secretariat for Education, Research and Innovation"
766811
}
812+
},
813+
{
814+
"id": "https://ld.admin.ch/ou/10008676",
815+
"name": {
816+
"de": "Wettbewerbskommission WEKO",
817+
"fr": "Commission de la concurrence COMCO",
818+
"it": "Commissione della concorrenza COMCO",
819+
"en": "Wettbewerbskommission WEKO"
820+
}
821+
},
822+
{
823+
"id": "hhttps://ld.admin.ch/ou/10002660",
824+
"name": {
825+
"de": "Büro für Konsumentenfragen",
826+
"fr": "Bureau de la consommation",
827+
"it": "Ufficio del consumo",
828+
"en": "Büro für Konsumentenfragen"
829+
}
830+
},
831+
{
832+
"id": "https://ld.admin.ch/ou/10009853",
833+
"name": {
834+
"de": "Information Service Center WBF ISCeco",
835+
"fr": "Centre de services informatiques DEFR",
836+
"it": "Informatica Centro Servizi DEFR",
837+
"en": "Information Service Center WBF ISCeco"
838+
}
839+
},
840+
{
841+
"id": "https://ld.admin.ch/ou/10003634",
842+
"name": {
843+
"de": "Agroscope",
844+
"fr": "Agroscope",
845+
"it": "Agroscope",
846+
"en": "Agroscope"
847+
}
767848
}
768849
]
769850
},

0 commit comments

Comments
 (0)