Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data model separation #621

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
bece83d
plateDbId display fix
BrapiCoordinatorSelby Mar 24, 2023
19fc7bb
Jenkins Commit
BrapiCoordinatorSelby Mar 24, 2023
b1a5e12
read the docs update
BrapiCoordinatorSelby Oct 6, 2023
ccc48c6
read the docs update
BrapiCoordinatorSelby Oct 6, 2023
cd9f355
read the docs update
BrapiCoordinatorSelby Oct 6, 2023
842cf1f
read the docs update
BrapiCoordinatorSelby Oct 6, 2023
1b42478
read the docs update
BrapiCoordinatorSelby Oct 6, 2023
1c8f796
read the docs update
BrapiCoordinatorSelby Oct 6, 2023
d6fb44d
read the docs updates
BrapiCoordinatorSelby Oct 6, 2023
e39aec6
read the docs updates
BrapiCoordinatorSelby Oct 6, 2023
eed6a7a
read the docs updates
BrapiCoordinatorSelby Oct 6, 2023
2de4521
Update Observation_Levels.rst
mlm483 Jul 8, 2024
9072f11
improved documentation example
mlm483 Aug 19, 2024
1b04600
Merge pull request #607 from mlm483/patch-2
BrapiCoordinatorSelby Aug 26, 2024
80ab2d1
Create .readthedocs.yaml
BrapiCoordinatorSelby Sep 11, 2024
a3c1e4c
Update conf.py
BrapiCoordinatorSelby Sep 11, 2024
f16e8c6
Update conf.py
BrapiCoordinatorSelby Sep 11, 2024
a517328
Update conf.py
BrapiCoordinatorSelby Sep 11, 2024
8564579
Update conf.py
BrapiCoordinatorSelby Sep 11, 2024
e837d82
Update .readthedocs.yaml
BrapiCoordinatorSelby Sep 11, 2024
0c30597
wiki config updates
BrapiCoordinatorSelby Sep 11, 2024
ad8d942
Merge branch 'brapi-V2.1' into data-model-separation
BrapiCoordinatorSelby Sep 11, 2024
e60eaaf
Merge pull request #613 from plantbreeding/LzLang-patch-1
LzLang Oct 15, 2024
71170c3
Add gradle and workflow
Oct 16, 2024
c8efcac
updated .gitignore
Oct 16, 2024
6d998e1
allow for manual run
Oct 16, 2024
559c089
updated gradle build
Oct 18, 2024
0d72b00
Added OWL and README.md
Nov 11, 2024
908780a
Merge pull request #619 from plantbreeding/gradle-build
daveneti Nov 11, 2024
217390a
Update generate-schema.yml
daveneti Nov 12, 2024
1ffbbc9
Update generate-schema.yml
daveneti Nov 12, 2024
5c555db
added working directory to action
Nov 12, 2024
8ca3c6e
change wrapper permissions
Nov 12, 2024
bc08322
added working directory
Nov 12, 2024
72ac895
removed gradle action setup
Nov 12, 2024
3cb6676
Update generate-schema.yml
daveneti Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/generate-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Java CI with Gradle

on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Change wrapper permissions
working-directory: ./generator/
run: chmod +x ./gradlew
- name: Build with Gradle Wrapper
working-directory: ./generator/
run: ./gradlew validate
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
.DS_Store
.settings/
.idea
.vscode/
.idea

/_temp
brapi_blueprint.apib
Expand Down
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion Scripts/buildReadMes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def buildTitleStr(path, method, params = [], deprecated = False):
uniquePathStr = ' /brapi/v2' + path
for param in params:
if param['in'] == 'query' :
uniquePathStr += '{?' + param['name'] + '}'
uniquePathStr += '{?' + param['name'] + '}'

if uniquePathStr in uniquePaths:
uniquePathStr += '/'
Expand Down
126 changes: 126 additions & 0 deletions Scripts/oauth_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@

import requests
import webbrowser
from threading import Lock
from fastapi import FastAPI
import uvicorn
from pyoauth2.client import OAuth2AuthorizationFlow, FileStorage, OAuth2APIRequest
import contextlib
import time
import threading
import uvicorn

class Server(uvicorn.Server):
def install_signal_handlers(self):
pass

@contextlib.contextmanager
def run_in_thread(self):
thread = threading.Thread(target=self.run)
thread.start()
try:
while not self.started:
time.sleep(1e-3)
yield
finally:
self.should_exit = True
thread.join()

class BrAPIRequest(OAuth2APIRequest):
def __init__(self, access_token):
OAuth2APIRequest.__init__(self, access_token)
self.authorization_header = {"Authorization": "Bearer %s" % self.access_token}

code_lock = Lock()
code_val = {"code": ""}

async def root(code: str):
code_val["code"] = code
code_lock.release()

async def lifespan_func(app: FastAPI):
code_lock.acquire()
print("temp server start")
yield
print("temp server shutdown")

def redirect_function(url):
print("hello?")
app = FastAPI(lifespan=lifespan_func)
app.add_api_route("/login/redirect", root)

config = uvicorn.Config(app=app, host="127.0.0.1", port=8000, log_level="info")
server = Server(config=config)
with server.run_in_thread():
webbrowser.open_new_tab(url)
with code_lock:
print(code_val["code"] )

return code_val["code"]


def retrieve_authorization_code(required_params,
extra_auth_params,
extra_token_params, redirect_func=None):
""" retrieve authorization code to get access token
"""

request_param = {
"client_id": required_params['client_id'],
"redirect_uri": required_params['redirect_uri'],
'scope' : required_params['scope']
}

if extra_auth_params:
request_param.update(extra_auth_params)

r = requests.get(required_params['auth_uri'], params=request_param,
allow_redirects=False)
url = r.url
return url

if __name__ == '__main__':

yt_feed_uri = r"https://test-server.brapi.org/brapi/v2/studies"

required_params = {
'client_id': "exampleClient",
'client_secret': "pnosdgBScMmNVc2vpY1cEwBYjsImpAZn",
'auth_uri': "https://auth.brapi.org/realms/brapi/protocol/openid-connect/auth",
'token_uri': "https://test-server.brapi.org/realms/brapi/protocol/openid-connect/token",
'scope': [r'openid profile'],
'redirect_uri': "http://localhost:8000/login/redirect"
}

extra_auth_params = {
'response_type': "code",
'access_type': "offline"
}

extra_token_params = {
'grant_type': "authorization_code",
}

# storage = FileStorage('/example_client.dat')
# credentials = storage.get()
credentials = None
input("proceed?")
if credentials is None:
flow = OAuth2AuthorizationFlow(required_params,
extra_auth_params,
extra_token_params,
False)


code = flow.retrieve_authorization_code(redirect_func=redirect_function)
flow.set_authorization_code(code)
credentials = flow.retrieve_token()
# storage.save(credentials)

access_token = credentials['access_token']

req = BrAPIRequest(access_token)
data = req.request(yt_feed_uri)
print(data)


12 changes: 12 additions & 0 deletions Specification/BrAPI-Genotyping/Plates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Get a filtered list of `Plates`. Each `Plate` is a collection of `Samples` that

<table>
<tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr>
<tr><td><span style="font-weight:bold;">plateDbId</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>The ID which uniquely identifies a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">plateName</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>A human readable name for a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">additionalInfo</span></td><td>object</td><td>A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.</td></tr>
<tr><td><span style="font-weight:bold;">externalReferences</span></td><td>array[object]</td><td>An array of external reference ids. These are references to this piece of data in an external system. Could be a simple string or a URI.</td></tr>
Expand Down Expand Up @@ -92,6 +93,7 @@ Get a filtered list of `Plates`. Each `Plate` is a collection of `Samples` that
}
],
"plateBarcode": "11223344",
"plateDbId": "a106467f",
"plateFormat": "PLATE_96",
"plateName": "Plate_123_XYZ",
"programDbId": "bd748e00",
Expand Down Expand Up @@ -149,6 +151,7 @@ Submit new Plate entities to the server

<table>
<tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr>
<tr><td><span style="font-weight:bold;">plateDbId</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>The ID which uniquely identifies a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">plateName</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>A human readable name for a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">additionalInfo</span></td><td>object</td><td>A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.</td></tr>
<tr><td><span style="font-weight:bold;">externalReferences</span></td><td>array[object]</td><td>An array of external reference ids. These are references to this piece of data in an external system. Could be a simple string or a URI.</td></tr>
Expand Down Expand Up @@ -235,6 +238,7 @@ Submit new Plate entities to the server
}
],
"plateBarcode": "11223344",
"plateDbId": "a106467f",
"plateFormat": "PLATE_96",
"plateName": "Plate_123_XYZ",
"programDbId": "bd748e00",
Expand Down Expand Up @@ -280,6 +284,7 @@ Update the details of existing Plates

<table>
<tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr>
<tr><td><span style="font-weight:bold;">plateDbId</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>The ID which uniquely identifies a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">plateName</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>A human readable name for a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">additionalInfo</span></td><td>object</td><td>A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.</td></tr>
<tr><td><span style="font-weight:bold;">externalReferences</span></td><td>array[object]</td><td>An array of external reference ids. These are references to this piece of data in an external system. Could be a simple string or a URI.</td></tr>
Expand Down Expand Up @@ -368,6 +373,7 @@ Update the details of existing Plates
}
],
"plateBarcode": "11223344",
"plateDbId": "a106467f",
"plateFormat": "PLATE_96",
"plateName": "Plate_123_XYZ",
"programDbId": "bd748e00",
Expand Down Expand Up @@ -413,6 +419,7 @@ Get the details of a specific `Plate`. Each `Plate` is a collection of `Samples`

<table>
<tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr>
<tr><td><span style="font-weight:bold;">plateDbId</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>The ID which uniquely identifies a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">plateName</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>A human readable name for a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">additionalInfo</span></td><td>object</td><td>A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.</td></tr>
<tr><td><span style="font-weight:bold;">externalReferences</span></td><td>array[object]</td><td>An array of external reference ids. These are references to this piece of data in an external system. Could be a simple string or a URI.</td></tr>
Expand Down Expand Up @@ -471,6 +478,7 @@ Get the details of a specific `Plate`. Each `Plate` is a collection of `Samples`
}
],
"plateBarcode": "11223344",
"plateDbId": "a106467f",
"plateFormat": "PLATE_96",
"plateName": "Plate_123_XYZ",
"programDbId": "bd748e00",
Expand Down Expand Up @@ -544,6 +552,7 @@ Review the <a target="_blank" href="https://wiki.brapi.org/index.php/Search_Serv

<table>
<tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr>
<tr><td><span style="font-weight:bold;">plateDbId</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>The ID which uniquely identifies a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">plateName</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>A human readable name for a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">additionalInfo</span></td><td>object</td><td>A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.</td></tr>
<tr><td><span style="font-weight:bold;">externalReferences</span></td><td>array[object]</td><td>An array of external reference ids. These are references to this piece of data in an external system. Could be a simple string or a URI.</td></tr>
Expand Down Expand Up @@ -688,6 +697,7 @@ Review the <a target="_blank" href="https://wiki.brapi.org/index.php/Search_Serv
}
],
"plateBarcode": "11223344",
"plateDbId": "a106467f",
"plateFormat": "PLATE_96",
"plateName": "Plate_123_XYZ",
"programDbId": "bd748e00",
Expand Down Expand Up @@ -760,6 +770,7 @@ Review the <a target="_blank" href="https://wiki.brapi.org/index.php/Search_Serv

<table>
<tr> <th> Field </th> <th> Type </th> <th> Description </th> </tr>
<tr><td><span style="font-weight:bold;">plateDbId</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>The ID which uniquely identifies a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">plateName</span></td><td>string<br><span style="font-size: smaller; color: red;">(Required)</span></td><td>A human readable name for a `Plate`</td></tr>
<tr><td><span style="font-weight:bold;">additionalInfo</span></td><td>object</td><td>A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.</td></tr>
<tr><td><span style="font-weight:bold;">externalReferences</span></td><td>array[object]</td><td>An array of external reference ids. These are references to this piece of data in an external system. Could be a simple string or a URI.</td></tr>
Expand Down Expand Up @@ -822,6 +833,7 @@ Review the <a target="_blank" href="https://wiki.brapi.org/index.php/Search_Serv
}
],
"plateBarcode": "11223344",
"plateDbId": "a106467f",
"plateFormat": "PLATE_96",
"plateName": "Plate_123_XYZ",
"programDbId": "bd748e00",
Expand Down
6 changes: 3 additions & 3 deletions Specification/BrAPI-Genotyping/Plates/Schemas/Plate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ components:
module: BrAPI-Genotyping
title: Plate
description: A Plate represents the metadata for a collection of Samples. The physical Plate being represented might be a plastic tray full of Samples, or a group of Samples stored in individual containers ie bags, test tubes, etc. Whatever the container is, the Samples in a Plate should be related by the same physical space, though they may or may not be related as part of the same experiment or analysis.
required:
- plateDbId
properties:
required:
- plateDbId
properties:
plateDbId:
description: The ID which uniquely identifies a `Plate`
type: string
Expand Down
2 changes: 1 addition & 1 deletion Wiki/Weekly Meeting Notes.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -730,4 +730,4 @@ For next week,
http://docs.breeding.apiary.io/, disregarding analysisMethod. Return two
keys: total_markers, missing_values, in JSON
* Lukas will get Rebecca to add us as editors.
* Meet Thursdays at 4pm EDT.
* Meet Thursdays at 4pm EDT.
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
import sphinx_rtd_theme
# import sphinx_rtd_theme
extensions = [
'sphinx_rtd_theme'
'sphinx_rtd_theme'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -57,4 +57,4 @@
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
]
]
2 changes: 1 addition & 1 deletion docs/docs/best_practices/Alternative_Standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In BrAPI V2.1, the `/events` endpoint was made compatible with the International
MCPD
----

Multi-Crop Passport Descriptors (MCPD) "is a widely used international standard to facilitate germplasm passport information exchange" (`bioversityinternational.org <https://www.bioversityinternational.org/e-library/publications/detail/faobioversity-multi-crop-passport-descriptors-v21-mcpd-v21/>`__). In BrAPI, the primary way to share Germplasm data is through the "GET /germplasm" endpoint. This endpoint has 24 fields out of the available 41 MCPD fields. The BrAPI specification also defines the endpoint "GET /germplasm/{germplasmDbId}/mcpd". This alternate endpoint allows a user to access all 41 MCPD compliant data points when looking at a specific germplasm entry.
Multi-Crop Passport Descriptors (MCPD) "is a widely used international standard to facilitate germplasm passport information exchange" (`BioversityInternational.org <https://www.bioversityinternational.org/e-library/publications/detail/faobioversity-multi-crop-passport-descriptors-v21-mcpd-v21/>`__). In BrAPI, the primary way to share Germplasm data is through the "GET /germplasm" endpoint. This endpoint has 24 fields out of the available 41 MCPD fields. The BrAPI specification also defines the endpoint "GET /germplasm/{germplasmDbId}/mcpd". This alternate endpoint allows a user to access all 41 MCPD compliant data points when looking at a specific germplasm entry.

GeoJSON
-------
Expand Down
Loading
Loading