โ๏ธ
FAIR Enough metrics for research
FAIR Enough Metrics is an API for various FAIR Metrics Tests, written in python, conforming to the specifications defined by the FAIRMetrics working group.
This API is deployed publicy at https://metrics.api.fair-enough.semanticscience.org
It can be used with the FAIR evaluation services:
Metrics tests API built FastAPI.
๐งโ๐ป
Deploy the API
First, clone the repository:
git clone https://github.com/MaastrichtU-IDS/fair-enough-metrics
cd fair-enough-metrics
๐ณ
Development with docker (recommended)
From the root of the cloned repository, run the command below, and access the OpenAPI Swagger UI on http://localhost:8000
docker-compose up
The API will automatically reload on changes to the code
๐
๐
Development without docker
Note: it has been tested only with Python 3.8
Install dependencies from the source code:
pip install -e .
Start the API locally on http://localhost:8000
uvicorn api.main:app --reload
๐
In production with docker
We use the docker-compose.prod.yml
file to define the production deployment configuration.
To start the stack with production config:
docker-compose -f docker-compose.prod.yml up -d
We use a reverse nginx-proxy for docker to route the services.
โ๏ธ
Test the Metrics Tests API
The tests are run automatically by a GitHub Action workflow at every push to the main
branch.
Add tests in the ./tests/test_metrics.py
file. You just need to add new entries to the JSON file to test different subjects results against the metrics tests:
{
'metric_id': 'a1-access-protocol',
'subject': 'https://w3id.org/ejp-rd/fairdatapoints/wp13/dataset/c5414323-eab1-483f-a883-77951f246972',
'score': 1,
},
Run the tests in docker-compose:
docker-compose -f docker-compose.test.yml up --force-recreate
You can enable more detailed logs by changing the
command:
in thedocker-compose.test.yml
file to usepytest -s
โ
Create a new FAIR Metrics Tests service
You can easily use this repository to build and publish new FAIR metrics tests.
- Fork this repository
- Change the API settings in
api/config.py
- Use the existing tests python files in the
metrics
folder to start writing FAIR metrics tests! - Start your FAIR metrics tests API with
docker-compose
!