Klimatkollen

A web application that displays emissions within municipalities in Sweden, along with a machine learning data pipeline under development, which will find, extract, and list emissions from companies.
https://github.com/klimatbyran/frontend

Category: Emissions
Sub Category: Emission Observation and Modeling

Keywords from Contributors

climate climate-change sustainability sustainable-development-goals

Last synced: about 10 hours ago
JSON representation

Repository metadata

Klimatkollen's frontend

README.md

Klimatkollen Frontend

Welcome to the frontend of klimatkollen.se, developed using TypeScript, React, Vite, and Tailwind CSS.

Klimatkollen is an open-source, citizen-driven platform designed to visualize climate data. Currently, we are showcasing data from major Swedish companies and Swedish municipalities.

🚀 Project Structure

  • src/pages/: Contains .tsx files for each page, which are routed based on their filenames
  • src/components/: Houses reusable React components utilized throughout the application
  • public/: Stores static assets such as images

🗄️ Deciding on backend to run development client against

To run the local development client, you must run our API locally or connect to our production API. For information on setting up the API locally, see the README in our data pipeline repository.

If you instead want to run the local development client against production,
setup the local .env file for development by running the following command in
the root directory of the frontend code.

cp .env.example .env.development

🧞 Building and Running Locally

To run the project locally, execute the following commands from the root of the project in your terminal:

Command Action
npm install Installs dependencies
npm run dev Starts local dev server at localhost:5173 or
VITE_API_PROXY
npm run dev-gen Starts local dev server and regenerates API types from OpenAPI
npm run generate-api Regenerates src/lib/api-types.ts from production OpenAPI (/reference/openapi.json)
npm run generate-api:local Same, from local Garbo (http://localhost:3000/reference/openapi.json)
npm run generate-api:staging Same, from staging API
npm run build Builds your production site to ./dist/
npm run preview Previews your build locally, before deploying
npm run build:dataguide

Note: When making changes to the data guide content (markdown files in src/locales/dataguide/), you need to run npm run build:dataguide to generate the updated JSON files. This step is automatically included when running npm run build for production builds.

Note: npm audit vulnerabilities will fail the build.

Company IDs and API types

Companies are keyed by internal UUID (Company.id) in the database. The frontend uses two identifier shapes:

Use case Identifier
Public URLs (/companies/...) wikidataId if set, else first 8 hex chars of id
Partner read (getCompanyDetails) URL param as-is — API resolves Q-id, full UUID, or 8-char prefix
Staff mutations (edit pages) Always full internal company.id

Helpers live in src/utils/companyRouting.ts (getCompanyUrlSegment, getCompanyDetailPath).

After the API with staff /:id routes is deployed, regenerate OpenAPI types before building against production:

npm run generate-api:staging   # or generate-api:local against a running API

Do not hand-edit src/lib/api-types.ts except when temporarily ahead of a staged OpenAPI publish.

👩‍💻 Contributing

Do you have an idea for a feature? Jump into the code or head to our Discord server to discuss your thoughts. You can also submit an issue explaining your suggestion.

How to Contribute

  • Discuss your ideas on our Discord.
  • Submit an issue if you can't find an existing one.
  • Pick up an issue from our open issues (and leave a comment to avoid duplication of work).

📠 Contact

Join our Discord server or reach out via email at hej@klimatkollen.se.

🫶 Supporters and Partners

This work wouldn't have been possible without the support from Google.org.

We also extend our gratitude to our current and former partners:

Postkodstiftelsen, ClimateView, Klimatklubben.se, Researcher's Desk, Exponential Roadmap, WWF, We Don't Have Time, Våra Barns Klimat, Argand, StormGeo.

LICENSE

This project is licensed under the terms of the Apache 2.0 © Klimatbyrån Ideell Förening.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 2 days ago

Total Commits: 3,162
Total Committers: 34
Avg Commits per committer: 93.0
Development Distribution Score (DDS): 0.745

Commits in past year: 1,414
Committers in past year: 17
Avg Commits per committer in past year: 83.176
Development Distribution Score (DDS) in past year: 0.741

Name Email Commits
fluxcdbot f****t 805
github-actions[bot] g****] 792
Carl c****0@g****m 369
Elvira e****m 310
Samuel Plumppu 6****t 246
Kayla Woodbury 5****y 237
Mikael Hallendal h****i@h****g 184
Hugo Björk h****k@n****m 58
Christian Landgren c****n@l****u 53
Simon s****k@h****m 31
Moritz Zingg m****g@n****m 14
Andreas Sanz a****a@g****m 8
Frida Berry Eklund f****d@g****m 7
Oliver Kiss o****s@n****m 7
Kayla Woodbury k****y@m****n 6
eli6 e****n@p****m 6
Ludvig Janiuk l****k@g****m 4
Carl Wirén c****n@M****l 4
Petter Hersinger 9****r 3
andersabjorn a****n@g****m 2
Carl Wirén c****n@M****n 2
William Asp 5****p 2
olavG91 o****v@l****e 1
mzackrisson 8****n 1
mdciofalo 1****o 1
lalarus 1****s 1
demo-netlight d****o@n****m 1
Zara 7****n 1
Viraj Gavade 1****e 1
Vilhelm Melkstam v****m@g****m 1
and 4 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 11 days ago

Total issues: 134
Total pull requests: 275
Average time to close issues: about 1 month
Average time to close pull requests: 7 days
Total issue authors: 18
Total pull request authors: 16
Average comments per issue: 0.37
Average comments per pull request: 0.43
Merged pull request: 151
Bot issues: 0
Bot pull requests: 0

Past year issues: 54
Past year pull requests: 158
Past year average time to close issues: 17 days
Past year average time to close pull requests: 5 days
Past year issue authors: 8
Past year pull request authors: 8
Past year average comments per issue: 0.3
Past year average comments per pull request: 0.47
Past year merged pull request: 108
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/klimatbyran/frontend

Top Issue Authors

  • elvbom (46)
  • CarlWiren90 (26)
  • kaylawoodbury (13)
  • s91k (8)
  • hallski (7)
  • Klimatkollen (6)
  • okis-netlight (5)
  • klimatkollsfrida (5)
  • eli6 (4)
  • Catharina217 (2)
  • petterhersinger (2)
  • hugo-nl (2)
  • moritzzingg-netlight (2)
  • Greenheart (2)
  • willeasp (1)

Top Pull Request Authors

  • elvbom (156)
  • hallski (40)
  • CarlWiren90 (40)
  • s91k (11)
  • kaylawoodbury (8)
  • moritzzingg-netlight (3)
  • okis-netlight (3)
  • irony (3)
  • petterhersinger (2)
  • eli6 (2)
  • andersabjorn (2)
  • jonatansberg (1)
  • viraj-gavade (1)
  • klimatkollsfrida (1)
  • willeasp (1)

Top Issue Labels

  • enhancement (57)
  • bug (42)
  • Good for Volunteers (20)
  • good first issue (16)
  • help wanted (11)
  • idea (6)
  • not ready (6)
  • requested change (4)
  • netlight (3)
  • Available (3)
  • copy edit (3)
  • Urgent! (2)
  • duplicate (1)
  • question (1)

Top Pull Request Labels

  • enhancement (61)
  • bug (58)
  • chore (23)
  • copy edit (7)
  • prod release (7)
  • Good for Volunteers (2)
  • requested change (1)
  • merge to main (1)
  • good first issue (1)
  • documentation (1)
  • Urgent! (1)

Dependencies

.github/workflows/ci.yml actions
  • ASzc/change-string-case-action v2 composite
  • actions/checkout v3 composite
  • docker/build-push-action v4 composite
  • docker/login-action v2 composite
  • martinbeentjes/npm-get-version-action main composite
Dockerfile docker
  • nginx alpine build
  • node lts build
package-lock.json npm
  • 617 dependencies
package.json npm
  • @astrojs/check ^0.7.0
  • @astrojs/react ^3.4.0
  • @astrojs/tailwind ^5.1.0
  • @nivo/line ^0.87.0
  • @radix-ui/react-avatar ^1.0.4
  • @types/react ^18.3.3
  • @types/react-dom ^18.3.0
  • astro ^4.9.2
  • class-variance-authority ^0.7.0
  • clsx ^2.1.1
  • lucide-react ^0.383.0
  • react ^18.3.1
  • react-dom ^18.3.1
  • tailwind-merge ^2.3.0
  • tailwindcss ^3.4.3
  • tailwindcss-animate ^1.0.7
  • typescript ^5.4.5

Score: 7.215239978730098