├── static ├── .nojekyll ├── CNAME ├── robots.txt ├── favicon.ico ├── font │ ├── LICENSE │ ├── ubuntu-light.ttf │ ├── ubuntu-light.woff │ ├── ubuntu-light.woff2 │ ├── ubuntu-regular.ttf │ ├── ubuntu-regular.woff │ └── ubuntu-regular.woff2 ├── header.webp ├── health.webp ├── defense.webp ├── education.webp ├── factory.webp ├── og-banner.jpg ├── helicopter.webp ├── favicon-16x16.png ├── favicon-32x32.png ├── apple-touch-icon.png ├── economic-affairs.webp ├── public-order-safety.webp ├── social-protection.webp ├── environmental-protection.webp ├── general-public-services.webp ├── housing-community-amenities.webp ├── recreation-culture-religion.webp ├── .well-known │ └── security.txt ├── wikidata.svg ├── topic-icons │ ├── general-public-services.svg │ ├── education.svg │ ├── public-order-safety.svg │ ├── environmental-protection.svg │ ├── housing-community-amenities.svg │ ├── health.svg │ ├── defense.svg │ ├── recreation-culture-religion.svg │ ├── social-protection.svg │ └── economic-affairs.svg ├── social-icons │ ├── facebook.svg │ ├── X.svg │ ├── linkedin.svg │ ├── youtube.svg │ ├── mastodon.svg │ ├── instagram.svg │ └── website.svg ├── thirdparty │ └── octicons │ │ ├── code.svg │ │ └── note.svg ├── site.webmanifest ├── flag.svg ├── favicon-orange.svg ├── dpgbadge.svg ├── logo-white.svg └── logo-orange.svg ├── .gitignore ├── templates ├── components │ ├── spinner.html │ └── social-icons.html ├── map-data.json ├── helpers │ └── get-country-url.html ├── social-table.html ├── org-table.html ├── topic-list.html ├── country-list.html ├── sitemap.xml ├── 404.html ├── tools.html ├── countries-map.html ├── topic-page.html ├── landing.html ├── about.html ├── statistics.html ├── country-page.html ├── layouts │ └── layout.html └── statistics.svg ├── snowman.yaml ├── scripts ├── invalidate-social-media-country.sh ├── invalidate-optional-country.sh ├── tests │ └── spell-check.sh ├── check-labels.py └── check-expected-results-count.py ├── .github ├── ISSUE_TEMPLATE │ ├── other.yaml │ ├── config.yml │ ├── bug-report.yaml │ └── feature-request.yaml └── workflows │ ├── test.yml │ └── run-expected-count-script-on-pr.yml ├── SECURITY.md ├── queries ├── generators │ ├── uruguay.rq │ ├── peru.rq │ ├── united-states │ │ ├── new-york.rq │ │ └── north-carolina.rq │ ├── malta.rq │ ├── bermuda.rq │ ├── cameroon.rq │ ├── cuba.rq │ ├── malaysia.rq │ ├── ukraine.rq │ ├── united-kingdom.rq │ ├── canada.rq │ ├── czech-republic.rq │ ├── greenland.rq │ ├── nepal.rq │ ├── east-timor.rq │ ├── japan.rq │ ├── indonesia.rq │ ├── india.rq │ ├── iceland.rq │ ├── ghana.rq │ ├── russia.rq │ ├── singapore.rq │ ├── switzerland.rq │ ├── ireland.rq │ ├── philippines.rq │ ├── cyprus.rq │ ├── finland.rq │ ├── morocco.rq │ ├── latvia.rq │ ├── denmark.rq │ ├── south-africa.rq │ ├── portugal.rq │ ├── bulgaria.rq │ ├── chile.rq │ ├── luxembourg.rq │ ├── austria.rq │ ├── new-zealand.rq │ ├── norway.rq │ ├── germany.rq │ ├── united-states.rq │ ├── belgium.rq │ ├── netherlands.rq │ ├── sweden.rq │ └── united-kingdom │ │ └── scotland.rq ├── topics.rq ├── account-data.rq ├── organization-optional.rq └── countries.rq ├── justfile ├── PULL_REQUEST_TEMPLATE.md ├── CITATION.cff ├── DEPLOY.md ├── publiccode.yml ├── jargon.txt ├── CODE_OF_CONDUCT.md ├── README.md ├── views.yaml ├── LICENSE └── ADD_A_COUNTRY.md /static/.nojekyll: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /static/CNAME: -------------------------------------------------------------------------------- 1 | www.govdirectory.org -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | site/* 2 | .snowman/* 3 | snowman 4 | -------------------------------------------------------------------------------- /static/robots.txt: -------------------------------------------------------------------------------- 1 | Sitemap:https://www.govdirectory.org/sitemap.xml 2 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/favicon.ico -------------------------------------------------------------------------------- /static/font/LICENSE: -------------------------------------------------------------------------------- 1 | Ubuntu font licence 2 | 3 | https://ubuntu.com/legal/font-licence 4 | -------------------------------------------------------------------------------- /static/header.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/header.webp -------------------------------------------------------------------------------- /static/health.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/health.webp -------------------------------------------------------------------------------- /static/defense.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/defense.webp -------------------------------------------------------------------------------- /static/education.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/education.webp -------------------------------------------------------------------------------- /static/factory.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/factory.webp -------------------------------------------------------------------------------- /static/og-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/og-banner.jpg -------------------------------------------------------------------------------- /static/helicopter.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/helicopter.webp -------------------------------------------------------------------------------- /static/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/favicon-16x16.png -------------------------------------------------------------------------------- /static/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/favicon-32x32.png -------------------------------------------------------------------------------- /static/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/apple-touch-icon.png -------------------------------------------------------------------------------- /static/economic-affairs.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/economic-affairs.webp -------------------------------------------------------------------------------- /static/font/ubuntu-light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/font/ubuntu-light.ttf -------------------------------------------------------------------------------- /static/font/ubuntu-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/font/ubuntu-light.woff -------------------------------------------------------------------------------- /static/font/ubuntu-light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/font/ubuntu-light.woff2 -------------------------------------------------------------------------------- /static/font/ubuntu-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/font/ubuntu-regular.ttf -------------------------------------------------------------------------------- /static/font/ubuntu-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/font/ubuntu-regular.woff -------------------------------------------------------------------------------- /static/public-order-safety.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/public-order-safety.webp -------------------------------------------------------------------------------- /static/social-protection.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/social-protection.webp -------------------------------------------------------------------------------- /static/font/ubuntu-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/font/ubuntu-regular.woff2 -------------------------------------------------------------------------------- /static/environmental-protection.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/environmental-protection.webp -------------------------------------------------------------------------------- /static/general-public-services.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/general-public-services.webp -------------------------------------------------------------------------------- /static/housing-community-amenities.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/housing-community-amenities.webp -------------------------------------------------------------------------------- /static/recreation-culture-religion.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/govdirectory/website/HEAD/static/recreation-culture-religion.webp -------------------------------------------------------------------------------- /templates/components/spinner.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/.well-known/security.txt: -------------------------------------------------------------------------------- 1 | Contact: https://github.com/govdirectory/website/security 2 | Preferred-Languages: en 3 | Canonical: https://govdirectory.org/.well-known/security.txt 4 | Policy: https://github.com/govdirectory/website/blob/main/SECURITY.md 5 | 6 | -------------------------------------------------------------------------------- /snowman.yaml: -------------------------------------------------------------------------------- 1 | sparql_client: 2 | endpoint: "https://query.wikidata.org/sparql" 3 | http_headers: 4 | User-Agent: "govdirectory.org build configuration example https://github.com/govdirectory/website/issues" 5 | metadata: 6 | root_url: "https://www.govdirectory.org/" 7 | -------------------------------------------------------------------------------- /templates/map-data.json: -------------------------------------------------------------------------------- 1 | [ 2 | {{- range $i, $m := $ -}} 3 | {{- if contains $m.safeName "/" -}} 4 | {{- continue -}} 5 | {{- end -}} 6 | {{- if $i -}},{{- end -}} 7 | ["{{ $m.safeName}}", "{{ $m.geoshape }}", "{{ $m.name }}", "{{ $m.description }}"] 8 | {{- end -}} 9 | ] -------------------------------------------------------------------------------- /static/wikidata.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /templates/helpers/get-country-url.html: -------------------------------------------------------------------------------- 1 | {{/* "Function" takes the Wikidata URI for the country as input and "returns" the safeName */}} 2 | {{- $countryURI := . -}} 3 | {{- $countries := query "countries.rq" -}} 4 | {{- range $countries -}} 5 | {{- if eq .uri $countryURI -}} 6 | {{- .safeName -}} 7 | {{- end -}} 8 | {{- end -}} 9 | -------------------------------------------------------------------------------- /scripts/invalidate-social-media-country.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | if [[ $1 == "" ]] 4 | then 5 | echo "Missing the country argument." 6 | exit 0 7 | fi 8 | 9 | for i in $(find site/$1/* -type d); 10 | do 11 | qid=$(echo ${i%%/} | cut -f3 -d"/"); 12 | echo $qid 13 | snowman cache account-data.rq $qid --invalidate 14 | done 15 | -------------------------------------------------------------------------------- /scripts/invalidate-optional-country.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | if [[ $1 == "" ]] 4 | then 5 | echo "Missing the country argument." 6 | exit 0 7 | fi 8 | 9 | for i in $(find site/$1/* -type d); 10 | do 11 | qid=$(echo ${i%%/} | cut -f3 -d"/"); 12 | echo $qid 13 | snowman cache organization-optional.rq $qid --invalidate 14 | done 15 | -------------------------------------------------------------------------------- /static/topic-icons/general-public-services.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/social-icons/facebook.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /templates/social-table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{- range . -}} 8 | 9 | 10 | 11 | 12 | {{ end -}} 13 |
PlatformAccount
{{ .platformLabel }}{{ .account }}
14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.yaml: -------------------------------------------------------------------------------- 1 | name: Other 2 | description: If you are not sure if it's a feature, a bug or something else. 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | You can also start a [discussion](https://github.com/govdirectory/website/discussions). 8 | - type: textarea 9 | id: description 10 | attributes: 11 | label: Description 12 | description: Be bold. 13 | validations: 14 | required: true 15 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: CC0-1.0 2 | 3 | name: Test 4 | on: 5 | - push 6 | - pull_request 7 | 8 | defaults: 9 | run: 10 | shell: bash 11 | 12 | jobs: 13 | cibuild: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: install-deps 18 | run: > 19 | sudo apt-get install -y 20 | aspell 21 | aspell-en 22 | - run: ./scripts/tests/spell-check.sh 23 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Govdirectory Security Policy 2 | 3 | ## Scope 4 | 5 | This policy is intended for all resources available on `*.govdirectory.org*` and any repository in the Govdirectory GitHub organization. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | You can privately report a vulnerability to the Govdirectory team by [creating a security advisory on GitHub](https://github.com/govdirectory/website/security/advisories/new). This report will be kept private while it is being assessed by the team. 10 | 11 | -------------------------------------------------------------------------------- /static/thirdparty/octicons/code.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /static/topic-icons/education.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /templates/org-table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {{- range . -}} 12 | 13 | 14 | 15 | 16 | 17 | {{ end -}} 18 | 19 |
NamePlatformsType
{{ .orgLabel }}{{ include "components/social-icons.html" .qid.String }}{{ .typeLabel }}
20 | -------------------------------------------------------------------------------- /static/social-icons/X.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /queries/generators/uruguay.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 33 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q77 AS ?country) 11 | VALUES ?type { 12 | wd:Q134301525 # ministries (14) 13 | wd:Q56059 # department (19) 14 | } 15 | ?org wdt:P31 ?type . 16 | MINUS { ?org wdt:P576 [] } 17 | MINUS { ?org wdt:P1366 [] } 18 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 19 | 20 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,mul" } 21 | } 22 | ORDER BY ?type ?orgLabel 23 | -------------------------------------------------------------------------------- /static/social-icons/linkedin.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/topic-icons/public-order-safety.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/topic-icons/environmental-protection.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | @_default: 2 | just --list 3 | 4 | # build the full project 5 | build: 6 | snowman build --timeit 7 | 8 | # build the full project and once done, start the development server 9 | build-serve: 10 | snowman build --timeit && snowman server 11 | 12 | # only update the static files of the last build 13 | build-static: 14 | snowman build --static 15 | 16 | # clear all queries from the cache 17 | clear-cache: 18 | snowman cache --invalidate 19 | 20 | # setup a new cache from our remote cache repository 21 | bootstrap-cache: 22 | git clone https://github.com/govdirectory/website-cache .snowman 23 | 24 | -------------------------------------------------------------------------------- /queries/generators/peru.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 240 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q419 AS ?country) 11 | VALUES ?type { 12 | wd:Q6017592 # ministries (19) 13 | wd:Q861184 # regions (25) 14 | wd:Q509686 # provinces (196) 15 | } 16 | ?org wdt:P31 ?type . 17 | MINUS { ?org wdt:P576 [] } 18 | MINUS { ?org wdt:P1366 [] } 19 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 20 | 21 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,qu,ay,mul" } 22 | } 23 | ORDER BY ?type ?orgLabel 24 | -------------------------------------------------------------------------------- /queries/generators/united-states/new-york.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 159 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q30 AS ?country) 11 | VALUES ?type { 12 | wd:Q134016126 # state agencies (97) 13 | wd:Q13414757 # counties (62) 14 | } 15 | ?org wdt:P31 ?type . 16 | ?org wdt:P17 ?country . 17 | 18 | MINUS { ?org wdt:P576 [] } 19 | MINUS { ?org wdt:P1366 [] } 20 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 21 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } 22 | } 23 | ORDER BY ?type ?orgLabel -------------------------------------------------------------------------------- /queries/generators/malta.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 24 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q233 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q119774544 # Ministry of Malta (18) 14 | wd:Q7309296 # region of Malta (6) 15 | } 16 | ?org wdt:P31 ?type . 17 | 18 | ?org wdt:P17 ?country . 19 | 20 | MINUS { ?org wdt:P576 [] } 21 | MINUS { ?org wdt:P1366 [] } 22 | 23 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 24 | 25 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mt,mul" } 26 | } 27 | ORDER BY ?type ?orgLabel 28 | -------------------------------------------------------------------------------- /static/thirdparty/octicons/note.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /queries/generators/bermuda.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 24 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q23635 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q112873181 # ministries (13) 14 | wd:Q41806250 # parishes (9) 15 | wd:Q17134625 # municipalities (2) 16 | } 17 | ?org wdt:P31 ?type . 18 | 19 | ?org wdt:P17 ?country . 20 | 21 | MINUS { ?org wdt:P576 [] } 22 | MINUS { ?org wdt:P1366 [] } 23 | 24 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 25 | 26 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } 27 | } 28 | ORDER BY ?type ?orgLabel 29 | -------------------------------------------------------------------------------- /static/topic-icons/housing-community-amenities.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Govdirectory", 3 | "short_name": "Govdirectory", 4 | "start_url": "https://www.govdirectory.org/", 5 | "display": "standalone", 6 | "background_color": "#00264d", 7 | "theme_color": "#00264d", 8 | "lang": "en", 9 | "dir": "ltr", 10 | "orientation": "any", 11 | "icons": [ 12 | { 13 | "src": "/logo-orange.svg", 14 | "type": "image/svg+xml", 15 | "sizes": "any", 16 | "purpose": "any maskable" 17 | } 18 | ,{ 19 | "src": "/logo-white.svg", 20 | "type": "image/svg+xml", 21 | "sizes": "any", 22 | "purpose": "monochrome" 23 | } 24 | ] 25 | 26 | } -------------------------------------------------------------------------------- /queries/generators/cameroon.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 50 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q1009 AS ?country) 11 | VALUES ?type { 12 | wd:Q126947196 # ministries (37) 13 | wd:Q869042 # regions (10) 14 | wd:Q2570643 # senate (1) 15 | wd:Q375928 # lower house (1) 16 | wd:Q190752 # supreme court (1) 17 | } 18 | ?org wdt:P31 ?type . 19 | ?org wdt:P17 ?country . 20 | MINUS { ?org wdt:P576 [] } 21 | MINUS { ?org wdt:P1366 [] } 22 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 23 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,mul" } 24 | } 25 | ORDER BY ?type ?orgLabel -------------------------------------------------------------------------------- /queries/generators/cuba.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 36 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q241 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q132215848 # Ministries (21) 14 | wd:Q115291 # Provinces (15) 15 | } 16 | ?org wdt:P31 ?type . 17 | 18 | ?org wdt:P17 ?country . 19 | 20 | MINUS { ?org p:P31 ?s . ?s pq:P582 [] } # exclude some former provinces 21 | MINUS { ?org wdt:P576 [] } 22 | MINUS { ?org wdt:P1366 [] } 23 | 24 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 25 | 26 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,es,mul" } 27 | } 28 | ORDER BY ?type ?orgLabel 29 | -------------------------------------------------------------------------------- /queries/generators/malaysia.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 205 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q833 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q111179247 # ministries (28) 14 | wd:Q15063586 # state (13) 15 | wd:Q1008803 # territory (3) 16 | wd:Q1994931 # district (161) 17 | } 18 | ?org wdt:P31 ?type . 19 | 20 | ?org wdt:P17 ?country . 21 | 22 | MINUS { ?org wdt:P576 [] } 23 | MINUS { ?org wdt:P1366 [] } 24 | 25 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 26 | 27 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ms,mul" } 28 | } 29 | ORDER BY ?type ?orgLabel 30 | -------------------------------------------------------------------------------- /static/social-icons/youtube.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /queries/generators/ukraine.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 46 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q212 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q7878545 # ministries (19) 14 | wd:Q3348196 # oblast (24) 15 | wd:Q84823091 # region (1) 16 | wd:Q5124045 # city with special status (2) 17 | } 18 | ?org wdt:P31 ?type . 19 | 20 | ?org wdt:P17 ?country . 21 | 22 | MINUS { ?org wdt:P576 [] } 23 | MINUS { ?org wdt:P1366 [] } 24 | 25 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 26 | 27 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,uk,mul" } 28 | } 29 | ORDER BY ?type ?orgLabel 30 | -------------------------------------------------------------------------------- /queries/generators/united-kingdom.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 24 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q145 AS ?country) 12 | 13 | VALUES ?type { 14 | wd:Q2500378 # department of the United Kingdom Government (24) 15 | } 16 | ?org wdt:P31 ?type ; 17 | wdt:P17 ?country . 18 | 19 | MINUS { ?org wdt:P576 [] } 20 | 21 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 22 | 23 | OPTIONAL { 24 | ?org wdt:P9798/wdt:P279* ?cofog . 25 | MINUS { ?cofog wdt:P279 [] } 26 | } 27 | 28 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } 29 | } 30 | ORDER BY ?type ?orgLabel 31 | -------------------------------------------------------------------------------- /static/topic-icons/health.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /queries/generators/canada.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 33 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q16 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q111190932 # Ministerial departments (20) 14 | wd:Q11828004 # Provinces (10) 15 | wd:Q9357527 # Territories (3) 16 | } 17 | ?org wdt:P31 ?type . 18 | 19 | ?org wdt:P17 ?country . 20 | 21 | MINUS { ?org wdt:P576 [] } 22 | MINUS { ?org wdt:P1366 [] } 23 | MINUS { ?org wdt:P582 [] } 24 | 25 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 26 | 27 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,mul" } 28 | } 29 | ORDER BY ?type ?orgLabel 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Report a data error 4 | url: https://www.wikidata.org/w/index.php?action=edit&title=Wikidata:WikiProject_Govdirectory/Error_reports§ion=new&preloadtitle=Report+a+data+error&preload=Wikidata%3AWikiProject_Govdirectory%2FError_reports%2FError_report_template 5 | about: Found incorrect information? Please let us know. 6 | - name: Discuss the website 7 | url: https://github.com/govdirectory/website/discussions 8 | about: Chat with us about Govdirectory. 9 | - name: Discuss data modeling 10 | url: https://www.wikidata.org/w/index.php?title=Wikidata_talk:WikiProject_Govdirectory&action=edit§ion=new 11 | about: Help us improve our data. 12 | -------------------------------------------------------------------------------- /queries/topics.rq: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT * WHERE { 2 | VALUES (?class ?safeName ?name) { 3 | (wd:Q108107925 "general-public-services" "General Public Services") 4 | (wd:Q108107955 "defense" "Defense") 5 | (wd:Q108107969 "public-order-safety" "Public order and safety") 6 | (wd:Q108107990 "economic-affairs" "Economic affairs") 7 | (wd:Q108108058 "environmental-protection" "Environmental protection") 8 | (wd:Q108108075 "housing-community-amenities" "Housing and community amenities") 9 | (wd:Q108108099 "health" "Health") 10 | (wd:Q108108141 "recreation-culture-religion" "Recreation, culture, and religion") 11 | (wd:Q108108158 "education" "Education") 12 | (wd:Q108108190 "social-protection" "Social protection") 13 | } 14 | } ORDER BY ?class -------------------------------------------------------------------------------- /queries/generators/czech-republic.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 234 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q213 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q118495193 # ministries (14) 14 | wd:Q38911 # Regions (14) 15 | wd:Q7819319 # municipality with expanded powers (206) 16 | } 17 | ?org wdt:P31 ?type . 18 | 19 | ?org wdt:P17 ?country . 20 | 21 | MINUS { ?org wdt:P576 [] } 22 | MINUS { ?org wdt:P1366 [] } 23 | MINUS { ?org wdt:P582 [] } 24 | 25 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 26 | 27 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,cs,mul" } 28 | } 29 | ORDER BY ?type ?orgLabel 30 | -------------------------------------------------------------------------------- /static/topic-icons/defense.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | 4 | 5 | ## Issue Reference 6 | 7 | 8 | Fixes #(issue) 9 | 10 | ## Checklist 11 | 12 | Please **ensure** the following before submitting the PR: 13 | 14 | - [ ] I have **tested** the changes locally, and they work as expected. 15 | - [ ] The code follows the project's coding standards and conventions. 16 | - [ ] I have **updated relevant documentation** (if needed). 17 | - [ ] I have added unit **tests** or performed manual testing where necessary. 18 | 19 | ## Screenshots (applicable to user interface changes) 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /templates/topic-list.html: -------------------------------------------------------------------------------- 1 | {{ template "layout" . }} 2 | 3 | {{ define "title" }}List of topics{{ end }} 4 | 5 | {{ define "canonical" }}/topics/{{ end }} 6 | 7 | {{ define "main" }} 8 |
9 |

Topics

10 | 11 | 23 |
24 | {{ end }} 25 | 26 | {{ define "javascript" }}{{""}}{{ end }} 27 | -------------------------------------------------------------------------------- /queries/generators/greenland.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 5 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q223 AS ?country) 12 | 13 | VALUES ?type { 14 | wd:Q16423979 # Municipality of Greenland (5) 15 | } 16 | 17 | ?org wdt:P31 ?type ; 18 | wdt:P17 ?country . 19 | 20 | MINUS { ?org wdt:P576 [] } 21 | MINUS { ?org wdt:P1366 [] } 22 | MINUS { ?org wdt:P3999 [] } 23 | 24 | OPTIONAL { 25 | ?org wdt:P9798/wdt:P279* ?cofog . 26 | MINUS { ?cofog wdt:P279 [] } 27 | } 28 | 29 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 30 | 31 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,kl,da,mul". } 32 | } 33 | ORDER BY ?type ?topic 34 | -------------------------------------------------------------------------------- /queries/generators/nepal.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 112 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q837 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q22049119 # province of Nepal (7) 14 | wd:Q45113733 # provincial assemblies (7) 15 | wd:Q2537537 # district of Nepal (77) 16 | wd:Q119359264 # ministry of Nepal (21) 17 | } 18 | 19 | ?org wdt:P31 ?type ; wdt:P17 ?country . 20 | 21 | MINUS { ?org wdt:P576 [] } 22 | MINUS { ?org wdt:P1366 [] } 23 | MINUS { ?org wdt:P582 [] } 24 | 25 | 26 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 27 | 28 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ne,mul" } 29 | } 30 | ORDER BY ?type ?orgLabel 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.yaml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: File a bug report 3 | labels: ["bug :bug:"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for taking the time to fill out this bug report! 9 | - type: textarea 10 | id: what-happened 11 | attributes: 12 | label: What happened? 13 | description: Also tell us, what did you expect to happen? Note that you can drag and drop screenshots here. 14 | validations: 15 | required: true 16 | - type: dropdown 17 | id: browsers 18 | attributes: 19 | label: What browsers are you seeing the problem on? 20 | multiple: true 21 | options: 22 | - Firefox 23 | - Chrome 24 | - Safari 25 | - Microsoft Edge 26 | - Other (describe above) 27 | -------------------------------------------------------------------------------- /queries/generators/east-timor.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 566 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q574 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q110813527 # ministries (20) 14 | wd:Q741821 # municipalities (14) 15 | wd:Q111127635 # special administrative region (1) 16 | wd:Q1512109 # administrative posts (70) 17 | wd:Q22044663 # sucos (461) 18 | } 19 | ?org wdt:P31 ?type . 20 | 21 | ?org wdt:P17 ?country . 22 | 23 | MINUS { ?org wdt:P576 [] } 24 | MINUS { ?org wdt:P1366 [] } 25 | 26 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 27 | 28 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt,tet,mul" } 29 | } 30 | ORDER BY ?type ?orgLabel 31 | -------------------------------------------------------------------------------- /static/topic-icons/recreation-culture-religion.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /queries/generators/japan.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 229 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q17 AS ?country) 11 | { 12 | VALUES ?type { 13 | wd:Q15409298 # Ministries of Japan (11) 14 | wd:Q50337 # prefectures of Japan (47) 15 | } 16 | ?org wdt:P31 ?type; wdt:P17 ?country . 17 | } 18 | UNION 19 | { 20 | VALUES ?type { 21 | wd:Q3917681 # embassies (158) 22 | wd:Q2360219 # permanent missions (13) 23 | } 24 | ?org wdt:P31 ?type; wdt:P137 ?country . 25 | } 26 | MINUS { ?org wdt:P576 [] } 27 | MINUS { ?org wdt:P1366 [] } 28 | 29 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 30 | 31 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,ja" } 32 | } 33 | ORDER BY ?typeLabel ?orgLabel -------------------------------------------------------------------------------- /queries/generators/indonesia.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 600 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q252 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q17417403 # ministries (48) 14 | wd:Q5098 # provinces / provinsi (38) 15 | wd:Q4272761 # administrative city of Indonesia / kota (5) 16 | wd:Q3199141 # city of Indonesia / kota (93) 17 | wd:Q3191695 # regency / kabupaten (416) 18 | } 19 | ?org wdt:P31 ?type . 20 | 21 | ?org wdt:P17 ?country . 22 | 23 | MINUS { ?org wdt:P576 [] } 24 | MINUS { ?org wdt:P1366 [] } 25 | 26 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 27 | 28 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,id,mul" } 29 | } 30 | ORDER BY ?type ?orgLabel 31 | -------------------------------------------------------------------------------- /static/flag.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /queries/generators/india.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 89 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q668 AS ?country) 12 | VALUES ?type { 13 | wd:Q24952557 # union government ministries (53) 14 | wd:Q12443800 # states (28) 15 | wd:Q467745 # union territories (8) 16 | } 17 | ?org wdt:P31 ?type ; 18 | wdt:P17 ?country . 19 | 20 | MINUS { ?org wdt:P576 [] } 21 | MINUS { ?org wdt:P1366 [] } 22 | MINUS { ?org wdt:P3999 [] } 23 | 24 | OPTIONAL { 25 | ?org wdt:P9798/wdt:P279* ?cofog . 26 | MINUS { ?cofog wdt:P279 [] } 27 | } 28 | 29 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 30 | 31 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,hi,mul". } 32 | } 33 | ORDER BY ?type ?topic 34 | -------------------------------------------------------------------------------- /queries/generators/iceland.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 84 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q189 AS ?country) 11 | VALUES ?type { 12 | wd:Q119788347 # Icelandic ministry (12) 13 | wd:Q955655 # Icelandic local municipality (62) 14 | wd:Q190752 # Supreme court (1) 15 | wd:Q4959031 # Appelate court (1) 16 | wd:Q75029 # District courts (8) 17 | } 18 | ?org wdt:P31 ?type . 19 | ?org wdt:P17 ?country . 20 | 21 | MINUS { ?org wdt:P576 [] } 22 | MINUS { ?org wdt:P1366 [] } 23 | MINUS { ?org p:P31 ?s . ?s ps:P31 wd:Q955655 . ?s pq:P582 [] } 24 | 25 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 26 | 27 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,is,mul" } 28 | } 29 | ORDER BY ?type ?orgLabel 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.yaml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: File a feature request 3 | labels: ["enhancement :1st_place_medal:"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Thanks for taking the time to fill out this feature request! 9 | - type: textarea 10 | id: feature-description 11 | attributes: 12 | label: The feature 13 | description: Tell us about the feature you would like to see! 14 | validations: 15 | required: true 16 | - type: textarea 17 | id: why 18 | attributes: 19 | label: Why? 20 | description: Tell us how this feature would be useful to you. 21 | - type: textarea 22 | id: inspiration-examples 23 | attributes: 24 | label: Examples and inspiration 25 | description: Are there other websites that have this feature? Share some links! 26 | -------------------------------------------------------------------------------- /queries/generators/ghana.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 305 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q117 AS ?country) 12 | 13 | VALUES ?type { 14 | wd:Q129666950 # ministry of Ghana (28) 15 | wd:Q545769 # district of Ghana (261) 16 | wd:Q1052743 # region of Ghana (16) 17 | } 18 | 19 | ?org wdt:P31 ?type ; 20 | wdt:P17 ?country . 21 | 22 | MINUS { ?org wdt:P576 [] } 23 | MINUS { ?org wdt:P1366 [] } 24 | MINUS { ?org wdt:P3999 [] } 25 | 26 | OPTIONAL { 27 | ?org wdt:P9798/wdt:P279* ?cofog . 28 | MINUS { ?cofog wdt:P279 [] } 29 | } 30 | 31 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 32 | 33 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ak,mul". } 34 | } 35 | ORDER BY ?type ?topic 36 | -------------------------------------------------------------------------------- /queries/generators/russia.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 22 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q159 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q4481741 # ministries (21) 14 | wd:Q7188 # government (1) 15 | } 16 | ?org wdt:P31 ?type . 17 | 18 | ?org wdt:P17 ?country . 19 | MINUS { ?org wdt:P1366 [] } 20 | MINUS { ?org wdt:P576 ?ddate . 21 | MINUS { ?org wdt:P31 wd:Q4481741 ; 22 | wdt:P576 ?ddate ; 23 | wdt:P571 ?idate . 24 | FILTER ( ?idate > ?ddate ) 25 | } 26 | } 27 | 28 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 29 | 30 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ru,mul" } 31 | } 32 | ORDER BY ?type ?orgLabel 33 | -------------------------------------------------------------------------------- /queries/generators/singapore.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 41 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q334 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q35749 # Parliament of Singapore (1) 14 | wd:Q1320217 # Government of Singapore (1) 15 | wd:Q190752 # Supreme Court of Singapore (1) 16 | wd:Q112818479 # Ministries (16) 17 | wd:Q3507268 # Town Councils (17) 18 | wd:Q4426538 # Community Development Council Districts (5) 19 | } 20 | ?org wdt:P31 ?type . 21 | 22 | ?org wdt:P17 ?country . 23 | 24 | MINUS { ?org wdt:P576 [] } 25 | MINUS { ?org wdt:P1366 [] } 26 | 27 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 28 | 29 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,tl,ms,mul" } 30 | } 31 | ORDER BY ?type ?orgLabel 32 | -------------------------------------------------------------------------------- /queries/generators/switzerland.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 2154 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q39 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q113015553 # federal ministry of switzerland (7) 14 | wd:Q23058 # canton of switzerland (26) 15 | wd:Q70208 # municipality of Switzerland (2121) 16 | } 17 | ?org wdt:P31 ?type . 18 | 19 | ?org wdt:P17 ?country . 20 | 21 | MINUS { ?org wdt:P576 [] } 22 | MINUS { ?org wdt:P1366 [] } 23 | MINUS { ?org wdt:P582 [] } 24 | MINUS { ?org wdt:P571 ?date . FILTER (DATATYPE(?date) = xsd:dateTime && ?date > now()) } 25 | 26 | 27 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 28 | 29 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,it,mul" } 30 | } 31 | ORDER BY ?type ?orgLabel 32 | -------------------------------------------------------------------------------- /queries/generators/ireland.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 85 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q27 AS ?country) 12 | { 13 | VALUES ?type { 14 | wd:Q5260540 # Department of State (18) 15 | } 16 | ?org wdt:P31 ?type; wdt:P17 ?country . 17 | } 18 | UNION 19 | { 20 | VALUES ?type { 21 | wd:Q3917681 # embassies (67) 22 | } 23 | ?org wdt:P31 ?type; wdt:P137 ?country . 24 | } 25 | MINUS { ?org wdt:P576 [] } 26 | MINUS { ?org wdt:P1366 [] } 27 | MINUS { ?org wdt:P3999 [] } 28 | 29 | OPTIONAL { 30 | ?org wdt:P9798/wdt:P279* ?cofog . 31 | MINUS { ?cofog wdt:P279 [] } 32 | } 33 | 34 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 35 | 36 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ga,mul". } 37 | } 38 | ORDER BY ?type ?topic -------------------------------------------------------------------------------- /templates/country-list.html: -------------------------------------------------------------------------------- 1 | {{ template "layout" . }} 2 | 3 | {{ define "title" }}List of countries{{ end }} 4 | 5 | {{ define "canonical" }}/countries/{{ end }} 6 | 7 | {{ define "main" }} 8 | 9 |
10 |
11 | View on a map 12 |

Countries

13 |
14 | 22 |

Would you like to see more countries added? Help us get the data in shape here.

23 |
24 | {{ end }} 25 | 26 | {{ define "javascript" }}{{""}}{{ end }} 27 | -------------------------------------------------------------------------------- /queries/generators/philippines.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 1764 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q928 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q111188397 # executive department (22) 14 | wd:Q24698 # region (18) 15 | wd:Q24746 # province (82) 16 | wd:Q106078286 # component city (111) 17 | wd:Q29946056 # highly urbanized city (33) 18 | wd:Q106079704 # independent component city (5) 19 | wd:Q24764 # Philippine municipality (1493) 20 | } 21 | ?org wdt:P31 ?type . 22 | 23 | ?org wdt:P17 ?country . 24 | 25 | MINUS { ?org wdt:P576 [] } 26 | MINUS { ?org p:P1366 ?r . MINUS { ?r pq:P582 [] } } 27 | 28 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 29 | 30 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,tl,mul" } 31 | } 32 | ORDER BY ?type ?orgLabel 33 | -------------------------------------------------------------------------------- /queries/generators/cyprus.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 198 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q229 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q135489653 # government agency of Cyprus (63) 14 | wd:Q86689447 # deputy ministry of Cyprus (6) 15 | wd:Q66488868 # ministry of Cyprus (12) 16 | wd:Q16739079 # municipality of Cyprus (39) 17 | wd:Q135905403 # government departments of Cyprus (72) 18 | wd:Q59136 # district of Cyprus (6) 19 | } 20 | ?org wdt:P31 ?type . 21 | 22 | ?org wdt:P17 ?country . 23 | 24 | MINUS { ?org wdt:P576 [] } 25 | MINUS { ?org wdt:P1366 [] } 26 | MINUS { ?org wdt:P31 wd:Q59136 ; wdt:P361 ?part . ?part wdt:P31 wd:Q59136 } 27 | 28 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 29 | 30 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,el" } 31 | } 32 | ORDER BY ?type ?orgLabel -------------------------------------------------------------------------------- /queries/generators/finland.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 429 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q33 AS ?country) 11 | { 12 | VALUES ?type { 13 | wd:Q193512 # Region (19) 14 | wd:Q10495402 # Ministries (12) 15 | wd:Q856076 # Municipalities (308) 16 | } 17 | ?org wdt:P31 ?type; wdt:P17 ?country . 18 | } 19 | UNION 20 | { 21 | VALUES ?type { 22 | wd:Q2360219 # delegations (6) 23 | wd:Q372690 # consulate generals (5) 24 | wd:Q3917681 # embassies (77) 25 | wd:Q5244910 # de facto embassy (1) 26 | wd:Q64779402 # liaison office (1) 27 | } 28 | ?org wdt:P31 ?type; wdt:P137 ?country . 29 | } 30 | MINUS { ?org wdt:P576 [] } 31 | MINUS { ?org wdt:P1366 [] } 32 | 33 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 34 | 35 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fi,sv,mul" } 36 | } 37 | ORDER BY ?type ?orgLabel 38 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | # This CITATION.cff file was generated with cffinit. 2 | # Visit https://bit.ly/cffinit to generate yours today! 3 | 4 | cff-version: 1.2.0 5 | title: Govdirectory 6 | message: >- 7 | To reference the latest version of Govdirectory, please 8 | cite it as below 9 | type: software 10 | authors: 11 | - given-names: Albin 12 | family-names: Larsson 13 | orcid: 'https://orcid.org/0000-0002-7149-5210' 14 | - family-names: Ainali 15 | given-names: Jan 16 | orcid: 'https://orcid.org/0000-0001-8747-1670' 17 | identifiers: 18 | - type: other 19 | value: Q108109790 20 | description: Wikidata 21 | repository-code: 'https://github.com/govdirectory/website' 22 | url: 'https://www.govdirectory.org/' 23 | abstract: >- 24 | Govdirectory is a crowdsourced and fact-checked directory 25 | of official governmental online accounts and services 26 | keywords: 27 | - social-media 28 | - civictech 29 | - wikidata 30 | - government-data 31 | - opengov 32 | license: CC0-1.0 33 | date-released: '2021-06-24' 34 | -------------------------------------------------------------------------------- /queries/generators/morocco.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 431 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q1028 AS ?country) 11 | { 12 | VALUES ?type { 13 | wd:Q20390905 # ministries (19) 14 | wd:Q121614922 # public institutions (228) 15 | wd:Q119811662 # regional councils (12) 16 | wd:Q15629582 # provinces (62) 17 | wd:Q15623950 # prefecture (13) 18 | } 19 | ?org wdt:P31 ?type . 20 | ?org wdt:P17 ?country . 21 | } UNION { 22 | VALUES ?type { 23 | wd:Q3917681 # embassies (97) 24 | } 25 | ?org wdt:P31 ?type . 26 | ?org wdt:P137 ?country . 27 | } 28 | 29 | MINUS { ?org wdt:P576 [] } 30 | MINUS { ?org wdt:P1366 [] } 31 | MINUS { ?org wdt:P3999 [] } 32 | MINUS { ?org wdt:P31 wd:Q19953632. } 33 | 34 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 35 | 36 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr,ar,zgh,mul" } 37 | } 38 | ORDER BY ?type ?orgLabel 39 | -------------------------------------------------------------------------------- /queries/generators/latvia.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 95 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { BIND(wd:Q211 AS ?country) 11 | { 12 | VALUES ?type { 13 | wd:Q3345345 # Municipality of Latvia (35) 14 | wd:Q131579945 # ministry of Latvia (14) 15 | } 16 | ?org wdt:P31 ?type ; 17 | wdt:P17 ?country . 18 | } UNION { 19 | VALUES ?type { 20 | wd:Q3917681 # embassy (38) 21 | wd:Q2360219 # permanent mission (7) 22 | wd:Q7843791 # consulate (1) 23 | } 24 | ?org wdt:P31 ?type ; 25 | wdt:P137 ?country . 26 | } 27 | MINUS { ?org wdt:P576 [] } 28 | MINUS { ?org wdt:P1366 [] } 29 | MINUS { ?org wdt:P3999 [] } 30 | OPTIONAL { 31 | ?org wdt:P9798/wdt:P279* ?cofog . 32 | MINUS { ?cofog wdt:P279 [] } 33 | } 34 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 35 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,lv,mul". } 36 | } 37 | ORDER BY ?type ?topic 38 | -------------------------------------------------------------------------------- /queries/generators/denmark.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 124 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q35 AS ?country) 12 | VALUES ?type { 13 | wd:Q62326 # Region of Denmark (5) 14 | wd:Q2177636 # Municipality of Denmark (98) 15 | wd:Q110636698 # Ministries (21) 16 | } 17 | ?org wdt:P31 ?type ; 18 | wdt:P17 ?country . 19 | 20 | MINUS { ?org wdt:P576 [] MINUS { ?org wdt:P576 ?dissolveddate . FILTER (?dissolveddate > NOW() ) } } 21 | MINUS { ?org wdt:P1366 [] MINUS { ?org p:P1366 ?s . ?s pq:P585 ?replaced . FILTER (?replaced > NOW() ) } } 22 | MINUS { ?org wdt:P3999 [] } 23 | MINUS { ?org wdt:P571 ?start . FILTER (?start > NOW() ) } 24 | 25 | OPTIONAL { 26 | ?org wdt:P9798/wdt:P279* ?cofog . 27 | MINUS { ?cofog wdt:P279 [] } 28 | } 29 | 30 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 31 | 32 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,da,mul". } 33 | } 34 | ORDER BY ?type ?topic 35 | -------------------------------------------------------------------------------- /queries/generators/south-africa.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 322 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q258 AS ?country) 12 | 13 | VALUES ?type { 14 | wd:Q98140118 # department of South Africa (44) 15 | wd:Q5073533 # chapter nine institutions (12) 16 | wd:Q191093 # province of South Africa (9) 17 | wd:Q1589568 # district municipality (44) 18 | wd:Q1500352 # local municipality (205) 19 | wd:Q1530824 # metropolitan municipality (8) 20 | } 21 | 22 | ?org wdt:P31 ?type ; 23 | wdt:P17 ?country . 24 | 25 | MINUS { ?org wdt:P576 [] } 26 | MINUS { ?org wdt:P1366 [] } 27 | MINUS { ?org wdt:P3999 [] } 28 | 29 | OPTIONAL { 30 | ?org wdt:P9798/wdt:P279* ?cofog . 31 | MINUS { ?cofog wdt:P279 [] } 32 | } 33 | 34 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 35 | 36 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,af,zu,nr,nso,st,ss,ts,tn,ve,xh,mul". } 37 | } 38 | ORDER BY DESC(?type) 39 | -------------------------------------------------------------------------------- /queries/generators/portugal.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 346 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q45 AS ?country) 12 | 13 | VALUES ?type { 14 | wd:Q131467261 # ministries of Portugal (17) 15 | wd:Q3032141 # districts of Portugal (18) 16 | wd:Q2914565 # autonomous regions of Portugal (2) 17 | wd:Q13217644 # municipalities of Portugal (308) 18 | wd:Q37002670 # parliament (1) 19 | } 20 | 21 | ?org wdt:P31 ?type ; 22 | wdt:P17 ?country . 23 | 24 | MINUS { ?org wdt:P576 [] } 25 | MINUS { ?org wdt:P1366 [] } 26 | MINUS { ?org wdt:P3999 [] } 27 | MINUS { ?org p:P31 ?p . ?p pq:P582 ?edate . FILTER (DATATYPE(?edate) = xsd:dateTime && ?edate < now())} 28 | 29 | OPTIONAL { 30 | ?org wdt:P9798/wdt:P279* ?cofog . 31 | MINUS { ?cofog wdt:P279 [] } 32 | } 33 | 34 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 35 | 36 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,pt,mul". } 37 | } 38 | ORDER BY ?typeLabel ?topic -------------------------------------------------------------------------------- /queries/account-data.rq: -------------------------------------------------------------------------------- 1 | SELECT DISTINCT 2 | ?platformLabel 3 | ?property # we include the property as we can use it to link directly to the relevant statement in Wikidata 4 | ?url 5 | (?value AS ?account) 6 | WHERE { 7 | ?property wdt:P31 wd:Q105388954 ; 8 | wikibase:statementProperty ?propValuePredicate ; 9 | wikibase:claim ?wdtClaimPredicate ; 10 | wdt:P1630 ?formatter ; 11 | wdt:P9073 ?platform . 12 | 13 | MINUS { ?property wdt:P31 wd:Q60457486 } 14 | FILTER(?property != wd:P11245) # Temporary workaround until modeling on Wikidata is fixed 15 | 16 | wd:{{.}} ?wdtClaimPredicate ?statement . 17 | ?statement ?propValuePredicate ?value . 18 | 19 | MINUS { ?statement pq:P582 [] } 20 | MINUS { ?statement wikibase:rank wikibase:DeprecatedRank } 21 | 22 | BIND(IRI(REPLACE(?formatter, '\\$1', ?value)) AS ?url) 23 | 24 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul" } 25 | } 26 | # we order by property to ensure a consistent order, we use the URI as its incremental ID is the best indication of "importance" we have 27 | ORDER BY ?property 28 | -------------------------------------------------------------------------------- /queries/generators/bulgaria.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 3638 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q219 AS ?country) 11 | { 12 | VALUES ?type { 13 | wd:Q136069342 # ministries (19) 14 | wd:Q12279293 # state agency (10) 15 | wd:Q121881025 # executive agency (32) 16 | wd:Q136410955 # independent government agency (16) 17 | wd:Q136405773 # administrative structures (48) 18 | wd:Q209824 # oblasts (28) 19 | wd:Q1906268 # municipalities (265) 20 | wd:Q4224624 # kmetstvo (3041) 21 | wd:Q7553685 # municipal districts (35) 22 | } 23 | ?org wdt:P31 ?type ; 24 | wdt:P17 ?country . 25 | } 26 | UNION 27 | { 28 | VALUES ?type { 29 | wd:Q136083525 # specialized local administration (144) 30 | } 31 | ?org wdt:P31/wdt:P279* ?type . 32 | } 33 | 34 | MINUS { ?org wdt:P576 [] } 35 | 36 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 37 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,bg". } 38 | } 39 | ORDER BY ?type ?orgLabel 40 | -------------------------------------------------------------------------------- /queries/generators/chile.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 171 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q298 AS ?country) 12 | { 13 | # agencies with country set to Chile 14 | VALUES ?type { 15 | wd:Q55593474 # ministry (25) 16 | wd:Q6134925 # undersecretariat of Chile (40) 17 | wd:Q590080 # region (16) 18 | wd:Q54830696 # regional coincil (16) 19 | } 20 | ?org wdt:P31 ?type ; 21 | wdt:P17 ?country . 22 | } UNION { 23 | # Chilean agencies which does not necessarily have country set to Chile 24 | VALUES ?type { 25 | wd:Q3917681 # embassies (74) 26 | } 27 | ?org wdt:P31 ?type; wdt:P137 ?country . 28 | } 29 | MINUS { ?org wdt:P3999 [] } 30 | MINUS { ?org wdt:P576 [] } 31 | MINUS { ?org wdt:P1366 [] } 32 | 33 | OPTIONAL { 34 | ?org wdt:P9798/wdt:P279* ?cofog . 35 | MINUS { ?cofog wdt:P279 [] } 36 | } 37 | 38 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 39 | 40 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,es". } 41 | } 42 | ORDER BY ?type ?orgLabel 43 | -------------------------------------------------------------------------------- /queries/generators/luxembourg.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 132 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q32 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q30744477 # ministries of Luxembourg (20) 14 | wd:Q1146429 # cantons of Luxembourg (12) 15 | wd:Q2919801 # all communes in Luxembourg (100) 16 | } 17 | ?org wdt:P31 ?type . 18 | 19 | ?org wdt:P17 ?country . 20 | 21 | MINUS { ?org wdt:P576 [] } 22 | MINUS { ?org wdt:P571 ?startdate . 23 | FILTER (?startdate > NOW()) # remove orgs with future start dates 24 | } 25 | MINUS { ?org wdt:P1366 [] 26 | MINUS { ?org p:P1366 ?s . 27 | ?s pq:P585 ?replacedate 28 | FILTER ( ?replacedate > NOW()) # do not remove orgs with future replace dates 29 | } 30 | } 31 | MINUS { 32 | ?org wdt:P31 wd:Q2919801; 33 | p:P31 [ 34 | pq:P582 ?end 35 | ]. 36 | } 37 | 38 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 39 | 40 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,lb,de,fr,mul" } 41 | } 42 | ORDER BY ?type ?orgLabel 43 | -------------------------------------------------------------------------------- /queries/generators/austria.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 2208 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q40 AS ?country) 11 | 12 | VALUES ?type { 13 | wd:Q18683469 # Austrian government federal ministry (Bundesministerium) (13) 14 | wd:Q261543 # Austrian federated states (Bundeländer) (9) 15 | wd:Q871419 #Austrian regional districts (94) 16 | wd:Q667509 # municipality of Austria (2092) 17 | } 18 | ?org wdt:P31 ?type . 19 | 20 | ?org wdt:P17 ?country . 21 | 22 | MINUS { ?org wdt:P576 [] } 23 | MINUS { ?org wdt:P1366 [] } 24 | MINUS { ?org wdt:P31 wd:Q19953632 } 25 | MINUS { ?org wdt:P31 wd:Q15893266 } 26 | MINUS { ?org p:P31 ?p. 27 | ?p ps:P31 wd:Q667509; 28 | pq:P582 [] . 29 | MINUS { ?org p:P31 ?s. 30 | ?s ps:P31 wd:Q667509; 31 | pq:P580 ?start . 32 | FILTER NOT EXISTS { ?s pq:P582 []} 33 | } 34 | } 35 | 36 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 37 | 38 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,mul" } 39 | } 40 | ORDER BY ?type ?orgLabel 41 | -------------------------------------------------------------------------------- /queries/generators/new-zealand.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 169 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q664 AS ?country) 12 | 13 | # agencies with country set to New Zealand 14 | VALUES ?type { 15 | wd:Q116973815 # public service departments (31) 16 | wd:Q130137120 # departemental agencies (7) 17 | wd:Q8041036 # wānanga (3) 18 | wd:Q130420294 # state-owned enterprise of New Zealand (12) 19 | wd:Q65600637 # regional council of New Zealand (11) 20 | wd:Q941036 # territorial authority of New Zealand (67) 21 | wd:Q125959397 # Autonomous Crown Entity (16) 22 | wd:Q126041101 # Independent Crown Entity (19) 23 | wd:Q134467041 # public research organisation (3) 24 | } 25 | 26 | ?org wdt:P31 ?type; wdt:P17 ?country . 27 | 28 | MINUS { ?org wdt:P576 [] } 29 | MINUS { ?org wdt:P1366 [] } 30 | MINUS { ?org wdt:P3999 [] } 31 | 32 | OPTIONAL { 33 | ?org wdt:P9798/wdt:P279* ?cofog . 34 | MINUS { ?cofog wdt:P279 [] } 35 | } 36 | 37 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mi,mul" } 38 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 39 | 40 | } ORDER BY ?typeLabel 41 | -------------------------------------------------------------------------------- /static/topic-icons/social-protection.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.github/workflows/run-expected-count-script-on-pr.yml: -------------------------------------------------------------------------------- 1 | name: Run check expected count script on changed queries 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - '**/*.rq' # Only run when .rq files are modified 7 | 8 | jobs: 9 | check_files: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v3 15 | with: 16 | fetch-depth: 0 # Ensure full history is fetched 17 | 18 | - name: Fetch default branch 19 | run: git fetch origin main # Adjust 'main' if your default branch is named differently 20 | 21 | - name: Set up Python 22 | uses: actions/setup-python@v4 23 | with: 24 | python-version: '3.x' 25 | 26 | - name: Install dependencies 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install requests 30 | 31 | - name: Check changed .rq files 32 | id: check-files 33 | run: | 34 | echo "Queries to check:" 35 | git diff --name-only origin/main...HEAD -- '*.rq' 36 | 37 | # Get a list of .rq files changed in the PR 38 | CHANGED_FILES=$(git diff --name-only origin/main...HEAD -- '*.rq') 39 | for file in $CHANGED_FILES; do 40 | echo "Running script on $file" 41 | python scripts/check-expected-results-count.py --path "$file" 42 | done 43 | -------------------------------------------------------------------------------- /scripts/tests/spell-check.sh: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: CC0-1.0 2 | # SPDX-FileCopyrightText: 2023-2024 The Foundation for Public Code 3 | 4 | # help set 5 | # -e Exit immediately if a command exits with a non-zero status. 6 | # -x Print commands and their arguments as they are executed. 7 | if [ "_${VERBOSE}_" != "__" ] && [ "${VERBOSE}" -gt 0 ]; then 8 | set -x 9 | fi 10 | set -e 11 | 12 | 13 | function git_list_files() { 14 | # -r Recurse into sub-trees. 15 | git ls-tree \ 16 | --full-tree \ 17 | -r \ 18 | --name-only \ 19 | HEAD 20 | } 21 | 22 | IGNORE_PATTERN='\.css$\|\.js$\|\.rq$\|\.svg$\|\.webp$\|\.ico$\|\.png$\|\.jpg$\|\.ttf$\|\.woff$\|\.woff2$\|\.json$\|CNAME$\|Gemfile$\|LICENSE$\|\.sh$\|\.gitignore$\|.github.*\|jargon.txt$' 23 | 24 | ERRORS=0 25 | for FILE in $(git_list_files | grep --invert-match $IGNORE_PATTERN); do 26 | name=$(basename -- "$FILE") 27 | extension="${name##*.}" 28 | 29 | if [ "$extension" == "html" ]; then 30 | MODE=--mode=html 31 | elif [ "$extension" == "md" ]; then 32 | MODE=--mode=markdown 33 | fi 34 | WORDS=$( aspell $MODE --master=en \ 35 | --home-dir=. --personal=jargon.txt \ 36 | list < $FILE ) 37 | if [ $(echo "$WORDS" | wc -w) -gt 0 ]; then 38 | echo "FAIL: $FILE spell check: $WORDS" 39 | ERRORS=$(( $ERRORS + 1 )) 40 | fi 41 | done 42 | if [ $ERRORS -gt 0 ]; then 43 | exit 1 44 | fi 45 | -------------------------------------------------------------------------------- /templates/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | {{- $metadata := config.Metadata -}} 3 | {{- $topics := query "topics.rq" -}} 4 | 5 | 6 | {{ $metadata.root_url }} 7 | 8 | 9 | {{ $metadata.root_url }}about/ 10 | 11 | 12 | {{ $metadata.root_url }}statistics/ 13 | 14 | 15 | {{ $metadata.root_url }}tools/ 16 | 17 | 18 | {{ $metadata.root_url }}countries/ 19 | 20 | 21 | {{ $metadata.root_url }}countries/map/ 22 | 23 | 24 | {{ $metadata.root_url }}topics/ 25 | 26 | {{- range . -}} 27 | 28 | {{ $metadata.root_url }}{{ .safeName }}/ 29 | 30 | {{ end -}} 31 | {{- range $topics -}} 32 | 33 | {{ $metadata.root_url }}{{ .safeName }}/ 34 | 35 | {{ end -}} 36 | {{- range . -}} 37 | {{- $country := .safeName.String -}} 38 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 39 | {{- range $orgs }} 40 | 41 | {{ $metadata.root_url }}{{ $country }}/{{ .qid }}/ 42 | 43 | {{- end -}} 44 | {{- end -}} 45 | 46 | -------------------------------------------------------------------------------- /static/social-icons/mastodon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /queries/generators/norway.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 595 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q20 AS ?country) 12 | 13 | { 14 | VALUES ?type { 15 | wd:Q755707 # Municipality of Norway (357) 16 | wd:Q109644271 # ministry of Norway (17) 17 | wd:Q16973854 # district court (28) 18 | wd:Q101244256 # directorates (72) 19 | wd:Q11979280 # land consolidation court (19) 20 | wd:Q1769285 # corts of appeals (6) 21 | wd:Q5177805 # county municipalities (14) 22 | } 23 | 24 | ?org wdt:P31 ?type ; 25 | wdt:P17 ?country . 26 | } UNION { 27 | VALUES ?type { 28 | wd:Q3917681 # embassy (82) 29 | } 30 | ?org wdt:P31 wd:Q3917681 ; 31 | wdt:P137 ?country . 32 | } 33 | 34 | MINUS { ?org wdt:P576 [] } 35 | MINUS { ?org wdt:P1366 [] . 36 | MINUS { ?org p:P1366 ?s. ?s pq:P582 [] } 37 | MINUS { ?org p:P1366 ?t . ?t pq:P585 ?time . FILTER (?time > NOW()) } 38 | } 39 | MINUS { ?org wdt:P3999 [] } 40 | MINUS { ?org wdt:P571 ?incept . FILTER (?incept > NOW()) } 41 | 42 | OPTIONAL { 43 | ?org wdt:P9798/wdt:P279* ?cofog . 44 | MINUS { ?cofog wdt:P279 [] } 45 | } 46 | 47 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 48 | 49 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nb,no,nn,mul". } 50 | } 51 | ORDER BY ?type ?topic 52 | -------------------------------------------------------------------------------- /queries/generators/germany.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 263 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q183 AS ?country) 12 | { 13 | # agencies with country set to Germany 14 | VALUES ?type { 15 | wd:Q1221156 # state of Germany (16) 16 | wd:Q896375 # federal ministry (16) 17 | wd:Q22721 # governmental districts (10) 18 | wd:Q829277 # governmental districts of Nordrhein-Westfalen (5) 19 | wd:Q42612577 # governmental districts of Baden-Württemberg (4) 20 | } 21 | 22 | ?org wdt:P31 ?type ; 23 | wdt:P17 ?country . 24 | } UNION { 25 | # German agencies which does not necessarily have country set to Germany 26 | VALUES ?type { 27 | wd:Q3917681 # embassies (154) 28 | wd:Q372690 # consulate generals (49) 29 | wd:Q7843791 # consulats (7) 30 | wd:Q5244910 # de facto embassies (2) 31 | } 32 | 33 | ?org wdt:P31 ?type; wdt:P137 ?country . 34 | } 35 | MINUS { ?org wdt:P576 [] MINUS { ?org wdt:P31 wd:Q3917681 } } # To get the embassy in Yemen 36 | MINUS { ?org wdt:P1366 [] MINUS { ?org wdt:P5817 wd:Q55654238 } } # To get the embassy in Belgrade 37 | MINUS { ?org wdt:P3999 [] } 38 | 39 | OPTIONAL { 40 | ?org wdt:P9798/wdt:P279* ?cofog . 41 | MINUS { ?cofog wdt:P279 [] } 42 | } 43 | 44 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 45 | 46 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,mul". } 47 | } 48 | ORDER BY ?type ?topic 49 | -------------------------------------------------------------------------------- /static/topic-icons/economic-affairs.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /queries/generators/united-states.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 308 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q30 AS ?country) 11 | { 12 | VALUES ?eotype { 13 | wd:Q327333 14 | wd:Q31728 15 | wd:Q20857065 16 | wd:Q1752939 17 | } 18 | VALUES ?type { 19 | wd:Q1355327 # Parts of the Executive Office of the President (6) 20 | } 21 | ?org wdt:P31 ?eotype ; 22 | wdt:P17 ?country ; 23 | p:P749 ?s . 24 | ?s ps:P749 wd:Q1355327 . 25 | MINUS { ?s pq:P582 [] } 26 | } 27 | UNION 28 | { 29 | VALUES ?type { 30 | wd:Q910252 # Departments (15) 31 | wd:Q115456878 # Legislative branch agencies in the USA (24) 32 | } 33 | ?org wdt:P31 ?type ; 34 | wdt:P17 ?country . 35 | } 36 | UNION 37 | { 38 | VALUES ?type { 39 | wd:Q2360219 # Representations (should be 12) 40 | wd:Q372690 # Consulate Generals (should be 72) 41 | wd:Q113065939 # US embassies (should be 167) 42 | wd:Q7843791 # Consulates (should be 11) 43 | wd:Q5244910 # de facto embassy (should be 1) 44 | } 45 | ?org wdt:P31 ?type ; 46 | wdt:P137 wd:Q30 . 47 | } 48 | 49 | MINUS { ?org wdt:P31 wd:Q4164871 } 50 | MINUS { ?org wdt:P1366 [] } 51 | MINUS { ?org wdt:P576 [] } 52 | MINUS { ?org wdt:P3999 [] } 53 | MINUS { ?org wdt:P361/wdt:P31 wd:Q5244910 } 54 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 55 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul". } 56 | } 57 | ORDER BY DESC(?type) ?orgLabel 58 | -------------------------------------------------------------------------------- /static/favicon-orange.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /queries/generators/united-states/north-carolina.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 607 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q30 AS ?country) 11 | { 12 | VALUES ?type { 13 | wd:Q133309046 # state agencies (400) 14 | wd:Q13414758 # counties (100) 15 | } 16 | ?org wdt:P31 ?type . 17 | } 18 | UNION 19 | { 20 | VALUES ?type { 21 | wd:Q18608569 # lower house (1) 22 | wd:Q15891112 # upper house (1) 23 | } 24 | ?org wdt:P361 wd:Q10566263 ; 25 | wdt:P31 ?type . 26 | } 27 | UNION 28 | { VALUES ?org { wd:Q10566263 } 29 | VALUES ?type { wd:Q3270264 } # legislature (1) 30 | ?org wdt:P31 ?type . 31 | } 32 | UNION 33 | { VALUES ?part { wd:Q5178756 } # courts of North Carolina 34 | VALUES ?type { 35 | wd:Q4959031 # appellate court (1) 36 | wd:Q7603882 # U.S. state supreme court (1) 37 | } 38 | ?org wdt:P31 ?type ; 39 | wdt:P361 ?part . 40 | } 41 | UNION 42 | { VALUES ?org { wd:Q7054438 } 43 | VALUES ?type { wd:Q640506 } # cabinet (1) 44 | ?org wdt:P31 ?type . 45 | } 46 | UNION 47 | { VALUES ?org { wd:Q7054461 } 48 | VALUES ?type { wd:Q3687335 } # council of state (1) 49 | ?org wdt:P31 ?type . 50 | } 51 | UNION 52 | { VALUES ?type { wd:Q935741 } # election boards (100) 53 | ?org wdt:P31 ?type ; 54 | wdt:P1001/wdt:P31 wd:Q13414758 . 55 | } 56 | 57 | MINUS { ?org wdt:P1366 [] } 58 | MINUS { ?org wdt:P576 [] } 59 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 60 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul". } 61 | } 62 | ORDER BY ?typeLabel ?orgLabel 63 | -------------------------------------------------------------------------------- /queries/generators/belgium.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 973 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q31 AS ?country) 11 | { 12 | VALUES ?type { 13 | wd:Q2288140 # Federal Scientific Institutes (13) 14 | wd:Q107637441 # Public Institution of Social Security (12) 15 | wd:Q3356161 # Public Interest Organizations (16) 16 | wd:Q1846372 # Federal Public Service (11) 17 | wd:Q1788820 # defence ministry (1) 18 | wd:Q21004446 # Public Planning Service (3) 19 | wd:Q17373496 # language areas (4) 20 | wd:Q89934 # communities (3) 21 | wd:Q83057 # regions (3) 22 | wd:Q83116 # extant provinces (10) 23 | wd:Q2621126 # police zones (178) 24 | wd:Q3575878 # emergency zones (35) 25 | wd:Q493522 # municipalities (565) 26 | wd:Q190752 # supreme court (2) 27 | wd:Q32766 # constitutional court (1) 28 | wd:Q2570643 # senate (1) 29 | wd:Q375928 # lower house (1) 30 | wd:Q17627622 # community and regional parliament (5) 31 | } 32 | ?org wdt:P31 ?type; wdt:P17 ?country . 33 | } 34 | UNION 35 | { 36 | VALUES ?type { 37 | wd:Q121856465 # delegations (8) 38 | wd:Q112307194 # consulate generals (15) 39 | wd:Q3917681 # embassies (85) 40 | wd:Q5244910 # de facto embassy (1) 41 | } 42 | ?org wdt:P31 ?type; wdt:P137 ?country . 43 | } 44 | MINUS { ?org wdt:P576 [] } 45 | MINUS { ?org wdt:P1366 [] } 46 | MINUS { ?org wdt:P582 [] } 47 | MINUS { ?org wdt:P571 ?date . FILTER (DATATYPE(?date) = xsd:dateTime && ?date > now()) } 48 | 49 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 50 | 51 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,nl,fr,de" } 52 | } 53 | ORDER BY ?typeLabel ?orgLabel 54 | -------------------------------------------------------------------------------- /templates/404.html: -------------------------------------------------------------------------------- 1 | {{ template "layout" . }} 2 | 3 | {{ define "title" }}404 Page missing{{ end }} 4 | 5 | {{ define "canonical" }}{{""}}{{ end }} 6 | 7 | 8 | {{ define "main" }} 9 | 10 | 11 |
12 |
13 |
14 |

Page missing

15 |

The page you were searching for is missing.

16 | 17 |

We are looking for it.

18 |
19 | {{- include "components/spinner.html" -}} 20 |
21 |
22 |
23 | {{ end }} 24 | 25 | {{ define "javascript" }} 26 | 54 | {{ end }} 55 | -------------------------------------------------------------------------------- /templates/tools.html: -------------------------------------------------------------------------------- 1 | {{ template "layout" . }} 2 | 3 | {{ define "title" }}Govdirectory tools{{ end }} 4 | 5 | {{ define "canonical" }}/tools/{{ end }} 6 | 7 | 8 | {{ define "main" }} 9 |
10 |
11 |

Tools!

12 |

Making your life easier.

13 |
14 |
15 | 16 |
17 |
18 |
19 |
20 |
21 | 22 |
23 |
24 |

Browser extension

25 |

This browser extension helps you identify directly on a social media platform if that account also is in Govdirectory.

26 |

Help improve it. 27 | Firefox add-on 28 |

29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |

Do you have an ideal for a tool?

37 |

Please let us know!

38 | Share your idea 39 |
40 |
41 | 42 |
43 |
44 |
45 | 46 |
47 |
48 | {{ end }} 49 | 50 | {{ define "javascript" }}{{""}}{{ end }} 51 | -------------------------------------------------------------------------------- /DEPLOY.md: -------------------------------------------------------------------------------- 1 | # Deployment instructions 2 | 3 | ## Overview 4 | 5 | Govdirectory is a static site, meaning that all files are generated pre-deployment. Govdirectory is generated using [Snowman](https://github.com/glaciers-in-archives/snowman) and its `build` command. Using the build command generates a `site` directory. This folder contains all files necessary for the govdirectory.org website. 6 | 7 | Govdirectory is currently published using [GitHub Pages](https://pages.github.com/) and its source is the [`gh-pages` branch](https://github.com/govdirectory/website/tree/gh-pages) in this repository. To deploy the site: 8 | 9 | - Checkout the `gh-pages`. 10 | - Delete all the contents of that branch(if your are using your file manager, skip `.git`) 11 | - Copy all the contents of the `site` directory you want to deploy into the `gh-pages` branch. 12 | - Commit all files and changes. 13 | - Push your commit to origin. 14 | 15 | GitHub will now automatically deploy the site. It might take a while for the changes to go into effect. 16 | 17 | ## Partial deploys 18 | 19 | By default Snowman caches all data from the used SPARQL endpoint. therefore, to update data one needs to clear the cache(`snowman cache --invalidate`). However, for a large site like Govdirectory we often want to update only partial parts of the site to decrease to load on the SPARQL endpoint and to decrease build times. 20 | 21 | ### Update all data for a country 22 | 23 | Govdirectory contains a helper script to clear the cache for all agencies under a given country. The country argument should match the "safe-name" of the intended query. 24 | 25 | `./scripts/invalidate-social-media-country.sh sweden` 26 | 27 | ### Update all data for a specific SPARQL query 28 | 29 | Sometimes you might need to only clear the cache for a specific query. How to do this is described in the [Snowman documentation](https://github.com/glaciers-in-archives/snowman#invalidate-cache). 30 | -------------------------------------------------------------------------------- /queries/generators/netherlands.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 417 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | WHERE { 10 | BIND(wd:Q55 AS ?country) 11 | 12 | { 13 | # agencies with country set to the Netherlands 14 | VALUES ?type { 15 | wd:Q3143387 # ministries (15) 16 | wd:Q4500821 # appeals court (4) 17 | wd:Q190752 # supreme court (2) 18 | wd:Q2125157 # district court (11) 19 | wd:Q134390 # provinces (12) 20 | wd:Q702081 # water boards (21) 21 | wd:Q2039348 # municipalities (342) 22 | wd:Q26934845 # integral overseas territory (3) 23 | } 24 | ?org wdt:P31 ?type . 25 | 26 | ?org wdt:P17 ?country . 27 | } UNION { 28 | # special case without a unique type 29 | VALUES ?org { 30 | wd:Q1857094 # cabinet of the King (1) 31 | } 32 | 33 | BIND("cabinet of the King" AS ?typeLabel) 34 | } 35 | UNION { 36 | ?org wdt:P31 wd:Q947233 . # high council of the state (6) 37 | BIND("High Council of State" AS ?typeLabel) 38 | } 39 | 40 | MINUS { ?org wdt:P576 [] . MINUS { ?item rdf:type wdno:P576 } } 41 | MINUS { ?org wdt:P1366 [] } 42 | MINUS { ?org wdt:P582 [] . 43 | MINUS { ?org wdt:P582 ?ddate ; 44 | wdt:P580 ?idate . 45 | FILTER ( ?idate > ?ddate ) 46 | } 47 | } 48 | MINUS { 49 | ?org p:P31 ?inStatement . 50 | ?inStatement pq:P582 [] . 51 | MINUS { ?org p:P31 ?p. 52 | ?p ps:P31 wd:Q2039348; pq:P580 ?start . 53 | FILTER NOT EXISTS { ?p pq:P582 []} 54 | } 55 | } 56 | MINUS { ?org p:P31 ?p. 57 | ?p ps:P31 wd:Q2039348; pq:P580 ?start . 58 | FILTER ( ?start > NOW() ) 59 | } 60 | 61 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 62 | 63 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,nl,mul" } 64 | } 65 | ORDER BY ?type ?orgLabel 66 | -------------------------------------------------------------------------------- /queries/organization-optional.rq: -------------------------------------------------------------------------------- 1 | SELECT 2 | # note that SAMPLE in Blazegraph always picks the first object 3 | (SAMPLE(?website) AS ?website) 4 | (SAMPLE(?email) AS ?email) 5 | (SAMPLE(?phone) AS ?phone) 6 | (SAMPLE(?citizensInitiatives ) AS ?citizensInitiatives) 7 | (SAMPLE(?foiUrl) AS ?foiUrl) 8 | (SAMPLE(?contactPage) AS ?contactPage) 9 | (SAMPLE(?regulatoryText ) AS ?regulatoryText) 10 | (SAMPLE(?regulatoryTextTitle ) AS ?regulatoryTextTitle) 11 | (SAMPLE(?personLabel) AS ?leadBy) 12 | (SAMPLE(?parentOrg) AS ?parent) 13 | ?wikipedia 14 | WHERE { 15 | BIND(wd:{{.}} AS ?org) 16 | 17 | OPTIONAL { ?org wdt:P856 ?website } 18 | OPTIONAL { ?org wdt:P968 ?email } 19 | OPTIONAL { ?org wdt:P9732 ?citizensInitiatives } 20 | OPTIONAL { ?org wdt:P11266 ?contactPage } 21 | OPTIONAL { ?org wdt:P10214 ?foiUrl } 22 | 23 | OPTIONAL { 24 | ?org wdt:P92 ?regulatoryTextItem . 25 | ?regulatoryTextItem wdt:P953 ?regulatoryText ; 26 | wdt:P1476 ?regulatoryTextTitle . 27 | } 28 | 29 | OPTIONAL { ?org wdt:P749 ?parentOrg } 30 | 31 | OPTIONAL { 32 | ?org wdt:P2388|wdt:P1313 ?office . 33 | ?positionStatement ps:P39 ?office . 34 | ?person p:P39 ?positionStatement . 35 | ?person wdt:P31 wd:Q5 . 36 | MINUS { ?positionStatement pq:P582 ?endtime } 37 | MINUS { ?person wdt:P570 [] } 38 | FILTER ( ?office != wd:Q30185 ) 39 | } 40 | 41 | OPTIONAL { 42 | ?org wdt:P1329 ?phone . 43 | ?org p:P1329 ?phoneStatement . 44 | ?phoneStatement (ps:P1329) [] . 45 | FILTER(EXISTS { ?phoneStatement prov:wasDerivedFrom ?reference. }) 46 | } 47 | 48 | OPTIONAL { 49 | ?wikipedia schema:about ?org ; 50 | schema:isPartOf . 51 | } 52 | 53 | SERVICE wikibase:label { 54 | # this might need to be updated when new countries are added 55 | bd:serviceParam wikibase:language "en,sv,mul" . 56 | ?person rdfs:label ?personLabel . 57 | } 58 | } GROUP BY ?wikipedia 59 | -------------------------------------------------------------------------------- /static/social-icons/instagram.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /static/social-icons/website.svg: -------------------------------------------------------------------------------- 1 | 2 | 19 | 21 | 39 | 47 | 54 | 58 | 65 | 66 | -------------------------------------------------------------------------------- /queries/generators/sweden.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 774 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q34 AS ?country) 12 | 13 | { 14 | # agencies with country set to Sweden 15 | VALUES ?type { 16 | wd:Q68295960 # Swedish government agency (253) ✔ 17 | wd:Q107407151 # Swedish government agency under the parliament (12) ✔ 18 | wd:Q127448 # municipality of Sweden (290) ✔ 19 | wd:Q1754161 # regional council in Sweden (20) ✔ 20 | wd:Q10397683 # AP-fund (6) ✔ 21 | wd:Q16296141 # state-owned enterprise (3) ✔ 22 | wd:Q10330441 # state level departments (10) ✔ 23 | wd:Q341627 # court of appeal (6) ✔ 24 | wd:Q2065704 # tingsrätt (48) ✔ 25 | wd:Q190752 # supreme court (1) ✔ 26 | wd:Q135399035 # administrative supreme court (1) ✔ 27 | wd:Q1289455 # administrative court of appeal (4) ✔ 28 | wd:Q18292311 # migration court (4) ✔ 29 | wd:Q10530889 # regional rent tribunal (8) ✔ 30 | } 31 | 32 | ?org wdt:P31 ?type; wdt:P17 ?country . 33 | } UNION { 34 | # Swedish agencies which does not necessarily have country set to Sweden 35 | VALUES ?type { 36 | wd:Q108059166 # delegations (7) ✔ 37 | wd:Q108058047 # general consulates (9) ✔ 38 | wd:Q3917681 # embassies (91) ✔ 39 | } 40 | 41 | ?org wdt:P31 ?type; wdt:P137 ?country . 42 | } UNION { 43 | # special case without a unique type 44 | VALUES ?org { 45 | wd:Q10475844 # domstolsverket (1) ✔ 46 | } 47 | 48 | BIND("courts administration agency" AS ?typeLabel) 49 | } 50 | 51 | MINUS { ?org wdt:P576 [] } 52 | MINUS { ?org wdt:P1366 [] . MINUS { ?org wdt:P31 wd:Q127448 } } # Explict exception for municipalities due to their modeling 53 | MINUS { ?org wdt:P3999 [] } 54 | 55 | OPTIONAL { 56 | ?org wdt:P9798/wdt:P279* ?cofog . 57 | MINUS { ?cofog wdt:P279 [] } 58 | } 59 | 60 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,sv,mul" } 61 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 62 | 63 | } ORDER BY ?typeLabel 64 | -------------------------------------------------------------------------------- /queries/generators/united-kingdom/scotland.rq: -------------------------------------------------------------------------------- 1 | # expected_result_count: 232 2 | SELECT DISTINCT 3 | ?qid 4 | ?orgLabel 5 | ?orgDescription 6 | ?type 7 | ?typeLabel 8 | ?country 9 | ?cofog 10 | WHERE { 11 | BIND(wd:Q145 AS ?country) 12 | { 13 | VALUES ?type { 14 | wd:Q21451686 # Scottish local authorities (32) 15 | wd:Q83425186 # Scottish NHS boards (14) 16 | wd:Q20667323 # Scottish Health and social care partnerships (31) 17 | wd:Q108838260 # Scottish executive agencies (10) 18 | wd:Q137322982 # Scottish executive non-departmental public bodies (46) 19 | wd:Q137324408 # Scottish advisory non-departmental public bodies (9) 20 | wd:Q137325036 # Scottish non-ministerial offices (10) 21 | wd:Q137366971 # Scottish public corporations (4) 22 | } 23 | ?org wdt:P31 ?type ; 24 | wdt:P17 ?country . 25 | } 26 | UNION 27 | { # More Scottish organizations 28 | VALUES ?type { 29 | wd:Q55657615 wd:Q524778 wd:Q169180 # commissioners and ombudsmen (7) 30 | wd:Q7139410 # parole board (1) 31 | wd:Q1412224 # tribunal (10) 32 | wd:Q16931297 # King's printer (1) 33 | wd:Q7188 # government (Scotland) (1) 34 | } 35 | ?org wdt:P31 | wdt:P1454 ?type ; 36 | wdt:P1001 wd:Q22 . 37 | MINUS { ?org wdt:P31 wd:Q5532360 } 38 | MINUS { ?org wdt:P1001 wd:Q1156248 } 39 | MINUS { ?org p:P1001 ?js. ?js pq:P582 [] } 40 | } 41 | UNION 42 | { # Scottish courts (56) 43 | VALUES ?type { 44 | wd:Q109768640 # Sheriff district court (39) 45 | wd:Q16988501 # Justice of the peace court (6) 46 | wd:Q190752 # Supreme court (1) 47 | wd:Q4959031 # Appelate court (1) 48 | wd:Q7494979 # Sheriff court (6) 49 | wd:Q41487 # Court (3) 50 | } 51 | ?org wdt:P361 wd:Q4993654 ; 52 | wdt:P31 ?type . 53 | } 54 | MINUS { ?org wdt:P576 [] } 55 | OPTIONAL { ?org wdt:P9798/wdt:P279* ?cofog . 56 | MINUS { ?cofog wdt:P279 [] } 57 | } 58 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 59 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,sco,gd" } 60 | }ORDER BY ?type ?orgLabel 61 | -------------------------------------------------------------------------------- /templates/countries-map.html: -------------------------------------------------------------------------------- 1 | {{ template "layout" . }} 2 | 3 | {{ define "title" }}Map of countries{{ end }} 4 | 5 | {{ define "canonical" }}/countries/map/{{ end }} 6 | 7 | {{ define "main" }} 8 |
9 |
10 | View as a list 11 |

Map of countries

12 |
13 | 16 |
17 |
18 | {{ end }} 19 | 20 | {{ define "javascript" }} 21 | 22 | 23 | 57 | {{ end }} 58 | -------------------------------------------------------------------------------- /static/dpgbadge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /templates/components/social-icons.html: -------------------------------------------------------------------------------- 1 | {{- $socialAccounts := (query "account-data.rq" . ) -}} 2 | {{- $details := index (query "organization-optional.rq" .) 0 -}} 3 | 4 | {{- $preview_count := 0 -}} 5 | {{- if or (len $socialAccounts) $details.website -}} 6 | 36 | {{- end -}} 37 | -------------------------------------------------------------------------------- /publiccode.yml: -------------------------------------------------------------------------------- 1 | # This repository adheres to the publiccode.yml standard by including this 2 | # metadata file that makes public software easily discoverable. 3 | # More info at https://github.com/publiccodeyml/publiccode.yml 4 | 5 | publiccodeYmlVersion: "0.3" 6 | 7 | name: Govdirectory 8 | url: "https://github.com/govdirectory/website" 9 | landingURL: "https://www.govdirectory.org/" 10 | softwareType: standalone/web 11 | 12 | releaseDate: "2024-03-22" 13 | 14 | platforms: 15 | - web 16 | categories: 17 | - collaboration 18 | - knowledge-management 19 | - social-media-management 20 | - data-collection 21 | - data-visualization 22 | 23 | developmentStatus: stable 24 | roadmap: 'https://github.com/orgs/govdirectory/projects/2' 25 | dependsOn: 26 | open: 27 | - name: Snowman 28 | optional: false 29 | versionMin: "0.6.0" 30 | 31 | description: 32 | en: 33 | longDescription: Govdirectory is a crowdsourced and fact-checked directory of official governmental online accounts and services. Govdirectory aims to become a global directory of government agencies and their online presence by utilizing Wikidata. Wikidata's community, sourceability, versioning, and potential custom tooling that we create will ensure that not only should the information be correct but when it isn't, because of vandalism or something else, users will be able, and suggested, to validate the information. The goal is for this directory to be useful to journalists, web-archivists, researchers and many others, certainly including regular citizens. 34 | shortDescription: Govdirectory is a crowdsourced and fact checked directory of official governmental online accounts and services. 35 | 36 | legal: 37 | license: CC0-1.0 38 | mainCopyrightOwner: Govdirectory 39 | repoOwner: Govdirectory 40 | 41 | intendedAudience: 42 | 43 | countries: 44 | - at 45 | - be 46 | - bg 47 | - ca 48 | - ch 49 | - cl 50 | - cm 51 | - cu 52 | - cy 53 | - cz 54 | - de 55 | - dk 56 | - fi 57 | - gb 58 | - gh 59 | - gl 60 | - id 61 | - ie 62 | - in 63 | - is 64 | - jp 65 | - lu 66 | - lv 67 | - ma 68 | - mt 69 | - my 70 | - nl 71 | - no 72 | - np 73 | - nz 74 | - pe 75 | - ph 76 | - pt 77 | - ru 78 | - se 79 | - sg 80 | - tl 81 | - ua 82 | - us 83 | - uy 84 | - za 85 | 86 | scope: 87 | - government 88 | - local-authorities 89 | 90 | localisation: 91 | availableLanguages: 92 | - en 93 | 94 | localisationReady: false 95 | 96 | maintenance: 97 | type: community 98 | contacts: 99 | - name: Albin Larsson 100 | - name: Jan Ainali 101 | -------------------------------------------------------------------------------- /templates/topic-page.html: -------------------------------------------------------------------------------- 1 | 2 | {{ template "layout" . }} 3 | 4 | {{ define "title" }}{{ .name }}{{ end }} 5 | 6 | {{ define "canonical" }}/{{ .safeName }}/{{ end }} 7 | 8 | {{ define "main" }} 9 |
10 |
11 |

{{ .name }}

12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |

Agencies

21 | 22 |
23 | Download (as TSV) 24 |
25 |
26 |
27 | 28 | {{- $countries := query "countries.rq" -}} 29 | {{- $topic := .class -}} 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | {{- range $countries -}} 40 | {{- $country := .safeName.String -}} 41 | {{- $countryLabel := .name.String -}} 42 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 43 | {{- range $orgs -}} 44 | {{- if eq $topic .cofog -}} 45 | 46 | 47 | 48 | 49 | 50 | 51 | {{- end -}} 52 | {{- end -}} 53 | {{- end -}} 54 |
NamePlatformsTypeCountry
{{ .orgLabel }}{{ include "components/social-icons.html" .qid.String }}{{ .typeLabel }}{{ $countryLabel }}
55 |
56 | {{ end }} 57 | 58 | {{ define "javascript" }} 59 | 94 | 95 | {{ end }} 96 | -------------------------------------------------------------------------------- /scripts/check-labels.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import argparse 4 | import glob 5 | import re 6 | from pathlib import Path 7 | 8 | import requests 9 | 10 | 11 | def execute_sparql_query(endpoint, query): 12 | headers = { 13 | "Accept": "application/sparql-results+json", 14 | "Content-Type": "application/x-www-form-urlencoded", 15 | "User-Agent": "Govdirectory Data Verification Script/1.0 (govdirectory.org)", 16 | } 17 | data = {"query": query} 18 | response = requests.post(endpoint, headers=headers, data=data) 19 | response.raise_for_status() 20 | return response.json() 21 | 22 | 23 | def format_table(headers, rows, col_widths=None): 24 | if not col_widths: 25 | col_widths = [ 26 | max(len(str(row[i])) for row in [headers] + rows) 27 | for i in range(len(headers)) 28 | ] 29 | 30 | separator = "+" + "+".join("-" * (width + 2) for width in col_widths) + "+" 31 | header = "|" + "|".join(f" {h:<{w}} " for h, w in zip(headers, col_widths)) + "|" 32 | 33 | formatted_rows = [] 34 | for row in rows: 35 | formatted_row = ( 36 | "|" 37 | + "|".join(f" {str(cell):<{w}} " for cell, w in zip(row, col_widths)) 38 | + "|" 39 | ) 40 | formatted_rows.append(formatted_row) 41 | 42 | return "\n".join([separator, header, separator] + formatted_rows + [separator]) 43 | 44 | 45 | def check_for_missing_labels(path, endpoint): 46 | paths = ( 47 | [path] 48 | if path.is_file() 49 | else glob.iglob(str(path / "**/**/*.rq"), recursive=True) 50 | ) 51 | paths = list(set(paths)) 52 | print(f"Found {len(paths)} query files to process.") 53 | missing_labels = [] 54 | stats = {"processed": 0, "errors": 0} 55 | 56 | headers = ["File", "Variable", "QID"] 57 | 58 | for filepath in paths: 59 | stats["processed"] += 1 60 | with open(filepath, "r") as file: 61 | content = file.read() 62 | paramized_hook = '{{.}}' 63 | if paramized_hook in content: 64 | continue 65 | 66 | try: 67 | results = execute_sparql_query(endpoint, content) 68 | for result in results["results"]["bindings"]: 69 | for var, value in result.items(): 70 | if var.endswith("Label"): 71 | if re.match(r"Q\d+", value["value"]): 72 | missing_labels.append([filepath, var, value["value"]]) 73 | except requests.RequestException as e: 74 | print(f"Error processing {filepath}: {e}") 75 | stats["errors"] += 1 76 | 77 | if missing_labels: 78 | print("Found items with missing labels:") 79 | print(format_table(headers, missing_labels)) 80 | else: 81 | print("No missing labels found.") 82 | 83 | print(f"\nSummary:") 84 | print( 85 | f"Total Files Processed: {stats['processed']} | Request errors: {stats['errors']}" 86 | ) 87 | if missing_labels: 88 | exit(1) 89 | 90 | 91 | if __name__ == "__main__": 92 | parser = argparse.ArgumentParser(description="Check for missing labels in SPARQL query results.") 93 | parser.add_argument( 94 | "--path", 95 | type=Path, 96 | default=Path("queries"), 97 | help="Path to single query file or directory of queries", 98 | ) 99 | parser.add_argument( 100 | "--endpoint", 101 | default="https://query.wikidata.org/sparql", 102 | help="SPARQL endpoint URL", 103 | ) 104 | 105 | args = parser.parse_args() 106 | check_for_missing_labels(args.path, args.endpoint) 107 | -------------------------------------------------------------------------------- /templates/landing.html: -------------------------------------------------------------------------------- 1 | {{ template "layout" . }} 2 | 3 | {{ define "title" }}Govdirectory{{ end }} 4 | 5 | {{ define "canonical" }}/{{ end }} 6 | 7 | {{ define "extra-head" }} 8 | 9 | {{ end }} 10 | 11 | {{ define "main" }} 12 |
13 |
14 |

Get your voice heard!

15 |

The easiest way to contact your government.

16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 |
24 | Start the conversation now! 25 |
26 |
27 | 31 |
32 |
33 |
34 |
35 |
36 |
37 | Govdirectory is a crowdsourced and fact checked directory of official governmental online accounts and services. 38 |
39 |
40 |
41 |
42 |
43 |
44 | 45 |
46 |
47 |

"Who are the largest CO2 emitters in Sweden?"

48 | Ask your own government! 49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |

"To which countries did Norway export war materials in 2020?"

58 | Ask your own government! 59 |
60 |
61 | 62 |
63 |
64 |
65 |
66 |
67 |
68 |

Explore by country

69 |
70 | {{- $countries := query "countries.rq" -}} 71 | {{- range $countries -}} 72 | {{- if contains .safeName "/" -}} 73 | {{- continue -}} 74 | {{- end -}} 75 | {{ .name }} 76 | {{- end -}} 77 |
78 |
79 |
80 |
81 |
82 |

83 | Would you like to see more countries added? Help us get the data in shape here. 84 |

85 |
86 |
87 |
88 |
89 |

Explore by topic

90 | {{- $topics := query "topics.rq" -}} 91 | 103 |
104 |
105 |
106 | {{ end }} 107 | 108 | {{ define "javascript" }}{{""}}{{ end }} 109 | -------------------------------------------------------------------------------- /jargon.txt: -------------------------------------------------------------------------------- 1 | personal_ws-1.1 en 30 utf-8 2 | africa 3 | Ainali 4 | allOrgs 5 | analytics 6 | Albin 7 | Aotearoa 8 | argparse 9 | ArgumentParser 10 | Arial 11 | austria 12 | authorsFile 13 | availableLanguages 14 | belgium 15 | bermuda 16 | bg 17 | biotop 18 | bulgaria 19 | canada 20 | carolina 21 | CEST 22 | CET 23 | cff 24 | cffinit 25 | cameroon 26 | changelog 27 | CHANGELOG 28 | chile 29 | citizensInitiatives 30 | civictech 31 | codebase 32 | codebase's 33 | codebases 34 | cofog 35 | COFOG 36 | cofogLabel 37 | cofogSafeName 38 | collab 39 | config 40 | configurability 41 | contactPage 42 | countryID 43 | countryLabel 44 | countryURI 45 | cp 46 | cron 47 | crowdsourced 48 | csv 49 | CSV 50 | cuba 51 | cu 52 | curation 53 | currentCountry 54 | currentCountryName 55 | currentCountrySafeName 56 | currentOrg 57 | cy 58 | cyprus 59 | cz 60 | czech 61 | dataset 62 | de 63 | denmark 64 | department 65 | departments 66 | dependsOn 67 | deps 68 | der 69 | Deutschland's 70 | developmentStatus 71 | dir 72 | discoverability 73 | discoverable 74 | disincentivizes 75 | dk 76 | DMN 77 | DPG 78 | endfor 79 | endif 80 | english 81 | eq 82 | facto 83 | Fediverse 84 | ffffff 85 | fi 86 | FileCopyrightText 87 | findability 88 | findable 89 | finland 90 | foiUrl 91 | fontconfig 92 | fontname 93 | Gampp 94 | gb 95 | genericName 96 | germany 97 | gh 98 | ghana 99 | GitFlow 100 | GitLab 101 | gl 102 | govdirectory 103 | Govdirectory 104 | Govdirectory's 105 | greenland 106 | headOfGovLabel 107 | headOfStateLabel 108 | hostnames 109 | html 110 | http 111 | HTTPS 112 | iceland 113 | ICTs 114 | ie 115 | implementers 116 | india 117 | indonesia 118 | inlining 119 | intendedAudience 120 | io 121 | ireland 122 | japan 123 | javascript 124 | Jitsi 125 | jp 126 | json 127 | landingURL 128 | lang 129 | Larsson 130 | Latvia 131 | latvia 132 | leadBy 133 | Lectorate 134 | len 135 | libre 136 | linkable 137 | LinkedIn 138 | linter 139 | linters 140 | localisationReady 141 | localisedName 142 | localizable 143 | longDescription 144 | ltr 145 | lu 146 | luxembourg 147 | lv 148 | mainCopyrightOwner 149 | Maki 150 | malaysia 151 | malta 152 | MarkDown 153 | maskable 154 | Matomo 155 | md 156 | mentorship 157 | modularity 158 | nativeLabel 159 | nd 160 | ne 161 | nepal 162 | netherlands 163 | new 164 | nl 165 | NLnet 166 | norway 167 | np 168 | nz 169 | ok 170 | opengov 171 | operationalize 172 | orcid 173 | org 174 | orgDescription 175 | orgLabel 176 | orgs 177 | orientation 178 | OSI 179 | OSS 180 | parentOrgLabel 181 | parentOrgLabel 182 | parentOrgLabel 183 | parentOrgQID 184 | pathlib 185 | pdf 186 | PDFs 187 | pe 188 | peru 189 | ph 190 | philippines 191 | platformLabel 192 | png 193 | portugal 194 | pre 195 | proactiveness 196 | pt 197 | publiccode 198 | publiccodeYmlVersion 199 | qid 200 | queryable 201 | rd 202 | README 203 | Readme 204 | readme 205 | redistributable 206 | regulatoryText 207 | regulatoryTextTitle 208 | releaseDate 209 | repoOwner 210 | repurpose 211 | reusability 212 | roadmap 213 | rq 214 | ru 215 | ruleset 216 | runtime 217 | russia 218 | safename 219 | safeName 220 | scotland 221 | SDG 222 | se 223 | sexualized 224 | sg 225 | shortDescription 226 | singapore 227 | socialAccounts 228 | socio 229 | softwareType 230 | softwareVersion 231 | sourceability 232 | sparql 233 | SPARQL 234 | spdx 235 | src 236 | st 237 | state 238 | Sverige 239 | svg 240 | sweden 241 | switzerland 242 | synergize 243 | Temaki 244 | th 245 | timeit 246 | timor 247 | TinyPNG 248 | tl 249 | toc 250 | Toolhub 251 | TSV 252 | Tsvg 253 | tw 254 | txt 255 | typeLabel 256 | typeOfGovList 257 | ua 258 | ubuntu 259 | ức 260 | ukraine 261 | uri 262 | url 263 | URL 264 | URLs 265 | usedBy 266 | uruguay 267 | uy 268 | versionMin 269 | WDQS 270 | Wikibase 271 | wikidata 272 | Wikidata 273 | Wikidata's 274 | WikidataCon 275 | Wikimedia 276 | wikipedia 277 | Wikipedia 278 | WikiProject 279 | xml 280 | yaml 281 | yml 282 | york 283 | za 284 | zealand 285 | usr 286 | env 287 | os 288 | www 289 | urlencoded 290 | iglob 291 | RequestException 292 | str 293 | -------------------------------------------------------------------------------- /templates/about.html: -------------------------------------------------------------------------------- 1 | {{ template "layout" . }} 2 | 3 | {{ define "title" }}About Govdirectory{{ end }} 4 | 5 | {{ define "canonical" }}/about/{{ end }} 6 | 7 | 8 | {{ define "main" }} 9 |
10 |
11 |

Get your voice heard!

12 |

The easiest way to contact your government.

13 |
14 |
15 | 16 |
17 |
18 |
19 |

Vision

20 |

Our vision is a world where people are empowered to engage with their government to ensure responsive, inclusive, participatory and representative decision-making at all levels.

21 |
22 |
23 |
24 |
25 |

Mission

26 |

We will enable a community powered directory where the online presence of every public organization is easily findable, queryable and trustworthy.

27 |
28 |
29 |
30 |
31 |
32 |
33 | 34 |
35 |
36 |

Built by a community

37 |

Support our efforts in creating transparency about governmental institutions and their activities online

38 | Learn more about the community 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |

Data quality through constant curation

48 |

Based on Wikipedia's sister project Wikidata the data is constantly fact checked by a rigorous and dedicated community. With the help of tools that help monitor changes in data and entering data correctly, collectively the data can be kept up to date and accurate.

49 |
50 |
51 | 52 |
53 |
54 |
55 | 56 |
57 |
58 |
59 |
60 |
61 | 62 |
63 |
64 |

Recognition

65 |

The project won a WikidataCon community award in 2021, was recognized as a Digital Public Goods by the Digital Public Goods Alliance in September 2022 and made the finalists in the category Peace – Building peaceful and inclusive societies in the SDG Game Changes Award in September 2023. In 2024, it was selected as a champion in the World Summit on the Information Society Prizes 2024 in the category "The role of governments and all stakeholders in the promotion of ICTs for development".

66 |
67 |
68 |
69 | 70 |
71 |
72 |
73 |

Acknowledgements

74 |

This project was initially supported through Wikimedia Deutschland's Unlock Accelerator. Wikimedia Sverige is graciously providing us with Matomo analytics. The data we collect is publicly accessible.

75 |
76 |
77 |
78 | {{ end }} 79 | 80 | {{ define "javascript" }}{{""}}{{ end }} 81 | -------------------------------------------------------------------------------- /scripts/check-expected-results-count.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import argparse 4 | import glob 5 | import re 6 | from pathlib import Path 7 | 8 | import requests 9 | 10 | 11 | def get_expected_count(file_content): 12 | match = re.search(r"# expected_result_count: (\d+)", file_content) 13 | if match: 14 | return int(match.group(1)) 15 | return None 16 | 17 | 18 | def execute_sparql_query(endpoint, query): 19 | headers = { 20 | "Accept": "application/sparql-results+json", 21 | "Content-Type": "application/x-www-form-urlencoded", 22 | "User-Agent": "Govdirectory Data Verification Script/1.0 (govdirectory.org)", 23 | } 24 | data = {"query": query} 25 | response = requests.post(endpoint, headers=headers, data=data) 26 | response.raise_for_status() 27 | results = response.json() 28 | return len(results["results"]["bindings"]) 29 | 30 | 31 | def format_table(headers, rows, col_widths=None): 32 | if not col_widths: 33 | col_widths = [ 34 | max(len(str(row[i])) for row in [headers] + rows) 35 | for i in range(len(headers)) 36 | ] 37 | 38 | separator = "+" + "+".join("-" * (width + 2) for width in col_widths) + "+" 39 | header = "|" + "|".join(f" {h:<{w}} " for h, w in zip(headers, col_widths)) + "|" 40 | 41 | formatted_rows = [] 42 | for row in rows: 43 | formatted_row = ( 44 | "|" 45 | + "|".join(f" {str(cell):<{w}} " for cell, w in zip(row, col_widths)) 46 | + "|" 47 | ) 48 | formatted_rows.append(formatted_row) 49 | 50 | return "\n".join([separator, header, separator] + formatted_rows + [separator]) 51 | 52 | 53 | def get_status_priority(status): 54 | priority = {"FAIL": 0, "ERROR": 1, "NO COUNT": 2, "PASS": 3} 55 | return priority.get(status, 4) 56 | 57 | 58 | def verify_result_counts(path, endpoint): 59 | paths = ( 60 | [path] 61 | if path.is_file() 62 | else glob.iglob(str(path / "**/**/*.rq"), recursive=True) 63 | ) 64 | paths = list(set(paths)) 65 | results = [] 66 | stats = {"pass": 0, "fail": 0, "error": 0, "no_count": 0} 67 | 68 | headers = ["File", "Status", "Expected", "Actual", "Notes"] 69 | 70 | for filepath in paths: 71 | with open(filepath, "r") as file: 72 | content = file.read() 73 | expected_count = get_expected_count(content) 74 | 75 | if expected_count is None: 76 | results.append( 77 | [filepath, "NO COUNT", "-", "-", "No expected count found"] 78 | ) 79 | stats["no_count"] += 1 80 | continue 81 | 82 | try: 83 | actual_count = execute_sparql_query(endpoint, content) 84 | if actual_count == expected_count: 85 | results.append( 86 | [filepath, "PASS", expected_count, actual_count, "-"] 87 | ) 88 | stats["pass"] += 1 89 | else: 90 | if actual_count < expected_count: 91 | results.append( 92 | [ 93 | filepath, 94 | "FAIL", 95 | expected_count, 96 | actual_count, 97 | "Too few orgs found", 98 | ] 99 | ) 100 | else: 101 | results.append( 102 | [ 103 | filepath, 104 | "FAIL", 105 | expected_count, 106 | actual_count, 107 | "Too many orgs found", 108 | ] 109 | ) 110 | stats["fail"] += 1 111 | except requests.RequestException as e: 112 | results.append([filepath, "ERROR", "-", "-", str(e)]) 113 | stats["error"] += 1 114 | 115 | # Sort results by status priority and then by filename 116 | results.sort(key=lambda x: (get_status_priority(x[1]), x[0])) 117 | 118 | print(format_table(headers, results)) 119 | print(f"\nSummary:") 120 | print( 121 | f"Total: {len(results)} | Passed: {stats['pass']} | Failed: {stats['fail']} | " 122 | f"Errors: {stats['error']} | No Count: {stats['no_count']}" 123 | ) 124 | 125 | 126 | if __name__ == "__main__": 127 | parser = argparse.ArgumentParser(description="Verify SPARQL query result counts") 128 | parser.add_argument( 129 | "--path", 130 | type=Path, 131 | default=Path("queries/generators"), 132 | help="Path to single query file or directory of queries", 133 | ) 134 | parser.add_argument( 135 | "--endpoint", 136 | default="https://query.wikidata.org/sparql", 137 | help="SPARQL endpoint URL", 138 | ) 139 | 140 | args = parser.parse_args() 141 | verify_result_counts(args.path, args.endpoint) 142 | -------------------------------------------------------------------------------- /static/logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 39 | 41 | 42 | 44 | image/svg+xml 45 | 47 | 48 | 49 | 50 | 51 | 56 | 63 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /templates/statistics.html: -------------------------------------------------------------------------------- 1 | {{ template "layout" . }} 2 | 3 | {{ define "title" }}Statistics - Govdirectory{{ end }} 4 | 5 | {{ define "canonical" }}/stats/{{ end }} 6 | 7 | {{ define "main" }} 8 | {{- $org_count := 0 -}} 9 | {{- range . -}} 10 | {{- $country := .safeName.String -}} 11 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 12 | {{- $org_count = add (len $orgs) $org_count -}} 13 | {{- end -}} 14 | 15 | {{- $country_count := 0 -}} 16 | {{- range . -}} 17 | {{- if contains .safeName "/" -}} 18 | {{- continue -}} 19 | {{- end -}} 20 | {{- $country_count = add1 $country_count -}} 21 | {{- end -}} 22 | 23 | {{- $social_count := 0 -}} 24 | {{- range . -}} 25 | {{- $country := .safeName.String -}} 26 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 27 | {{- range $orgs -}} 28 | {{ $social_count = add (len (query "account-data.rq" .qid.String)) $social_count }} 29 | {{- end -}} 30 | {{- end -}} 31 | 32 | {{- $other_contact_points := 0 -}} 33 | {{- range . -}} 34 | {{- $country := .safeName.String -}} 35 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 36 | {{- range $orgs -}} 37 | {{- $org_details := index (query "organization-optional.rq" .qid.String) 0 -}} 38 | 39 | {{- if $org_details.email -}} 40 | {{- $other_contact_points = add1 $other_contact_points -}} 41 | {{- end -}} 42 | 43 | {{- if $org_details.website -}} 44 | {{- $other_contact_points = add1 $other_contact_points -}} 45 | {{- end -}} 46 | 47 | {{- if $org_details.phone -}} 48 | {{- $other_contact_points = add1 $other_contact_points -}} 49 | {{- end -}} 50 | 51 | {{- if $org_details.contactPage -}} 52 | {{- $other_contact_points = add1 $other_contact_points -}} 53 | {{- end -}} 54 | 55 | {{- if $org_details.citizensInitiatives -}} 56 | {{- $other_contact_points = add1 $other_contact_points -}} 57 | {{- end -}} 58 | {{- end -}} 59 | {{- end -}} 60 |
61 |

Statistics

62 |

Last updated . Live website usage statistics are publicly accessible through Matomo.

63 | 64 |
65 |
66 |
{{ $country_count }}
countries 67 |
68 | 69 |
70 |
{{ $org_count }}
organizations 71 |
72 | 73 |
74 |
{{ add $social_count $other_contact_points }}
contact points 75 |
76 |
77 | 78 |

Coverage overview

79 |

In the table below we have listed the types of organizations that are covered for each country. The amount of information about those organizations and contact points for them varies and is also improved over time.

80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | {{- range . -}} 89 | {{- $social_cp_count := 0 -}} 90 | {{- $other_cp := 0 -}} 91 | {{- $country_org_count := 0 -}} 92 | {{- $country := .safeName.String -}} 93 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 94 | {{- $country_org_count = add (len $orgs) $country_org_count -}} 95 | {{- range $orgs -}} 96 | {{ $social_cp_count = add (len (query "account-data.rq" .qid.String)) $social_cp_count }} 97 | {{- $org_details := index (query "organization-optional.rq" .qid.String) 0 -}} 98 | 99 | {{- if $org_details.email -}} 100 | {{- $other_cp = add1 $other_cp -}} 101 | {{- end -}} 102 | 103 | {{- if $org_details.website -}} 104 | {{- $other_cp = add1 $other_cp -}} 105 | {{- end -}} 106 | 107 | {{- if $org_details.phone -}} 108 | {{- $other_cp = add1 $other_cp -}} 109 | {{- end -}} 110 | 111 | {{- if $org_details.contactPage -}} 112 | {{- $other_cp = add1 $other_cp -}} 113 | {{- end -}} 114 | 115 | {{- if $org_details.citizensInitiatives -}} 116 | {{- $other_cp = add1 $other_cp -}} 117 | {{- end -}} 118 | {{- end -}} 119 | 120 | 121 | 122 | 123 | 124 | {{- end -}} 125 |
CountryContainsOrganizationsContact points
{{ .name }}{{ .description }}{{ $country_org_count }}{{ add $social_cp_count $other_cp }}
126 | 127 |
128 | {{ end }} 129 | 130 | {{ define "javascript" }}{{""}}{{ end }} 131 | -------------------------------------------------------------------------------- /templates/country-page.html: -------------------------------------------------------------------------------- 1 | 2 | {{ template "layout" . }} 3 | 4 | {{ define "title" }}{{ .name }}{{ end }} 5 | 6 | {{ define "canonical" }}/{{ .safeName }}/{{ end }} 7 | 8 | {{ define "main" }} 9 | 10 | {{- $countryID := ( replace .uri.String "http://www.wikidata.org/entity/" "" 1 ) -}} 11 |
12 |
13 |
14 | 15 | 16 |
17 |

{{ .name }}

18 |

{{ .nativeLabel }}

19 |

{{ .description }}

20 | 21 |
22 |
23 |
    24 |
  • Type of government: {{ if .typeOfGovList -}} 25 | {{- range $i, $type := (split .typeOfGovList.String ",") -}} 26 | {{- if $i -}}, {{ end -}}{{- $type -}} 27 | {{- end -}} 28 | {{- else -}} [missing data] 29 | {{- end -}}
  • 30 |
  • Head of state: {{ if .headOfStateLabel -}} 31 | {{ .headOfStateLabel }} 32 | {{- else -}} [missing data] 33 | {{- end -}}
  • 34 |
  • Head of government: {{ if .headOfGovLabel -}} 35 | {{ .headOfGovLabel }} 36 | {{- else -}} [missing data] 37 | {{- end -}}
  • 38 |
  • Official website: {{ if .website -}} 39 | {{ replace (replace .website.String "http://" "" 1) "https://" "" 1 }} 40 | {{- else -}} [missing data] 41 | {{- end -}}
  • 42 |
43 | {{ if .wikipedia }}

Read more on Wikipedia.

{{ end }} 44 |
45 |
46 |

Data last updated .

47 |
48 | 49 | {{- if gt (len .parts.String) 0 -}} 50 |
51 | Parts of {{ .name }} 52 | 58 |
59 | {{- end -}} 60 | 61 |
62 | 63 |
64 |
65 |
66 |
67 |
68 |

Agencies

69 | 70 |
71 | Download (as TSV) 72 |
73 |
74 |
75 | 76 | {{- $country_orgs := query (join "" "generators/" .safeName.String ".rq") -}} 77 | {{- include "org-table.html" $country_orgs -}} 78 |
79 | {{ end }} 80 | 81 | {{ define "javascript" }} 82 | 116 | 117 | {{ end }} 118 | -------------------------------------------------------------------------------- /static/logo-orange.svg: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 44 | 46 | 47 | 49 | image/svg+xml 50 | 52 | 53 | 54 | 55 | 60 | 63 | 70 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | govdirectory@ainali.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Govdirectory 2 | 3 | [![CC0 1.0](https://img.shields.io/badge/License-CC0%201.0-lightgrey.svg)](LICENSE) 4 | [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) 5 | [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg)](https://github.com/RichardLitt/standard-readme) 6 | [](https://www.digitalpublicgoods.net/r/govdirectory) 7 | [![Mastodon](https://fedi-badge.deno.dev/@govdirectory@wikis.world/followers.svg?style=flat)](https://wikis.world/@govdirectory) 8 | 9 | Website repository for Govdirectory - a crowdsourced and fact-checked directory of official governmental online accounts and services. 10 | 11 | Govdirectory aims to become a global directory of government agencies and their online presence by utilizing Wikidata. 12 | Wikidata's community, sourceability, versioning, and potential custom tooling that we create will ensure that not only should the information be correct but when it isn't, because of vandalism or something else, users will be able, and suggested, to validate the information. 13 | The goal is for this directory to be useful to journalists, web-archivists, researchers and many others, certainly including regular citizens. 14 | 15 | > [!TIP] 16 | > Every Friday at 15.00 CET/CEST we have an open session in [Jitsi](https://meet.jit.si/GovdirectoryCollabHour) where we hack and work on the data together. Everyone is welcome and it's open for questions. 17 | 18 | ## Development setup 19 | 20 | Govdirectory is a static site meaning that it already has all of its pages generated when a visitor visits it. Govdirectory uses Snowman and [SPARQL](https://www.w3.org/TR/sparql11-query/) to do this. 21 | 22 | Because each initial build of Snowman issues thousands (yes thousands) of SPARQL queries one should never make an **initial** build against `query.wikidata.org` but rather against a local Wikidata Query Service (WDQS) instance. However, because setting up a WDQS instance is not trivial, we provide a copy of a [Snowman build cache directory](https://github.com/govdirectory/website-cache). If in use, this will ensure Snowman only queries Wikidata when a query is updated. 23 | 24 | > [!TIP] 25 | > Some of the most common development commands are available through [Just](https://github.com/casey/just), if you do not use just you can still look in the `justfile` for hints. 26 | 27 | ### Prerequisites 28 | 29 | - [Git](https://git-scm.com/) 30 | - [Snowman](https://github.com/glaciers-in-archives/snowman) 31 | - **Optionally**: A local WDQS instance 32 | 33 | 1\. Clone the project: 34 | 35 | ```shell 36 | git clone https://github.com/govdirectory/website 37 | ``` 38 | 39 | 2\. Get a recent build cache: 40 | 41 | ```shell 42 | cd website 43 | git clone https://github.com/govdirectory/website-cache .snowman 44 | ``` 45 | 46 | 3\. Build the website and run the development server: 47 | 48 | ```shell 49 | snowman build && snowman server 50 | ``` 51 | 52 | ### Advanced topics 53 | 54 | - [Setting up your own WDQS instance](https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual#Standalone_service) 55 | - [Snowman: Working with cache](https://github.com/glaciers-in-archives/snowman#working-with-cache) 56 | 57 | ## Usage 58 | 59 | Intended to be used through the website at [govdirectory.org](https://govdirectory.org). 60 | 61 | ## Maintainers 62 | 63 | - [Abbe98](https://github.com/Abbe98) 64 | - [Ainali](https://github.com/Ainali) 65 | 66 | For now, the maintainers have the final say in all matters, but we are taking all opinions from contributors into consideration. 67 | When the community grows, we are planning to shift to a governance model with shared responsibilities. 68 | Besides pinging us in [issues](https://github.com/govdirectory/website/issues), [pull requests](https://github.com/govdirectory/website/pulls) and [discussions](https://github.com/govdirectory/website/discussions), you can also reach us on Mastodon where we are [@ainali](https://social.coop/@ainali) and [@abbe98](https://mastodon.social/@abbe98). 69 | 70 | ## Acknowledgements 71 | 72 | ### Unlock accelerator program 73 | 74 | This project participated in the [Unlock accelerator program](https://www.wikimedia.de/unlock/) program ([original application](https://www.wikidata.org/wiki/User:Ainali/Social_media_for_public_organizations/Unlock)). 75 | 76 | During the accelerator, which ended in October 2021, we defined a Minimum Viable Product (MVP) to: "As an MVP we want to create a working website where people can search, filter, and add data about Swedish and British public institutions and their social media accounts." 77 | 78 | Specifically, we want to acknowledge all the help our coach [Fabian Gampp](https://www.fabiangampp.de/) gave to us. Besides general good mentorship, we wouldn't have had such a bold direction of the design of the website without him. 79 | 80 | ### Matomo server 81 | 82 | [Wikimedia Sverige](https://github.com/Wikimedia-Sverige) is graciously providing us with Matomo analytics. [The dashboard](https://matomo.wikimedia.se/index.php?module=CoreHome&idSite=7) has been made publicly accessible. 83 | 84 | ### Open Social Fund 85 | 86 | This project has received a grant to highlight Fediverse aspects from [NLnet Foundation](https://nlnet.nl/) through their Open Social Fund. 87 | 88 | ## Contributing 89 | 90 | We are looking for people like you to [contribute](CONTRIBUTING.md) to this project by suggesting improvements and helping develop it. Get started by reading our [contributors guide](CONTRIBUTING.md). 91 | 92 | Please note that this project is developed with a [code of conduct](CODE_OF_CONDUCT.md). By participating in this project, you agree to abide by its terms. Please be lovely to all other community members. 93 | 94 | ## License 95 | 96 | This repository and all contributions made to it are licensed under the [CC0 1.0 Universal public domain dedication](LICENSE) if not otherwise stated within a file or directory. 97 | -------------------------------------------------------------------------------- /views.yaml: -------------------------------------------------------------------------------- 1 | views: 2 | - output: "about/index.html" 3 | template: "about.html" 4 | - output: "index.html" 5 | template: "landing.html" 6 | - output: "404.html" 7 | template: "404.html" 8 | - output: "tools/index.html" 9 | template: "tools.html" 10 | - output: "standard-for-public-code/index.html" 11 | template: "standard-for-public-code.html" 12 | 13 | - output: "statistics/index.html" 14 | query: "countries.rq" 15 | template: "statistics.html" 16 | - output: "statistics/statistics.svg" 17 | query: "countries.rq" 18 | template: "statistics.svg" 19 | unsafe: true 20 | 21 | - output: "topics/index.html" 22 | query: "topics.rq" 23 | template: "topic-list.html" 24 | - output: "{{safeName}}/index.html" 25 | query: "topics.rq" 26 | template: "topic-page.html" 27 | - output: "countries/index.html" 28 | query: "countries.rq" 29 | template: "country-list.html" 30 | - output: "{{safeName}}/index.html" 31 | query: "countries.rq" 32 | template: "country-page.html" 33 | 34 | - output: "sitemap.xml" 35 | query: "countries.rq" 36 | template: "sitemap.xml" 37 | unsafe: true 38 | 39 | - output: "map.json" 40 | query: "countries.rq" 41 | template: "map-data.json" 42 | unsafe: true 43 | - output: "countries/map/index.html" 44 | template: "countries-map.html" 45 | 46 | # orgs 47 | 48 | - output: "greenland/{{qid}}/index.html" 49 | query: "generators/greenland.rq" 50 | template: "org.html" 51 | - output: "sweden/{{qid}}/index.html" 52 | query: "generators/sweden.rq" 53 | template: "org.html" 54 | - output: "denmark/{{qid}}/index.html" 55 | query: "generators/denmark.rq" 56 | template: "org.html" 57 | - output: "norway/{{qid}}/index.html" 58 | query: "generators/norway.rq" 59 | template: "org.html" 60 | - output: "ghana/{{qid}}/index.html" 61 | query: "generators/ghana.rq" 62 | template: "org.html" 63 | - output: "germany/{{qid}}/index.html" 64 | query: "generators/germany.rq" 65 | template: "org.html" 66 | - output: "south-africa/{{qid}}/index.html" 67 | query: "generators/south-africa.rq" 68 | template: "org.html" 69 | - output: "netherlands/{{qid}}/index.html" 70 | query: "generators/netherlands.rq" 71 | template: "org.html" 72 | - output: "new-zealand/{{qid}}/index.html" 73 | query: "generators/new-zealand.rq" 74 | template: "org.html" 75 | - output: "finland/{{qid}}/index.html" 76 | query: "generators/finland.rq" 77 | template: "org.html" 78 | - output: "ukraine/{{qid}}/index.html" 79 | query: "generators/ukraine.rq" 80 | template: "org.html" 81 | - output: "russia/{{qid}}/index.html" 82 | query: "generators/russia.rq" 83 | template: "org.html" 84 | - output: "east-timor/{{qid}}/index.html" 85 | query: "generators/east-timor.rq" 86 | template: "org.html" 87 | - output: "philippines/{{qid}}/index.html" 88 | query: "generators/philippines.rq" 89 | template: "org.html" 90 | - output: "india/{{qid}}/index.html" 91 | query: "generators/india.rq" 92 | template: "org.html" 93 | - output: "belgium/{{qid}}/index.html" 94 | query: "generators/belgium.rq" 95 | template: "org.html" 96 | - output: "canada/{{qid}}/index.html" 97 | query: "generators/canada.rq" 98 | template: "org.html" 99 | - output: "indonesia/{{qid}}/index.html" 100 | query: "generators/indonesia.rq" 101 | template: "org.html" 102 | - output: "luxembourg/{{qid}}/index.html" 103 | query: "generators/luxembourg.rq" 104 | template: "org.html" 105 | - output: "singapore/{{qid}}/index.html" 106 | query: "generators/singapore.rq" 107 | template: "org.html" 108 | - output: "bermuda/{{qid}}/index.html" 109 | query: "generators/bermuda.rq" 110 | template: "org.html" 111 | - output: "malaysia/{{qid}}/index.html" 112 | query: "generators/malaysia.rq" 113 | template: "org.html" 114 | - output: "czech-republic/{{qid}}/index.html" 115 | query: "generators/czech-republic.rq" 116 | template: "org.html" 117 | - output: "nepal/{{qid}}/index.html" 118 | query: "generators/nepal.rq" 119 | template: "org.html" 120 | - output: "peru/{{qid}}/index.html" 121 | query: "generators/peru.rq" 122 | template: "org.html" 123 | - output: "austria/{{qid}}/index.html" 124 | query: "generators/austria.rq" 125 | template: "org.html" 126 | - output: "iceland/{{qid}}/index.html" 127 | query: "generators/iceland.rq" 128 | template: "org.html" 129 | - output: "malta/{{qid}}/index.html" 130 | query: "generators/malta.rq" 131 | template: "org.html" 132 | - output: "morocco/{{qid}}/index.html" 133 | query: "generators/morocco.rq" 134 | template: "org.html" 135 | - output: "switzerland/{{qid}}/index.html" 136 | query: "generators/switzerland.rq" 137 | template: "org.html" 138 | - output: "cameroon/{{qid}}/index.html" 139 | query: "generators/cameroon.rq" 140 | template: "org.html" 141 | - output: "ireland/{{qid}}/index.html" 142 | query: "generators/ireland.rq" 143 | template: "org.html" 144 | - output: "portugal/{{qid}}/index.html" 145 | query: "generators/portugal.rq" 146 | template: "org.html" 147 | - output: "latvia/{{qid}}/index.html" 148 | query: "generators/latvia.rq" 149 | template: "org.html" 150 | - output: "cuba/{{qid}}/index.html" 151 | query: "generators/cuba.rq" 152 | template: "org.html" 153 | - output: "uruguay/{{qid}}/index.html" 154 | query: "generators/uruguay.rq" 155 | template: "org.html" 156 | - output: "chile/{{qid}}/index.html" 157 | query: "generators/chile.rq" 158 | template: "org.html" 159 | - output: "cyprus/{{qid}}/index.html" 160 | query: "generators/cyprus.rq" 161 | template: "org.html" 162 | - output: "japan/{{qid}}/index.html" 163 | query: "generators/japan.rq" 164 | template: "org.html" 165 | - output: "bulgaria/{{qid}}/index.html" 166 | query: "generators/bulgaria.rq" 167 | template: "org.html" 168 | 169 | - output: "united-kingdom/{{qid}}/index.html" 170 | query: "generators/united-kingdom.rq" 171 | template: "org.html" 172 | - output: "united-kingdom/scotland/{{qid}}/index.html" 173 | query: "generators/united-kingdom/scotland.rq" 174 | template: "org.html" 175 | 176 | - output: "united-states/{{qid}}/index.html" 177 | query: "generators/united-states.rq" 178 | template: "org.html" 179 | - output: "united-states/north-carolina/{{qid}}/index.html" 180 | query: "generators/united-states/north-carolina.rq" 181 | template: "org.html" 182 | - output: "united-states/new-york/{{qid}}/index.html" 183 | query: "generators/united-states/new-york.rq" 184 | template: "org.html" 185 | -------------------------------------------------------------------------------- /templates/layouts/layout.html: -------------------------------------------------------------------------------- 1 | {{ define "layout" }} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{ block "title" . }}{{ end }} 11 | 12 | 13 | 14 | 15 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | {{ block "extra-head" . }}{{ end }} 57 | 58 | 65 | 66 | 67 | 68 | 69 | 77 | 78 | {{ block "main" . }}{{ end }} 79 | 80 | 116 | {{ block "javascript" . }}{{ end }} 117 | 118 | 130 | 131 | 132 | 133 | 134 | {{ end }} 135 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /queries/countries.rq: -------------------------------------------------------------------------------- 1 | SELECT 2 | ?uri 3 | ?name 4 | ?safeName 5 | ?description 6 | ?parts 7 | (SAMPLE(?website) AS ?website) 8 | (SAMPLE(?nativeLabel) AS ?nativeLabel) 9 | (GROUP_CONCAT(DISTINCT ?typeOfGovLabel; separator=",") AS ?typeOfGovList) 10 | ?headOfStateLabel 11 | ?headOfGovLabel 12 | ?geoshape 13 | ?wikipedia 14 | WHERE { 15 | VALUES (?uri ?name ?safeName ?description ?parts) { 16 | (wd:Q34 'Sweden' 'sweden' 'All Swedish government agencies are included.' '') 17 | (wd:Q223 'Greenland' 'greenland' 'Current content includes municipalities.' '') 18 | (wd:Q35 'Denmark' 'denmark' 'Current content includes, ministries, regions and municipalities.' '') 19 | (wd:Q20 'Norway' 'norway' 'Current content includes municipalities, county municipalities, district courts, land consolidation courts, courts of appeal, ministries, directorates and embassies.' '') 20 | (wd:Q117 'Ghana' 'ghana' 'Current content includes regions and districts.' '') 21 | (wd:Q183 'Germany' 'germany' 'Current content includes ministries, agencies abroad, federated states and governmental districts.' '') 22 | (wd:Q258 'South Africa' 'south-africa' 'Current content includes departments, independent constitutional bodies, provinces and municipalities.' '') 23 | (wd:Q55 'Netherlands' 'netherlands' 'Current content includes ministries, courts, water boards, the Kings cabinet, provinces and municipalities.' '') 24 | (wd:Q664 'New Zealand' 'new-zealand' 'Current content includes public service departments, departmental agencies, wānangas, state-owned enterprises, regional councils, territorial authorities, autonomous crown entities, independent crown entities and crown research institutes.' '') 25 | (wd:Q33 'Finland' 'finland' 'Current content includes ministries, regions, municipalities and agencies abroad.' '') 26 | (wd:Q212 'Ukraine' 'ukraine' 'Current content includes ministries and first level administrative units.' '') 27 | (wd:Q159 'Russia' 'russia' 'Current content includes the government and ministries.' '') 28 | (wd:Q574 'East Timor' 'east-timor' 'Current content includes ministries, municipalities, special administrative region, administrative posts and sucos.' '') 29 | (wd:Q928 'Philippines' 'philippines' 'Current content includes departments, regions, provinces, cities and municipalities.' '') 30 | (wd:Q668 'India' 'india' 'Current content includes ministries, states and union territories.' '') 31 | (wd:Q31 'Belgium' 'belgium' 'Current content includes federal scientific institutes, public institutions of social security, public interest organizations, federal public services, public planning services, agencies abroad, language areas, communities, regions, extant provinces, police zones, emergency zones and municipalities.' '') 32 | (wd:Q16 'Canada' 'canada' 'Current content includes ministerial departments, provinces and territories.' '') 33 | (wd:Q252 'Indonesia' 'indonesia' 'Current content includes ministries, provinces, cities and regencies.' '') 34 | (wd:Q32 'Luxembourg' 'luxembourg' 'Current content includes ministries, ministries departments, cantons and communes.' '') 35 | (wd:Q334 'Singapore' 'singapore' 'Current content includes parliament, government, supreme court, ministries, town councils and community development council districts.' '') 36 | (wd:Q23635 'Bermuda' 'bermuda' 'Current content includes ministries, parishes and municipalities.' '') 37 | (wd:Q833 'Malaysia' 'malaysia' 'Current content includes federal territories, ministries, states and districts.' '') 38 | (wd:Q213 'Czech Republic' 'czech-republic' 'Current content includes ministries, regions and municipalities with expanded powers.' '') 39 | (wd:Q837 'Nepal' 'nepal' 'Current content includes ministries, provinces, districts and provincial assemblies.' '') 40 | (wd:Q419 'Peru' 'peru' 'Current content includes ministries, regions and provinces.' '') 41 | (wd:Q40 'Austria' 'austria' 'Current content includes ministries, federated states, districts and municipalities.' '') 42 | (wd:Q189 'Iceland' 'iceland' 'Current content includes ministries, courts and municipalities.' '') 43 | (wd:Q233 'Malta' 'malta' 'Current content includes ministries and regions.' '') 44 | (wd:Q1028 'Morocco' 'morocco' 'Current content includes ministries, public institutions, embassies, regional councils, provinces and prefectures.' '') 45 | (wd:Q39 'Switzerland' 'switzerland' 'Current content includes federal ministries, cantons and municipalities.' '') 46 | (wd:Q1009 'Cameroon' 'cameroon' 'Current content includes ministries, regions, senate, lower house and supreme court.' '') 47 | (wd:Q27 'Ireland' 'ireland' 'Current content includes departments of state and embassies.' '') 48 | (wd:Q45 'Portugal' 'portugal' 'Current content includes ministries, districts, autonomous regions, municipalities and the parliament.' '') 49 | (wd:Q211 'Latvia' 'latvia' 'Current content includes ministries, municipalities and agencies abroad.' '') 50 | (wd:Q241 'Cuba' 'cuba' 'Current content includes ministries, regular provinces.' '') 51 | (wd:Q77 'Uruguay' 'uruguay' 'Current content includes ministries and departments.' '') 52 | (wd:Q298 'Chile' 'chile' 'Current content includes ministries, undersecreteriats, embassies, regions and legislatures of regions.' '') 53 | (wd:Q229 'Cyprus' 'cyprus' 'Current content includes ministries, deputy ministries, government departments, government agencies, districts and municipalities.' '') 54 | (wd:Q17 'Japan' 'japan' 'Current content includes ministries, prefectures, embassies and permanent missions.' '') 55 | (wd:Q219 'Bulgaria' 'bulgaria' 'Current content includes ministries, state agencies, executive agencies, administrative structures, oblasts, municipalities, kmetstvos, municipal districts and specialized local administrations.' '') 56 | 57 | (wd:Q145 'United Kingdom' 'united-kingdom' 'Current content includes ministerial departments.' 'Scotland|scotland') 58 | (wd:Q22 'Scotland' 'united-kingdom/scotland' 'Current content includes executive agencies, executive non-departmental public bodies, advisory non-departmental public bodies, non-ministerial offices,local authorities, NHS boards, courts, public corporations, tribunals, parole boards, King\'s printer, commissioners, ombudsmen, Health and social care partnerships and government of Scotland.' '') 59 | 60 | (wd:Q30 'United States' 'united-states' 'Current content includes departments, Executive Office of the President, legislative branch agencies, representations, consulates, consulate generals and embassies.' 'New York|new-york,North Carolina|north-carolina') 61 | (wd:Q1454 'North Carolina' 'united-states/north-carolina' 'Current content includes the general assembly, cabinet, council of state, counties, county election boards, state agencies, supreme and appellate courts.' '') 62 | (wd:Q1384 'New York' 'united-states/new-york' 'Current content includes state agencies and counties.' '') 63 | 64 | } 65 | 66 | OPTIONAL { 67 | ?uri wdt:P856 ?website . 68 | ?uri wdt:P37 ?lang . 69 | OPTIONAL { 70 | ?uri p:P856 ?ws . 71 | ?ws pq:P407 ?language . 72 | FILTER (?language IN (?lang, wd:Q1860 )) 73 | } 74 | } 75 | OPTIONAL { ?uri wdt:P35 ?headOfState } 76 | OPTIONAL { ?uri wdt:P6 ?headOfGov } 77 | OPTIONAL { ?uri wdt:P122 ?typeOfGov } 78 | OPTIONAL { ?uri wdt:P1705 ?nativeLabel . ?lang wdt:P424 ?langCode . FILTER(LANG(?nativeLabel)=?langCode) } 79 | 80 | ?uri wdt:P3896 ?geoshape . 81 | OPTIONAL { 82 | ?wikipedia schema:about ?uri ; 83 | schema:isPartOf . 84 | } 85 | SERVICE wikibase:label { 86 | # this might need to be updated when new countries are added 87 | bd:serviceParam wikibase:language "en,sv,de,mul" . 88 | ?headOfState rdfs:label ?headOfStateLabel . 89 | ?headOfGov rdfs:label ?headOfGovLabel . 90 | ?typeOfGov rdfs:label ?typeOfGovLabel . 91 | } 92 | } 93 | GROUP BY ?uri ?name ?safeName ?description ?parts ?headOfGovLabel ?headOfStateLabel ?geoshape ?wikipedia 94 | ORDER BY ?name 95 | -------------------------------------------------------------------------------- /templates/statistics.svg: -------------------------------------------------------------------------------- 1 | {{- $org_count := 0 -}} 2 | {{- range . -}} 3 | {{- $country := .safeName.String -}} 4 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 5 | {{- $org_count = add (len $orgs) $org_count -}} 6 | {{- end -}} 7 | 8 | {{- $social_count := 0 -}} 9 | {{- range . -}} 10 | {{- $country := .safeName.String -}} 11 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 12 | {{- range $orgs -}} 13 | {{ $social_count = add (len (query "account-data.rq" .qid.String)) $social_count }} 14 | {{- end -}} 15 | {{- end -}} 16 | 17 | {{- $other_contact_points := 0 -}} 18 | {{- range . -}} 19 | {{- $country := .safeName.String -}} 20 | {{- $orgs := query (join "" "generators/" $country ".rq") -}} 21 | {{- range $orgs -}} 22 | {{- $org_details := index (query "organization-optional.rq" .qid.String) 0 -}} 23 | 24 | {{- if $org_details.email -}} 25 | {{- $other_contact_points = add1 $other_contact_points -}} 26 | {{- end -}} 27 | 28 | {{- if $org_details.website -}} 29 | {{- $other_contact_points = add1 $other_contact_points -}} 30 | {{- end -}} 31 | 32 | {{- if $org_details.phone -}} 33 | {{- $other_contact_points = add1 $other_contact_points -}} 34 | {{- end -}} 35 | 36 | {{- if $org_details.citizensInitiatives -}} 37 | {{- $other_contact_points = add1 $other_contact_points -}} 38 | {{- end -}} 39 | {{- end -}} 40 | {{- end -}} 41 | 42 | 43 | 55 | 57 | 59 | 63 | 64 | 70 | 76 | 82 | 88 | 94 | {{ len . }} 104 | {{ $org_count }} 114 | {{ add $social_count $other_contact_points }} 124 | COUNTRIES 134 | ORGANIZATIONS 144 | CONTACT POINTS 154 | 155 | -------------------------------------------------------------------------------- /ADD_A_COUNTRY.md: -------------------------------------------------------------------------------- 1 | # Add a country 2 | 3 | This document describes how to add a country from [Wikidata:WikiProject Govdirectory](https://www.wikidata.org/wiki/Wikidata:WikiProject_Govdirectory). 4 | 5 | ## Background 6 | 7 | The contents at govdirectory.org are driven by a set of SPARQL queries which together return all the data displayed. 8 | 9 | Each country, therefore, got its own "generator" query, a query that for a given country returns all of the government organizations which should be included on Govdirectory as well as some basic information about them. 10 | 11 | There is also a query in which one defines various country-level information, such as a description describing what content is currently included for the country in question, the name of the country, and the county's intended Govdirectory URL. 12 | 13 | Each query is connected to a "View" a piece of configuration connecting the query, to the URL where the government organizations for a given country should be rendered. 14 | 15 | ## Setup 16 | 17 | ### The country generator query 18 | 19 | Creating the country query is the most complex and tricky part of adding a country to Govdirectory. You can at any point ask for help over at our [GitHub discussions forum](https://github.com/govdirectory/website/discussions) or over at [Wikidata](https://www.wikidata.org/wiki/Wikidata_talk:WikiProject_Govdirectory). 20 | 21 | Let's start by looking at the existing query for Sweden: 22 | 23 | ```sparql 24 | # expected_result_count: 669 25 | SELECT DISTINCT 26 | ?qid 27 | ?orgLabel 28 | ?orgDescription 29 | ?type 30 | ?typeLabel 31 | ?country 32 | WHERE { 33 | BIND(wd:Q34 AS ?country) 34 | 35 | VALUES ?type { 36 | wd:Q68295960 # Swedish government agency(förvaltningsmyndighet) (249) 37 | wd:Q107407151 # Swedish government agency(myndighet under riksdagen) (5) 38 | wd:Q127448 # municipality of Sweden (290) 39 | wd:Q1754161 # regional council in Sweden (20) 40 | wd:Q196321 # county administrative board (21) 41 | wd:Q10397683 # AP-fund (6) 42 | wd:Q59603261 # state-owned enterprise (3) 43 | wd:Q10330441 # state level departments (11) 44 | wd:Q341627 # court of appeal(hovrätten) (6) 45 | wd:Q2065704 # local court(tingsrätt) (48) 46 | wd:Q190752 # supreme court (2) 47 | wd:Q1289455 # administrative court of appeal (4) 48 | wd:Q18292311 # migration court (4) 49 | } 50 | ?org wdt:P31 ?type . 51 | 52 | ?org wdt:P17 ?country . 53 | 54 | MINUS { ?org wdt:P576 [] } 55 | MINUS { ?org wdt:P1366 [] } 56 | 57 | BIND(REPLACE(STR(?org), "http://www.wikidata.org/entity/", "") AS ?qid) 58 | 59 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,sv" } 60 | } 61 | ORDER BY ?type ?orgLabel 62 | ``` 63 | 64 | Now Let's go through the parts one likely want to adapt to the country one wants to add. 65 | 66 | ```sparql 67 | # expected_result_count: 669 68 | ``` 69 | 70 | The First line must be formatted like the one above, by stating the expected number of results automated checks can be performed and in case an unexpected number of results are returned an editor can quickly step in and solve the issue. Here all one should do is to update the number. 71 | 72 | ```sparql 73 | ?qid 74 | ?orgLabel 75 | ?orgDescription 76 | ?type 77 | ?typeLabel 78 | ?country 79 | ``` 80 | 81 | The section above illustrates which variables are expected by Govdirectory, one should not change these lines but they give one an insight into what is expected from the query. All except `?orgDescription`, `?type`, and `?typeLabel` are mandatory. 82 | 83 | ```sparql 84 | BIND(wd:Q34 AS ?country) 85 | ``` 86 | 87 | This line connects the query to a country in Wikidata, it's used to connect this query to the country configuration. Update the Wikidata identifier (Q-id). 88 | 89 | ```sparql 90 | VALUES ?type { 91 | wd:Q68295960 # Swedish government agency(förvaltningsmyndighet) (249) 92 | wd:Q107407151 # Swedish government agency(myndighet under riksdagen) (5) 93 | wd:Q127448 # municipality of Sweden (290) 94 | wd:Q1754161 # regional council in Sweden (20) 95 | wd:Q196321 # county administrative board (21) 96 | wd:Q10397683 # AP-fund (6) 97 | wd:Q59603261 # state-owned enterprise (3) 98 | wd:Q10330441 # state level departments (11) 99 | wd:Q341627 # court of appeal(hovrätten) (6) 100 | wd:Q2065704 # local court(tingsrätt) (48) 101 | wd:Q190752 # supreme court (2) 102 | wd:Q1289455 # administrative court of appeal (4) 103 | wd:Q18292311 # migration court (4) 104 | } 105 | ``` 106 | 107 | These values are all of the various "instance of"/types the various government organizations might have, the labels of these will be displayed and used in Govdirectory. Note that the comments include the number of organizations each type should yield, this can be very useful if one needs to track down an error in the future. 108 | 109 | 110 | ```sparql 111 | SERVICE wikibase:label { bd:serviceParam wikibase:language "en,mul,sv" } 112 | ``` 113 | 114 | All government organizations in a country might not have a name in English and therefore one should configure one or more fallback languages. In the example above Swedish is set as a fallback language. 115 | 116 | Note that even with these changes in place one's query might still need additional information such as `MINUS` and `FILTER` clauses or triple patterns. 117 | 118 | Finally, make sure to give a decent sort order of the agencies. This may vary by country, but a decent start may be to order be type and then label. 119 | 120 | ```sparql 121 | ORDER BY ?type ?orgLabel 122 | ``` 123 | 124 | Note that one can test the query in the Wikidata Query Service. One can also find more examples of [country queries here](https://github.com/govdirectory/website/tree/main/queries). 125 | 126 | ### The country configuration 127 | 128 | The [`countries.rq`](https://github.com/govdirectory/website/blob/main/queries/countries.rq) query holds four pieces of information about a country: 129 | 130 | - The Wikidata URI 131 | - The name of the country as displayed to users of Govdirectory 132 | - The URL slug on which the country appears at on Govdirectory 133 | - A description of the content coverage 134 | 135 | The configuration example below illustrates the configuration for Sweden and the United Kingdom. To add a new country one would create an additional line similar to the two found at lines 13-14 in the example below. The query will automatically include additional information. 136 | 137 | ```sparql 138 | SELECT 139 | ?uri 140 | ?name 141 | ?safeName 142 | ?description 143 | ?parts 144 | (SAMPLE(?website) AS ?website) 145 | (SAMPLE(?nativeLabel) AS ?nativeLabel) 146 | (GROUP_CONCAT(DISTINCT ?typeOfGovLabel; separator=",") AS ?typeOfGovList) 147 | ?headOfStateLabel 148 | ?headOfGovLabel 149 | ?geoshape 150 | ?wikipedia 151 | WHERE { 152 | VALUES (?uri ?name ?safeName ?description ?parts) { 153 | (wd:Q34 'Sweden' 'sweden' 'All Swedish government agencies are included.' '') 154 | (wd:Q223 'Greenland' 'greenland' 'Current content includes municipalities.' '') 155 | } 156 | 157 | OPTIONAL { 158 | ?uri wdt:P856 ?website . 159 | ?uri wdt:P37 ?lang . 160 | OPTIONAL { 161 | ?uri p:P856 ?ws . 162 | ?ws pq:P407 ?language . 163 | FILTER (?language IN (?lang, wd:Q1860 )) 164 | } 165 | } 166 | OPTIONAL { ?uri wdt:P35 ?headOfState } 167 | OPTIONAL { ?uri wdt:P6 ?headOfGov } 168 | OPTIONAL { ?uri wdt:P122 ?typeOfGov } 169 | OPTIONAL { ?uri wdt:P1705 ?nativeLabel } 170 | 171 | ?uri wdt:P3896 ?geoshape . 172 | OPTIONAL { 173 | ?wikipedia schema:about ?uri ; 174 | schema:isPartOf . 175 | } 176 | SERVICE wikibase:label { 177 | # this might need to be updated when new countries are added 178 | bd:serviceParam wikibase:language "en,mul,sv,de" . 179 | ?headOfState rdfs:label ?headOfStateLabel . 180 | ?headOfGov rdfs:label ?headOfGovLabel . 181 | ?typeOfGov rdfs:label ?typeOfGovLabel . 182 | } 183 | } 184 | GROUP BY ?uri ?name ?safeName ?description ?parts ?headOfGovLabel ?headOfStateLabel ?geoshape ?wikipedia 185 | ORDER BY ?name 186 | ``` 187 | 188 | Note that one can test the query in the Wikidata Query Service. 189 | 190 | ### Configuring the view 191 | 192 | Finally one only needs to tell the Govdirectory software about the new data. This is done in Govdirectory's "views.yaml" file. Here is an example of such a section connecting the query and the template: 193 | 194 | ```yaml 195 | output: "sweden/{{qid}}/index.html" 196 | query: "generators/sweden.rq" 197 | template: "org.html" 198 | ``` 199 | 200 | All one needs to do here is to make section like the one above and "sweden"(in two places) with the URL slug of the country in question(as defined in one's country configuration). One can find more examples of [view configurations in the current "views.yaml" file](https://github.com/govdirectory/website/blob/main/views.yaml#L37). 201 | 202 | ## Get help 203 | 204 | - [GitHub discussions forum](https://github.com/govdirectory/website/discussions) 205 | - [Wikidata](https://www.wikidata.org/wiki/Wikidata_talk:WikiProject_Govdirectory) 206 | --------------------------------------------------------------------------------