Skip to content

Commit e343200

Browse files
committed
feat: add additional organisations when generating organisation.json
1 parent 775f057 commit e343200

3 files changed

Lines changed: 213 additions & 0 deletions

File tree

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)