open-sustainability-index-backend

Backend and API routes for Open Sustainability Index

https://github.com/open-sustainability-index/open-sustainability-index-backend

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.3%) to scientific vocabulary

Keywords

remix supabase swagger typescript vite
Last synced: 6 months ago · JSON representation

Repository

Backend and API routes for Open Sustainability Index

Basic Info
Statistics
  • Stars: 8
  • Watchers: 1
  • Forks: 1
  • Open Issues: 5
  • Releases: 0
Topics
remix supabase swagger typescript vite
Created almost 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

Open Sustainability Index (backend)

Introduction for new contributors

See the README on https://github.com/Open-Sustainability-Index

How to run

npm run dev

Set up local Supabase development

cd supabase

npx supabase start

Take note of API URL and anon key. You can also use this to get API keys and URLs:

npx supabase status

Development environment

Supabase web admin: http://127.0.0.1:54333/

Postgres connection string for TablePlus/Postico: postgresql://postgres:postgres@localhost:54332/postgres

Get schema and data from cloud database

npx supabase db pull  # Pull down local db schema from cloud db
npx supabase db push  # Push up your local db schema to cloud db

Note: If you get “Wrong password” message, add your password with --password [SUPABASE_PASSWORD]

Get data:

npx supabase db dump --data-only -f db_data.sql
psql --single-transaction --file db_data.sql --dbname 'postgresql://postgres:postgres@localhost:54332/postgres'

Creating migration of database changes from local machine to server

Edit your local database, then run:

npx supabase db diff -f [migration-name]
# Then normally run: npx supabase db push

Running a migration locally:

npx supabase migration up

Reset database and apply current migrations:

npx supabase db reset

API

Note: use &api-key=demo, or set it as a Bearer token in the header.

  • Companies:
    • List: http://localhost:5173/v1/companies?sort=company_name&order=asc&limit=20&offset=0&api-key=demo
    • List by tag: http://localhost:5173/v1/companies?tags=omx120&api-key=demo
    • v2 List: http://localhost:5173/v2/companies?sort=company_name&order=asc&limit=20&offset=0&api-key=demo
    • Company: http://localhost:5173/v1/companies/skf?api-key=demo
    • Company all years: http://localhost:5173/v1/companies/skf/all-years?api-key=demo
  • Industries: http://localhost:5173/v1/industries?api-key=demo
  • Search: http://localhost:5173/v1/search?query=Maersk&sort=name&order=asc&api-key=demo

Live API on https://api.opensustainabilityindex.org/ e.g. https://api.opensustainabilityindex.org/v1/companies/skf?api-key=demo

Structure

  • /app
    • /components - /common - /input - /[area specific]
    • /routes
      • /api
    • /hooks (incl context)
    • /services (business logic)
    • /utils (smaller utils)
  • /loaders - articles.ts
  • /config
  • /public
  • /db
    • /migrations

SQL functions

SELECT * FROM companies(
    0,                  -- offset_value
    20,                 -- limit_value
    'name',             -- sort_by
    'asc',              -- sort_order
    --  'Technology',   -- industry_filter
    --  true,           -- near_term_filter
    --  'Type A',       -- commitment_type_filter
    --  'Active',       -- commitment_status_filter
    --  'Target 1'      -- target_target_filter
    --  'omx120'        -- tags_filter
);

-- v2:

SELECT * FROM companies_v2(
    0,                  -- offset_value
    20,                 -- limit_value
    'name',             -- sort_by
    'asc'               -- sort_order
    --  'Technology',   -- industry_filter
    --  true,           -- near_term_filter
    --  'Type A',       -- commitment_type_filter
    --  'Active',       -- commitment_status_filter
    --  'Target 1'      -- target_target_filter
    --  ??              -- emissions_required
    --  'omx120'        -- tags_filter
);

Get SQL code:

SELECT pg_get_functiondef('companies_v2'::regproc);

Owner

  • Name: Open Sustainability Index
  • Login: Open-Sustainability-Index
  • Kind: organization
  • Email: team@opensustainabilityindex.org

GitHub Events

Total
  • Watch event: 1
  • Delete event: 1
  • Issue comment event: 2
  • Push event: 14
  • Pull request event: 3
  • Create event: 1
Last Year
  • Watch event: 1
  • Delete event: 1
  • Issue comment event: 2
  • Push event: 14
  • Pull request event: 3
  • Create event: 1

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 176
  • Total Committers: 3
  • Avg Commits per committer: 58.667
  • Development Distribution Score (DDS): 0.489
Past Year
  • Commits: 22
  • Committers: 2
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.045
Top Committers
Name Email Commits
Henric Malmberg h****c@t****e 90
Tom Söderlund t****m@t****m 85
Petter Palander p****r@p****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 6
  • Total pull requests: 7
  • Average time to close issues: less than a minute
  • Average time to close pull requests: 2 days
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.17
  • Average comments per pull request: 1.14
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • achaido (5)
  • tomsoderlund (1)
  • hankmander (1)
Pull Request Authors
  • tomsoderlund (9)
  • hankmander (4)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

package-lock.json npm
  • 643 dependencies
package.json npm
  • @remix-run/dev ^2.8.1 development
  • vite ^5.2.9 development
  • @remix-run/node ^2.8.1
  • @remix-run/react ^2.8.1
  • @remix-run/serve ^2.8.1
  • @supabase/ssr ^0.3.0
  • @supabase/supabase-js ^2.42.7
  • googleapis ^105.0.0
  • isbot ^4.4.0
  • react ^18.2.0
  • react-dom ^18.2.0