fair-test is a library to build and deploy FAIR metrics tests APIs supporting the specifications used by the FAIRMetrics working group.

Overview

☑️ FAIR test

Version Python versions

Run tests Publish to PyPI CodeQL Coverage

fair-test is a library to build and deploy FAIR metrics tests APIs supporting the specifications used by the FAIRMetrics working group.

It aims to enable python developers to easily write, and deploy FAIR metric tests functions that can be queried by various FAIR evaluations services, such as FAIR enough and the FAIRsharing FAIR Evaluator

Feel free to create an issue, or send a pull request if you are facing issues or would like to see a feature implemented.

ℹ️ How it works

The user defines and registers custom FAIR metrics tests in separated files in a specific folder (the metrics folder by default), and start the API.

Built with FastAPI, pydantic and RDFLib. Tested for Python 3.7, 3.8 and 3.9

📥 Install the package

Install the package from PyPI:

pip install fair-test

🐍 Build a FAIR metrics test API

Checkout the example folder for a complete working app example to get started, including a docker deployment.

If you want to start from a project with everything ready to deploy in production we recommend you to fork the fair-enough-metrics repository.

📝 Define the API

Create a main.py file to declare the API, you can provide a different folder than metrics here, the folder path is relative to where you start the API (the root of the repository):

from fair_test import FairTestAPI

app = FairTestAPI(
    title='FAIR Metrics tests API',
    metrics_folder_path='metrics',
    description="""FAIR Metrics tests API""",
    cors_enabled=True,
    license_info = {
        "name": "MIT license",
        "url": "https://opensource.org/licenses/MIT"
    },
)

Create a .env file to provide informations used for the API, such as contact details and the host URL (note that you don't need to change it for localhost in development), e.g.:

HOST="metrics.api.fair-enough.semanticscience.org"
BASE_URI="https://metrics.api.fair-enough.semanticscience.org"
CONTACT_URL="https://github.com/MaastrichtU-IDS/fair-enough-metrics"
CONTACT_NAME="Vincent Emonet"
CONTACT_EMAIL="[email protected]"
CONTACT_ORCID="0000-0000-0000-0000"
ORG_NAME="Institute of Data Science at Maastricht University"
DEFAULT_SUBJECT="https://doi.org/10.1594/PANGAEA.908011"

🎯 Define a FAIR metrics test

Create a a1_my_test.py file in the metrics folder with your test:

0: self.success(f'{len(g)} triples found, test sucessful') else: self.failure('No triples found, test failed') return self.response()">
from fair_test import FairTest

class MetricTest(FairTest):
    metric_path = 'a1-check-something'
    applies_to_principle = 'A1'
    title = 'Check something'
    description = """Test something"""
    author = 'https://orcid.org/0000-0000-0000-0000'
    metric_version = '0.1.0'

    def evaluate(self):
        self.info(f'Checking something for {self.subject}')
        g = self.getRDF(self.subject, use_harvester=False)
        if len(g) > 0:
            self.success(f'{len(g)} triples found, test sucessful')
        else:
            self.failure('No triples found, test failed')
        return self.response()

A few common operations are available on the self object, such as logging or retrieving RDF metadata from a URL.

🦄 Deploy the API

You can then run the metrics tests API on http://localhost:8000 with uvicorn, e.g. with the code provided in the example folder:

cd example
pip install -r requirements.txt
uvicorn main:app --reload

Checkout in the example/README.md for more details, such as deploying it with docker.

🧑‍💻 Development

📥 Install for development

Clone the repository and install the dependencies locally for development:

git clone https://github.com/MaastrichtU-IDS/fair-test
cd fair-test
pip install -e .

You can try to use a virtual environment to avoid conflicts, if you face issues:

# Create the virtual environment folder in your workspace
python3 -m venv .venv
# Activate it using a script in the created folder
source .venv/bin/activate

✔️ Run the tests

Install pytest for testing:

pip install pytest

Run the tests locally (from the root folder) and display prints:

pytest -s

📂 Projects using fair-test

Here are some projects using fair-test to deploy FAIR test services:

You might also like...
♻️ API to run evaluations of the FAIR principles (Findable, Accessible, Interoperable, Reusable) on online resources

♻️ FAIR enough 🎯 An OpenAPI where anyone can run evaluations to assess how compliant to the FAIR principles is a resource, given the resource identif

This is simply code for bitcoin fair value.

About The Project This is a code for bitcoin fair value, its simply exclude bubble data using RANSAC method, and then plot the results. Check youtube

Fairstructure - Structure your data in a FAIR way using google sheets or TSVs

Fairstructure - Structure your data in a FAIR way using google sheets or TSVs. These are then converted to LinkML, and from there other formats

MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.
MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.

MONAI Deploy App SDK offers a framework and associated tools to design, develop and verify AI-driven applications in the healthcare imaging domain.

Gathers data and displays metrics related to climate change and resource depletion on a PowerBI report.

Apocalypse Status Dashboard Purpose Climate change and resource depletion are grave long-term dangers. The code in this repository will pull data from

🐍 The official Python client library for Google's discovery based APIs.

Google API Client This is the Python client library for Google's discovery based APIs. To get started, please see the docs folder. These client librar

The official Python client library for the Kite Connect trading APIs

The Kite Connect API Python client - v3 The official Python client for communicating with the Kite Connect API. Kite Connect is a set of REST-like API

🐍 The official Python client library for Google's discovery based APIs.

Google API Client This is the Python client library for Google's discovery based APIs. To get started, please see the docs folder. These client librar

AuthGG is a Python library for dealing with Auth.gg apis

AuthGG AuthGG is a Python library for dealing with Auth.gg apis Installation Use the package manager pip to install requests Add the auth.py file in y

Releases(0.0.10)
  • 0.0.10(Nov 23, 2022)

  • 0.0.9(Nov 23, 2022)

    Changes

    • Move the process to harvest metadata for a URL to a separate class MetadataHarvester

    Full Changelog: https://github.com/MaastrichtU-IDS/fair-test/compare/0.0.8...0.0.9

    Source code(tar.gz)
    Source code(zip)
  • 0.0.8(Sep 21, 2022)

    Changelog

    • Migrated from setup.py to using pyproject.toml with Hatch as build backend
    • Improved development workflow to use hatch virtual environment management capabilities

    Full Changelog: https://github.com/MaastrichtU-IDS/fair-test/compare/0.0.7...0.0.8

    Source code(tar.gz)
    Source code(zip)
  • 0.0.7(May 13, 2022)

    Changelog

    • Enable to define readme url and contact infos in each metric test
    • Improve support for signposting links in retrieve_metadata(): extracting meta, alternate and describedby

    Full Changelog: https://github.com/MaastrichtU-IDS/fair-test/compare/0.0.6...0.0.7

    Source code(tar.gz)
    Source code(zip)
  • 0.0.6(Apr 4, 2022)

    Changelog

    • Various improvements to the FairTestEvaluation helpers to extract metadata
    • retrieve_rdf() has been renamed to retrieve_metadata(), and can now return JSON as a fallback if RDF metadata is not found
    Source code(tar.gz)
    Source code(zip)
  • 0.0.5(Mar 28, 2022)

  • 0.0.4(Mar 28, 2022)

    Changelog

    • FAIR Tests now also returns metadata they retrieved during the process (provided as hashmap under the predicate http://semanticscience.org/resource/metadata)
    • Add new helpers functions such as extract_prop(g, props_list) or extract_data_uri(g)
    • Refactor name of functions to use snake case style consistently
    • Don't print() anymore when using self.log() to avoid too much logs
    • Now also tested for python 3.10
    • Improve tests
    Source code(tar.gz)
    Source code(zip)
  • 0.0.3(Feb 15, 2022)

  • 0.0.2(Feb 15, 2022)

  • 0.0.1(Feb 14, 2022)

Owner
Maastricht University IDS
Institute of Data Science at Maastricht University
Maastricht University IDS
Telegram Group Calls Streaming bot with some useful features, written in Python with Pyrogram and Py-Tgcalls. Supporting platforms like Youtube, Spotify, Resso, AppleMusic, Soundcloud and M3u8 Links.

Yukki Music Bot Yukki Music Bot is a Powerful Telegram Music+Video Bot written in Python using Pyrogram and Py-Tgcalls by which you can stream songs,

Team Yukki 996 Dec 28, 2022
Ubuntu env build; Nginx build; DB build;

Deploy 介绍 Deploy related scripts bitnami Dependencies Ubuntu openssl envsubst docker v18.06.3 docker-compose init base env upload https://gitlab-runn

Colin(liuji) 10 Dec 1, 2021
A script to forward mass number of media to another group/channel. Heroku deploy

Telegram Forward Script ?? This is a Script to Forward Large Number of Files to Another Telegram Channel. Star එකක් දාල fork එකක් ගහපියව් ?? If You Tr

Anjana Madu 17 Oct 21, 2022
Tools used by Ada Health's internal IT team to deploy and manage a serverless Munki setup.

Serverless Munki This repository contains cross platform code to deploy a production ready Munki service, complete with AutoPkg, that runs entirely fr

Ada Health 17 Dec 5, 2022
szrose is an all in one group management bot made for managing your group effectively with some advance security tools & Suit For All Your Needs ❤️

szrose is an all in one group management bot made for managing your group effectively with some advance security tools & Suit For All Your Needs ❤️

szsupunma 93 Jan 7, 2023
L3DAS22 challenge supporting API

L3DAS22 challenge supporting API This repository supports the L3DAS22 IEEE ICASSP Grand Challenge and it is aimed at downloading the dataset, pre-proc

L3DAS 38 Dec 25, 2022
This is RequestTrackerBot and it used for tracking request made by user in a group

This is a Request Tracker Bot repo, It is for those who upload content like movies, anime, etc. It can be used for tracking request of content that your members asked for.

Abhijeet 27 Dec 29, 2022
An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. This is Also The Source Code of The Bot Which is Being Used In @SafoTheBot Group! ❤️

Telegram Video Player Bot (Beta) An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. Special Features Supports Live Streaming From

SAF ONE 206 Jan 3, 2023
HASOKI DDOS TOOL- powerful DDoS toolkit for penetration tests

DDoS Attack Panel includes CloudFlare Bypass (UAM, CAPTCHA, GS ,VS ,BFM, etc..) This is open source code. I am not responsible if you use it for malic

Rebyc 1 Dec 2, 2022
Snipe fair coin launches. Contact @dannsniper on telegram for whitelist

Pancakeswap-sniper Pancakeswap Sniper bot Full version of Pancakeswap sniping bot used to snipe during fair coin launches. With advanced options and a

null 36 Nov 1, 2021