bioenergy.org

A site dedicated to creating FAIR datasets to share across bioenergy research centers and to the global research community.
https://github.com/bioenergy-research-centers/bioenergy.org

Category: Renewable Energy
Sub Category: Bioenergy

Keywords from Contributors

ontology

Last synced: about 18 hours ago
JSON representation

Repository metadata

README.md

bioenergy.org

A site dedicated to creating FAIR data products to share across bioenergy research centers (BRCs) and to the global research community.

Resources

Points of contact at each BRC

Tech contacts

  • Hector Plahar
  • Nick Thrower
  • Clint Cecil

Development

Prerequisites:

  • Docker
  • Docker Compose
  • Node.js (version in .nvmrc), recommend using a version manager like nvm or asdf
  • Postman is useful for testing the api.

The application is a monorepo with two main components. The client is a Vue.js application and the API is an Express application.

Running a postgres container

The following command will run a postgres container with the password mysecretpassword and expose the database on port 6432.

docker run --name postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 6432:5432 postgres

Running the application

  • Copy the .env.sample file to .env and fill in the environment variables. These can also be set as environment variables on your system.
  • Docker Compose:
    • To run the application in production mode, run docker-compose up in the root directory of the project. This will start the nginx server for the client, the express server for the API, and the Postgres database.
    • To run the application in development mode, run docker compose -f docker-compose.dev.yml up --build --watch. This will start the client and API in development mode with hot reloading.
    • You can run docker-compose down to stop the application and destroy the containers and volumes.
    • Running docker-compose up --build will rebuild the containers and restart the application.

Testing

Tests use Vitest and run inside Docker containers. No database connection is required.

# Run API tests
docker compose -f docker-compose.dev.yml run --rm --no-deps api npx vitest run

# Run client tests
docker compose -f docker-compose.dev.yml run --rm --no-deps client npx vitest run

# Run a single test file
docker compose -f docker-compose.dev.yml run --rm --no-deps api npx vitest run tests/services/githubService.test.js
docker compose -f docker-compose.dev.yml run --rm --no-deps client npx vitest run src/__tests__/components/AuthorList.test.js

# Watch mode
docker compose -f docker-compose.dev.yml run --rm --no-deps api npx vitest
docker compose -f docker-compose.dev.yml run --rm --no-deps client npx vitest

Some stderr output (e.g. "Error during search", "Turnstile error") is expected — these are console.error calls from the application code exercised by error-path tests.

API tests

API tests use Supertest for route-level integration tests. Tests are organized under api/tests/ mirroring the source structure:

api/tests/
├── helpers/          # Shared test utilities (Express app factory)
├── models/           # Dataset model tests
├── routes/           # Route integration tests (dataset, message, schema)
├── services/         # Service unit tests (github, ICE, strategy manager)
├── utils/            # Utility unit tests (categories, markdown, turnstile)
└── setup.js          # Test environment variables

Writing API tests:

  • All tests are CommonJS (matching the API codebase).

  • Vitest globals (describe, it, expect, vi, beforeEach) are available without imports.

  • vi.mock() does not reliably intercept CJS require() calls. To mock a dependency, mutate the shared module object instead:

    const myService = require("../../app/services/myService");
    myService.someMethod = vi.fn();
    

    This works because require() returns the same cached object to all consumers. For this reason, source modules should avoid destructuring at import time (use mod.fn() instead of const { fn } = require(mod)).

  • Route tests use Supertest with a lightweight Express app from tests/helpers/createApp.js (no Sequelize sync or Swagger setup).

  • Database calls are mocked by mutating db.datasets.scope and db.sequelize.query on the shared require("../models") object.

Client tests

Client tests use Vue Test Utils for component testing. Tests are organized under client/src/__tests__/:

client/src/__tests__/
├── components/       # Component unit tests (AuthorList, Footer, FacetFilters, etc.)
├── composables/      # Composable tests (useTurnstile)
├── router/           # Route definition tests
├── services/         # API service tests (Dataset, Message, Schema)
├── store/            # Pinia store tests (searchStore)
└── views/            # View tests (ContactView, versionComponentMap)

Writing client tests:

  • Tests are ESM (matching the client codebase). Import vitest functions explicitly: import { describe, it, expect, vi } from 'vitest'.
  • vi.mock() works for ESM imports. Mock HTTP calls by mocking @/http-common.
  • Mount components with @vue/test-utils. Stub child components and router as needed.

Coverage

Run tests with a coverage report:

docker compose -f docker-compose.dev.yml run --rm --no-deps api npx vitest run --coverage
docker compose -f docker-compose.dev.yml run --rm --no-deps client npx vitest run --coverage

Coverage is enforced at 80% for statements, branches, functions, and lines (configured in api/vitest.config.js and client/vitest.config.js). The CI workflow runs coverage on every pull request and will fail if thresholds are not met.

Troubleshooting: stale Docker images

If you see errors like npx: not found or unexpected behavior when running tests, you may have a stale Docker image cached from a previous build. This can happen when switching between dev and production Dockerfiles, since Docker Compose reuses an existing image if the tag already matches.

To fix this, remove the old image and rebuild:

docker image rm bioenergyorg-client   # or bioenergyorg-api
docker compose -f docker-compose.dev.yml build --no-cache client

Import BRC Data Feeds

  • run docker compose run api node scripts/import_datafeeds.js from the root folder of the project.
  • To redirect validation errors to a file, run docker compose run api node scripts/import_datafeeds.js 2>&1 > import_datafeeds.txt
  • Under Windows PowerShell, use the following version of the above command to get a clean output file: cmd /c "docker compose run api node scripts/import_datafeeds.js > import_datafeeds_after.txt 2>&1"
  • If you see warnings like "VITE_*" variable is not set, add that variable to your local .env file as an empty placeholder.

Resources Used to Build This Application

BRC Data End Points

Using Claude Code with the bioenergy.org MCP server.

This project repo automatically registers the MCP server in Claude Code via the .mcp.json file at the root of this repo.

Alternatively, to tell Claude where the MCP server is:

claude mcp add --transport http bioenergy-datasets --scope project https://mcp.bioenergy.org

Then, in Claude Code, run /mcp and approve the server if prompted. You can check to confirm that Claude has registered the MCP with claude mcp list.

Validating Data

A local data feed file can be validated against the schema currently supported by the API by posting the file to the validation endpoint (or http://localhost:8080/api/validate if testing against your dev environment). Alternatively, you can paste your data feed into the Swagger API documentation, which will pretty-print the validation results.

Under Unix, macOS, Git Bash, or WSL (for Windows PowerShell use curl.exe instead of curl):

curl -X POST -H "Content-Type: application/json" --data-binary "@jbei.json" https://api.bioenergy.org/api/validate > validation-results.json

The endpoint uses the schema version declared in the posted feed. A schema version can also be forced with the schema_version query parameter:

curl -X POST -H "Content-Type: application/json" --data-binary "@jbei.json" "https://api.bioenergy.org/api/validate?schema_version=0.1.13"

The response is JSON and includes:

  • the schema version used for validation
  • counts of valid, invalid, and duplicate records
  • detailed validation errors for invalid records
  • duplicate record details

InterBRC Data Products Portal Copyright (c) 2025, The Regents of the University of California, through Lawrence Berkeley National Laboratory, and UT-Battelle LLC, through Oak Ridge National Laboratory (both subject to receipt of any required approvals from the U.S. Dept. of Energy), University of Wisconsin - Madison, University of Illinois Urbana - Champaign, and Michigan State University. All rights reserved.

If you have questions about your rights to use or distribute this software,
please contact Berkeley Lab's Intellectual Property Office at
IPO@lbl.gov.

NOTICE. This Software was developed under funding from the U.S. Department
of Energy and the U.S. Government consequently retains certain rights. As
such, the U.S. Government has been granted for itself and others acting on
its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the
Software to reproduce, distribute copies to the public, prepare derivative
works, and perform publicly and display publicly, and to permit others to do so.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 3 days ago

Total Commits: 110
Total Committers: 15
Avg Commits per committer: 7.333
Development Distribution Score (DDS): 0.773

Commits in past year: 43
Committers in past year: 8
Avg Commits per committer in past year: 5.375
Development Distribution Score (DDS) in past year: 0.465

Name Email Commits
Nick Thrower t****n@m****u 25
Valerie Autumn Skye 1****e 23
Clint Cecil c****l@w****u 13
Hector Plahar h****r 11
Chuck Parker c****r 10
Nathan Hillson n****n@l****v 9
Harry Caufield j****d@g****m 5
ianderthal i****l 3
StantonMartin 6****n 3
mkulawik 1****k 2
Mark A. Miller M****M@l****v 2
franflame 8****e 1
Oliver Ruebel o****l 1
Leslie Stoecker l****r@i****u 1
Dirk Norman (GLBRC) 1****c 1

Committer domains:


Issue and Pull Request metadata

Last synced: 4 days ago

Total issues: 123
Total pull requests: 89
Average time to close issues: about 2 months
Average time to close pull requests: 11 days
Total issue authors: 14
Total pull request authors: 10
Average comments per issue: 1.7
Average comments per pull request: 1.06
Merged pull request: 73
Bot issues: 0
Bot pull requests: 0

Past year issues: 56
Past year pull requests: 39
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 13 days
Past year issue authors: 8
Past year pull request authors: 6
Past year average comments per issue: 1.79
Past year average comments per pull request: 1.51
Past year merged pull request: 25
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/bioenergy-research-centers/bioenergy.org

Top Issue Authors

  • valerie-autumn-skye (28)
  • caufieldjh (24)
  • throwern (22)
  • ct-parker (21)
  • hplahar (12)
  • dnorman-glbrc (3)
  • ianderthal (3)
  • thatRailsGuy (3)
  • StantonMartin (2)
  • njhillson (1)
  • cmungall (1)
  • mkulawik (1)
  • lensor (1)
  • franflame (1)

Top Pull Request Authors

  • throwern (30)
  • valerie-autumn-skye (21)
  • hplahar (11)
  • ct-parker (10)
  • caufieldjh (6)
  • mkulawik (3)
  • ianderthal (3)
  • thatRailsGuy (2)
  • franflame (2)
  • oruebel (1)

Top Issue Labels

  • enhancement (33)
  • bug (19)
  • help wanted (5)
  • question (3)
  • good first issue (2)
  • documentation (2)
  • invalid (1)

Top Pull Request Labels

  • enhancement (29)
  • documentation (5)
  • bug (4)

Dependencies

.github/workflows/qc.yaml actions
  • actions/checkout v3.0.2 composite
  • actions/setup-node v2 composite
api/Dockerfile docker
  • node 20 build
client/Dockerfile docker
  • nginx stable-alpine build
  • node 20 build
docker-compose.dev.yml docker
docker-compose.yml docker
api/package.json npm
  • @faker-js/faker ^8.4.1 development
  • @octokit/rest ^21.1.0
  • ajv ^8.17.1
  • ajv-formats ^3.0.1
  • axios ^1.7.7
  • body-parser ^1.20.2
  • cors ^2.8.5
  • dotenv ^16.4.5
  • express ^4.18.2
  • nodemon ^3.1.7
  • pg ^8.11.3
  • pg-hstore ^2.3.4
  • sanitize-html ^2.14.0
  • sequelize ^6.37.0
  • swagger-jsdoc ^6.2.8
  • swagger-ui-express ^5.0.0
  • sync-fetch ^0.5.2
client/package.json npm
  • @rushstack/eslint-patch ^1.3.3 development
  • @vitejs/plugin-vue ^5.0.3 development
  • @vue/eslint-config-prettier ^8.0.0 development
  • @vue/test-utils ^2.4.4 development
  • cypress ^13.6.3 development
  • eslint ^8.49.0 development
  • eslint-plugin-cypress ^2.15.1 development
  • eslint-plugin-vue ^9.17.0 development
  • jsdom ^24.0.0 development
  • prettier ^3.0.3 development
  • start-server-and-test ^2.0.3 development
  • vite ^5.0.11 development
  • vitest ^1.2.2 development
  • @popperjs/core ^2.11.8
  • axios ^1.6.7
  • bootstrap ^5.3.2
  • bootstrap-icons ^1.11.3
  • dotenv ^16.4.5
  • jquery ^3.7.1
  • pinia ^2.2.4
  • pinia-plugin-persistedstate ^4.1.2
  • vue ^3.4.15
  • vue-router ^4.2.5
package.json npm
  • mvp file:api

Score: 5.886104031450156