plantbreeding / brapi-java-testserver Goto Github PK
View Code? Open in Web Editor NEWBrAPI Java Spring-Boot Test Server
Home Page: https://brapi.org
License: MIT License
BrAPI Java Spring-Boot Test Server
Home Page: https://brapi.org
License: MIT License
Create a trait:
https://test-server.brapi.org/brapi/v2/variables
[{
"additionalInfo": {},
"commonCropName": "Tomatillo",
"contextOfUse": [],
"defaultValue": null,
"documentationURL": null,
"externalReferences": [
{
"referenceID": "3ad28fb5-e23f-4561-abb4-c554ee364d17",
"referenceSource": "breeding-insight.org"
}
],
"growthStage": null,
"institution": "Test 4 Updated",
"language": "english",
"method": {
"additionalInfo": {},
"bibliographicalReference": null,
"description": "Test",
"externalReferences": [
{
"referenceID": "72301e7c-0b92-476f-9b24-953ae84e9ce3",
"referenceSource": "breeding-insight.org"
}
],
"formula": null,
"methodClass": "Measurement",
"methodName": "Test Trait Measurement",
"ontologyReference": null
},
"ontologyReference": null,
"scale": {
"additionalInfo": {},
"dataType": "Numerical",
"decimalPlaces": 2,
"externalReferences": [
{
"referenceID": "dfa62af0-1194-4c55-b04f-3032f61fc34e",
"referenceSource": "breeding-insight.org"
}
],
"ontologyReference": null,
"scaleName": "grams",
"validValues": {
"categories": [],
"max": 10,
"min": 1
}
},
"scientist": "BI-DEV Admin",
"status": "active",
"submissionTimestamp": null,
"synonyms": [],
"trait": {
"additionalInfo": {},
"alternativeAbbreviations": [],
"attribute": null,
"entity": "Plant",
"externalReferences": [
{
"referenceID": "3ad28fb5-e23f-4561-abb4-c554ee364d17",
"referenceSource": "breeding-insight.org"
}
],
"mainAbbreviation": null,
"ontologyReference": null,
"status": "active",
"synonyms": [],
"traitClass": null,
"traitDescription": "Test",
"traitName": "Test Trait"
},
"observationVariableName": "Test Trait"
}]
Then try to update it (notice change in scale decimal places, valid value min, valid value max):
{
"additionalInfo": {},
"commonCropName": "Tomatillo",
"contextOfUse": [],
"defaultValue": null,
"documentationURL": null,
"externalReferences": [
{
"referenceID": "3ad28fb5-e23f-4561-abb4-c554ee364d17",
"referenceSource": "breeding-insight.org"
}
],
"growthStage": null,
"institution": "Test 4 Updated",
"language": "english",
"method": {
"additionalInfo": {},
"bibliographicalReference": null,
"description": "Test",
"externalReferences": [
{
"referenceID": "72301e7c-0b92-476f-9b24-953ae84e9ce3",
"referenceSource": "breeding-insight.org"
}
],
"formula": null,
"methodClass": "Measurement",
"methodName": "Test Trait Measurement UPDATED",
"ontologyReference": null,
"methodDbId": "994fa424-63b3-42e0-8909-436ac1edce06"
},
"ontologyReference": null,
"scale": {
"additionalInfo": {},
"dataType": "Numerical",
"decimalPlaces": null,
"externalReferences": [
{
"referenceID": "dfa62af0-1194-4c55-b04f-3032f61fc34e",
"referenceSource": "breeding-insight.org"
}
],
"ontologyReference": null,
"scaleName": "grams",
"validValues": {
"categories": [],
"max": null,
"min": null
},
"scaleDbId": "e940a5b3-6168-446b-9666-d823d1d3c57e"
},
"scientist": "BI-DEV Admin",
"status": "active",
"submissionTimestamp": null,
"synonyms": [],
"trait": {
"additionalInfo": {},
"alternativeAbbreviations": [],
"attribute": null,
"entity": "Plant",
"externalReferences": [
{
"referenceID": "3ad28fb5-e23f-4561-abb4-c554ee364d17",
"referenceSource": "breeding-insight.org"
}
],
"mainAbbreviation": null,
"ontologyReference": null,
"status": "active",
"synonyms": [],
"traitClass": null,
"traitDescription": "Test",
"traitName": "Test Trait UPDATED",
"traitDbId": "2f6e8ff8-ce19-4ed5-9711-4f60922e716e"
},
"observationVariableDbId": "40deb32b-a416-410e-ae7e-11c42c98b996",
"observationVariableName": "Test Trait"
}
Result:
The scale decimal places, valid value min, valid value max don't change to be null.
It doesn't matter if you supply parameters or leave them all null. The response is always empty.
When doing a POST /germplasm, it would be nice if individual parent information are also populated in the pedigree
table, and also be able to display the information in the GET /germplasm endpoint:
[
{
"germplasmName": "Tomato",
...
"pedigree": {
"pedigreeDbId": "a5629d27-947c-4bcf-b776-f05f85b5e899",
"pedigree": "parent1/parent2",
"parent1Id": "433971ba-87b5-446a-bfdb-dd8206981817",
"parent1Name": "parent1",
"parent2Id": "fb1ca2ff-e1ce-452a-b8bf-ed815b8e2017",
"parent2Name": "parent2",
}
}
]
Testing the test server:
POST https://test-server.brapi.org/brapi/v2/observationunits
[
{
"additionalInfo": {},
"externalReferences": [
{
"referenceID": "2.0030434E7",
"referenceSource": "ou_id"
}
],
"germplasmDbId": "germplasm1",
"observationUnitName": "2.0030434E7",
"programDbId": "program2"
}
]
Result:
programId
comes back null. It is also null in GET /observationunits
.
No matter what I enter the response acts like I entered nothing.
Sorting by studyDbId and trialDbId with sortOrder "DESC" doesn't work. "ASC" appears to work because it produces results in ascending order. But leaving sortOrder blank or putting in a bogus value also produces an ascending order. Perhaps "ASC" is not really working: perhaps I am getting the ascending order because that is the default behavior.
This issue is similar to issue #329.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click second GET under Programs.
Click "Try it out."
For searchResultsDbId fill in a previously generated valid value that will return all programs.
For pageSize fill in 3.
Click Execute.
Response header says 1) totalCount: 3 (should be 6) and 2) totalPages: 1 (should be 2).
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click first GET under Studies.
Click "Try it out."
For Study Search request fill in
{
"active": null,
"commonCropNames": [],
"germplasmDbIds": [],
"locationDbIds": [],
"observationVariableDbIds": [],
"page": 0,
"pageSize": 1000,
"programDbIds": [],
"programNames": [],
"seasonDbIds": [],
"sortBy": "studyDbId",
"sortOrder": "ASC",
"studyDbIds": [],
"studyNames": [],
"studyTypeDbIds": [],
"studyTypeNames": [],
"trialDbIds": []
}
The result is correct but the metadata pageSize, totalCount and totalPages are all 0. I don't know what pageSize is used by default but totalCount and totalPages should probably be 1.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click third GET under Studies.
Click "Try it out."
For commonCropName fill in "abc" or "Tomatillo" or leave it blank.
Click Execute.
No matter what you do in step 4., the response that is produced is unaffected by the commonCropName value.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click fourth GET under Studies.
Click "Try it out."
For studyDbId fill in 1001 (a valid value).
Click Execute.
The result is correct but the metadata pageSize, totalCount and totalPages are all 0. I don't know what pageSize is used by default but totalCount and totalPages should probably be 1.
The POST search observation units endpoint doesn't filter results, and returns 500 for at least one search param.
The following search will return all of the observation units in the db when it should return no results:
{
"germplasmDbId": ["test"]
}
The following search with return a 500 error:
{
"germplasmNames": ["test"]
}
EDIT: This seems to be the case for the search germplasm endpoint too.
I called this method with studyDbId == 1001. I tried format == "csv", "tsv", and blank. All I get back is a file with contents "OrderedMap {}". Is this correct?
404 should be reserved for bad request path
use 400 (Bad Request) when a DbId in the request body is not found
Hey Peter and brapi-staff,
I ran into a small issue when trying to run the v2 test server on Eclipse using the installation instructions.
My properties file:
server.port = 8080
server.servlet.context-path=/brapi/v2
spring.datasource.url=jdbc:postgresql://localhost:5432/brapi
spring.datasource.username=postgres
spring.datasource.password=test
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.hbm2ddl.import_files=sql/crops.sql, sql/lists.sql, sql/locations.sql, sql/people.sql, sql/programs.sql, sql/trials.sql, sql/seasons.sql, sql/studies.sql, sql/breeding_methods.sql, sql/germplasm.sql, sql/attribute_defs.sql, sql/attribute_values.sql, sql/seed_lots.sql, sql/observation_units.sql, sql/crosses.sql, sql/pedigree.sql, sql/events.sql, sql/images.sql, sql/observation_variables.sql, sql/observations.sql, sql/samples.sql, sql/allele_calls.sql, sql/genome_maps.sql, sql/references.sql, sql/vendor.sql
spring.mvc.dispatch-options-request=true
After building the project with maven, creating the database, and updating the postgres user password to 'test', I ran into this exception when running the TestServer:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1704) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) ~[spring-context-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:858) ~[spring-context-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:122) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
at org.brapi.test.BrAPITestServer.BrapiTestServer.main(BrapiTestServer.java:17) ~[classes/:na]
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at org.hibernate.boot.spi.XmlMappingBinderAccess.<init>(XmlMappingBinderAccess.java:43) ~[hibernate-core-5.2.11.Final.jar:5.2.11.Final]
at org.hibernate.boot.MetadataSources.<init>(MetadataSources.java:87) ~[hibernate-core-5.2.11.Final.jar:5.2.11.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:208) ~[hibernate-core-5.2.11.Final.jar:5.2.11.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:163) ~[hibernate-core-5.2.11.Final.jar:5.2.11.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:51) ~[spring-orm-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:358) ~[spring-orm-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:384) ~[spring-orm-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:373) ~[spring-orm-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1763) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1700) ~[spring-beans-5.0.0.RELEASE.jar:5.0.0.RELEASE]
... 16 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
... 26 common frames omitted
I'm fairly new to using Eclipse as an IDE so apologies if this was a simple configuration error on my end.
I added this dependency to the pom.xml and rebuilt the project, and it works.
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
Thanks again for this great project :)
For observationLevel
I have called with plant
and plot
but I always get an empty result set. What should I expect?
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click GET under Calls.
Click "Try it out."
For dataType, select "application/json."
Click Execute.
Even though I did not touch the pageSize text box (leaving it at 1000) the response acts like I specified 2.
https://test-server.brapi.org/brapi/v1/studies/1001/table/?format=json
The headerrow returns 15 names but the data have only 14 columns. It seems, in the data the locationDbId column is missing.
I clobbered it during my testing. Could you reboot (or restore or whatever you do to get the data back)? I'll try to minimize my destructive testing.
Using the endpoint:
POST https://test-server.brapi.org/brapi/v2/crosses
With data:
[
{
"crossName":"Purple Squash",
"crossType":"BIPARENTAL",
"crossProjectDbId":"19489e27-955c-4757-bd5c-319ef643ba3e",
"externalReferences":[
{
"referenceID":"POSTED REFERENCE ID",
"referenceSource":"Intercross"
}
],
"parent1":{
"germplasmDbId":"germplasm3",
"germplasmName":"Tomatillo Fantastico",
"observationUnitDbId":"observation_unit1",
"observationUnitName":"testM",
"parentType":"MALE"
},
"parent2":{
"germplasmDbId":"germplasm2",
"germplasmName":"Tomatillo Fantastico",
"observationUnitDbId":"observation_unit1",
"observationUnitName":"testF",
"parentType":"FEMALE"
}
}
]
Returns a 200 with the response:
{
"@context": null,
"metadata": {
"datafiles": [],
"status": [],
"pagination": {
"pageSize": 0,
"totalCount": 0,
"totalPages": 0,
"currentPage": 0
}
},
"result": {
"data": [
{
"additionalInfo": {},
"crossAttributes": [],
"crossName": "Purple Squash",
"crossType": "BIPARENTAL",
"crossingProjectDbId": null,
"crossingProjectName": null,
"externalReferences": [],
"parent1": {
"germplasmDbId": "germplasm3",
"germplasmName": "Tomatillo Fantastico",
"observationUnitDbId": "observation_unit1",
"observationUnitName": "Plot 1",
"parentType": "MALE"
},
"parent2": {
"germplasmDbId": "germplasm2",
"germplasmName": "Tomatillo Fantastico",
"observationUnitDbId": "observation_unit1",
"observationUnitName": "Plot 1",
"parentType": "FEMALE"
},
"pollinationTimeStamp": null,
"crossDbId": "49191556-1846-4c44-8507-da4ad504366f"
}
]
}
}
The response does not contain the posted external references, which will be important for persisting ID's generated in Intercross for barcoding.
Crosses api spec:
https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI-Germplasm/2.0#/Crosses/post_crosses
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click first GET under Programs.
Click "Try it out."
For commonCropName fill in "abc" or "Tomatillo" or leave it blank.
Click Execute.
No matter what you do in step 4., the response that is produced is unaffected by the commonCropName value.
Set up:
POST /observationunits
[
{"observationUnitName": "test"},
{"observationUnitName": "test2"}
]
then POST crosses:
[
{
"crossName": "200304310\\2003183010",
"parent1": {
"observationUnitDbId": "e330b11b-fa77-49a9-922e-992f6da066fc"
},
"parent2": {
"observationUnitDbId": "e330b11b-fa77-49a9-922e-992f6da066fc"
}
}
]
this will return the parents. But if you GET /crosses, not parents are returned.
If I select "trialDbId" for sortBy I get an exception that explains the server has a problem with trial.id.
DESC works but desc doesn't.
No matter what I enter the response acts like I entered nothing.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click second GET under Locations.
Click "Try it out."
For locationDbId fill in 1.
Click Execute.
The result is correct but the metadata pageSize, totalCount and totalPages are all 0. I don't know what pageSize is used by default but totalCount and totalPages should probably be 1.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click first GET under Programs.
Click "Try it out."
For pageSize fill in 3.
Click Execute.
Response header says 1) totalCount: 3 (should be 6) and 2) totalPages: 1 (should be 2).
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click second GET under Trials.
Click "Try it out."
For trialDbId fill in 106 (a valid value).
Click Execute.
The result is correct but the metadata pageSize, totalCount and totalPages are all 0. I don't know what pageSize is used by default but totalCount and totalPages should probably be 1.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click GET under Calls.
Click "Try it out."
For dataType, select "application/json."
Click Execute.
Response says error(s) have occurred.
Server seems to be down since Friday (22 Nov), are you able to restore it?
When you PUT /variables and include the trait id, the trait is not updated to the values set in the request body.
Simple example:
{
"synonyms": ["t3", "t4"],
"trait": {
"traitDbId": "4c81bc62-dc5d-4436-ad3d-cdb783340645",
"entity": "Plant",
"synonyms": ["t3", "t4"]
}
}
The trait entity and trait synonyms will not be updated with the request above.
This POST works:
https://test-server.brapi.org/brapi/v2/plannedcrosses
{
"additionalInfo": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"crossType": "BIPARENTAL",
"crossingProjectDbId": "19489e27-955c-4757-bd5c-319ef643ba3e",
"crossingProjectName": "Virtual Hackathon Test",
"externalReferences": [],
"parent1": {
"germplasmDbId": "germplasm3",
"germplasmName": "Tomatillo Fantastico",
"observationUnitDbId": "cb60e4f3-27d8-4b99-bb69-642b543fd438",
"observationUnitName": "testM",
"parentType": "MALE"
},
"parent2": {
"germplasmDbId": "germplasm2",
"germplasmName": "Tomatillo Fantastico",
"observationUnitDbId": "6af79609-357f-44e4-bcad-0c924b18ecc1",
"observationUnitName": "testF",
"parentType": "FEMALE"
},
"plannedCrossName": "ab"
}
]
Afterwards, I get the following result:
"result": {
"data": [
{
"additionalInfo": {},
"crossType": "BIPARENTAL",
"crossingProjectDbId": "19489e27-955c-4757-bd5c-319ef643ba3e",
"crossingProjectName": "Virtual Hackathon Test",
"externalReferences": [],
"parent1": {
"germplasmDbId": "germplasm3",
"germplasmName": "Tomatillo Fantastico",
"observationUnitDbId": "cb60e4f3-27d8-4b99-bb69-642b543fd438",
"observationUnitName": "testM",
"parentType": "MALE"
},
"parent2": {
"germplasmDbId": "germplasm2",
"germplasmName": "Tomatillo Fantastico",
"observationUnitDbId": "6af79609-357f-44e4-bcad-0c924b18ecc1",
"observationUnitName": "testF",
"parentType": "FEMALE"
},
"plannedCrossName": "ab",
"plannedCrossDbId": "b3fa62b3-18ba-426a-a287-71c0c5e43cd1"
}
]
}
Next, when I try GET https://test-server.brapi.org/brapi/v2/plannedcrosses
The cross parents show up as null:
{
"additionalInfo": {},
"crossType": "BIPARENTAL",
"crossingProjectDbId": "19489e27-955c-4757-bd5c-319ef643ba3e",
"crossingProjectName": "Virtual Hackathon Test",
"externalReferences": [],
"parent1": null,
"parent2": null,
"plannedCrossName": "ab",
"plannedCrossDbId": "b3fa62b3-18ba-426a-a287-71c0c5e43cd1"
}
Fill in 1 for pageSize. Response header says totalCount 1 (should be 3) and totalPages 1 (should be 3).
Fill in 1 for page and 1 for pageSize. Response header says totalCount 2 and totalPages 2.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click first GET under Trials.
Click "Try it out."
For commonCropName fill in "abc" or "Tomatillo" or leave it blank.
Click Execute.
No matter what you do in step 4., the response that is produced is unaffected by the commonCropName value.
Hi,
I'm currently working on a BrAPI harvester that can extract data from multiple BrAPI data sources and I've come across something strange on the BrAPI test server at https://test-server.brapi.org/brapi
The study "1003"
is accessible at:
GET https://test-server.brapi.org/brapi/v1/studies/1003
But it is not listed in studies-search at:
GET https://test-server.brapi.org/brapi/v1/studies-search
It seems that in the BrAPI test server implementation the "active"
search parameter is set to true
by default:
Shouldn't it be null
(using the java Boolean
type) by default to show both active and inactive studies?
I don't think the BrAPI study search specification specifies this behaviour.
Please restore.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click GET under Calls.
Click "Try it out."
For dataType, select any choice.
Click Execute.
No matter what I select for dataType, all 103 calls are returned.
I called this method with observationTimeStampRangeStart == 2000-11-11T11:11:11Z
. I get the server response with status 500 Error and body
{
"timestamp": 1558717632212,
"status": 500,
"error": "Internal Server Error",
"message": "Parameter value [2000-11-11T11:11:11Z] did not match expected type [java.util.Date (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [2000-11-11T11:11:11Z] did not match expected type [java.util.Date (n/a)]",
"path": "/brapi/v1/observationunits"
}
First, I put() a value for observationTimeStamp. Then, I check results by get()ing. The returned value is from 1970 even though the value I put is in 2013.
https://test-server.brapi.org/brapi/v2/germplasm?studyDbId=study1&page=0&pageSize=20
There was an unexpected error (type=Internal Server Error, status=500).
org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'study.id' [SELECT entity FROM org.brapi.test.BrAPITestServer.model.entity.germ.GermplasmEntity entity where 1=1 AND study.id in :_study_id ]; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'study.id' [SELECT entity FROM org.brapi.test.BrAPITestServer.model.entity.germ.GermplasmEntity entity where 1=1 AND study.id in :_study_id ]
https://test-server.brapi.org/brapi/v2/studies?studyDbId=study1&page=0&pageSize=1000
Also add brapi-fieldmap into the list of suspects that might be pushing invalid/incomplete data into the server, specially into observationUnits ๐
I ran this on the test server:
curl -X PUT "https://test-server.brapi.org/brapi/v1/studies/1002/observationunits" -H "accept: application/json" -H "Content-Type: application/json" -d "class NewObservationUnitRequests {
data: [class NewObservationUnitRequest {
X: null
Y: null
blockNumber: 1
entryNumber: 5
entryType: TEST
germplasmDbId: 1
observationLevel: null
observationUnitDbId: 5
observationUnitName: Plot 3
observationUnitXref: null
observations: [class Observation {
germplasmDbId: 1
germplasmName: Name001
observationDbId: 9
observationLevel: null
observationTimeStamp: 2013-06-14T22:11:51Z
observationUnitDbId: 5
observationUnitName: Plot 3
observationVariableDbId: MO_123:100002
observationVariableName: Plant height
operator: null
season: class Season {
season: spring
seasonDbId: 3
year: 2012
}
studyDbId: null
uploadedBy: null
value: 2.1
}]
plantNumber: 0
plotNumber: 3
positionCoordinateX: null
positionCoordinateXType: null
positionCoordinateY: null
positionCoordinateYType: null
replicate: 0
studyDbId: null
treatments: null
}, class NewObservationUnitRequest {
X: null
Y: null
blockNumber: 1
entryNumber: 6
entryType: TEST
germplasmDbId: 1
observationLevel: null
observationUnitDbId: 6
observationUnitName: Plant 3
observationUnitXref: null
observations: [class Observation {
germplasmDbId: 1
germplasmName: Name001
observationDbId: 10
observationLevel: null
observationTimeStamp: 2013-06-14T22:12:51Z
observationUnitDbId: 6
observationUnitName: Plant 3
observationVariableDbId: MO_123:100006
observationVariableName: Virus severity
operator: null
season: class Season {
season: spring
seasonDbId: 3
year: 2012
}
studyDbId: null
uploadedBy: null
value: 4.5
}]
plantNumber: 3
plotNumber: 3
positionCoordinateX: null
positionCoordinateXType: null
positionCoordinateY: null
positionCoordinateYType: null
replicate: 0
studyDbId: null
treatments: null
}, class NewObservationUnitRequest {
X: null
Y: null
blockNumber: 1
entryNumber: 7
entryType: TEST
germplasmDbId: 3
observationLevel: null
observationUnitDbId: 7
observationUnitName: Plot 4
observationUnitXref: null
observations: [class Observation {
germplasmDbId: 3
germplasmName: Name003
observationDbId: 11
observationLevel: null
observationTimeStamp: 2013-06-14T22:13:51Z
observationUnitDbId: 7
observationUnitName: Plot 4
observationVariableDbId: MO_123:100003
observationVariableName: Carotenoid
operator: null
season: class Season {
season: spring
seasonDbId: 3
year: 2012
}
studyDbId: null
uploadedBy: null
value: 1.4
}]
plantNumber: 0
plotNumber: 4
positionCoordinateX: null
positionCoordinateXType: null
positionCoordinateY: null
positionCoordinateYType: null
replicate: 0
studyDbId: null
treatments: null
}, class NewObservationUnitRequest {
X: null
Y: null
blockNumber: 1
entryNumber: 8
entryType: CHECK
germplasmDbId: 3
observationLevel: null
observationUnitDbId: 8
observationUnitName: Plant 4
observationUnitXref: null
observations: [class Observation {
germplasmDbId: 3
germplasmName: Name003
observationDbId: 12
observationLevel: null
observationTimeStamp: 2013-06-14T22:14:51Z
observationUnitDbId: 8
observationUnitName: Plant 4
observationVariableDbId: MO_123:100005
observationVariableName: Root color
operator: null
season: class Season {
season: spring
seasonDbId: 3
year: 2012
}
studyDbId: null
uploadedBy: null
value: red
}]
plantNumber: 4
plotNumber: 4
positionCoordinateX: null
positionCoordinateXType: null
positionCoordinateY: null
positionCoordinateYType: null
replicate: 0
studyDbId: null
treatments: null
}]
}"
Testing out POST /variables. Looks like strings and integers will work, but objects and arrays do not. This body will work:
[{
"observationVariableName" : "Soluble solids",
"additionalInfo": {
"testString": "works",
"testInt": 1
}
}]
This body won't work:
[{
"observationVariableName" : "Soluble solids",
"additionalInfo": {
"testString": "works",
"testInt": "works as well",
"testObject": {
"field": "doesn't work"
},
"testArray": ["doesn't work", "doesn't work 1"]
}
}]
A 400 is returned if testObject
is sent alone, or testArray
is sent alone as well.
Multiple methods (e.g., GET /calls?page=0?pageSize=1000) produce Code 403 and Error: Response body:
Internal Error. Invalid proxy-token
. You need to send the SwaggerHub cookie with this request, and populate proxy-token
with the value inside
This issue is similar to issue #329.
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click first GET under Studies.
Click "Try it out."
For searchResultsDbId fill in a previously generated valid value that will return all programs.
For pageSize fill in 1.
Click Execute.
Response header says 1) totalCount: 1 (should be 3) and 2) totalPages: 1 (should be 3).
To reproduce:
Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3
Click first POST under Studies.
Click "Try it out."
Click "Edit."
Fill in
{
"active": null,
"commonCropNames": ["abc"],
"germplasmDbIds": [],
"locationDbIds": [],
"observationVariableDbIds": [],
"page": 0,
"pageSize": 1000,
"programDbIds": [],
"programNames": [],
"seasonDbIds": [],
"sortBy": "studyDbId",
"sortOrder": "ASC",
"studyDbIds": [],
"studyNames": [],
"studyTypeDbIds": [],
"studyTypeNames": [],
"trialDbIds": []
}
No matter what you do in step 5., the response that is produced is unaffected by the commonCropName value.
When I enter "1001" for studyDbId and "MO123:100002" for observationVariableDbIds I am expecting a Response with totalCount == 1 but I get 8. Am I misunderstanding the method or is there a bug in the server code or is it something else?
Example:
POST /studies
[
{
"active": true,
"additionalInfo": {},
"commonCropName": "Blueberry",
"contacts": [],
"culturalPractices": null,
"dataLinks": [],
"documentationURL": null,
"endDate": null,
"environmentParameters": [],
"experimentalDesign": null,
"externalReferences": [],
"growthFacility": null,
"lastUpdate": {
"timestamp": "2021-10-07T12:05:18.271944-04:00",
"version": "testing lastUpdate"
},
"license": null,
"locationDbId": null,
"locationName": null,
"observationLevels": [],
"observationUnitsDescription": null,
"seasons": [],
"startDate": null,
"studyCode": null,
"studyDescription": "test",
"studyName": "test study",
"studyPUI": null,
"studyType": null,
"trialDbId": null,
"trialName": null,
"studyDbId": null
}
]
GET /studies
[
{
"active": true,
"additionalInfo": {},
"commonCropName": "Blueberry",
"contacts": [],
"culturalPractices": null,
"dataLinks": [],
"documentationURL": null,
"endDate": null,
"environmentParameters": [],
"experimentalDesign": null,
"externalReferences": [],
"growthFacility": null,
"lastUpdate": null,
"license": null,
"locationDbId": null,
"locationName": null,
"observationLevels": [],
"observationUnitsDescription": null,
"seasons": [],
"startDate": null,
"studyCode": null,
"studyDescription": "test",
"studyName": "test study",
"studyPUI": null,
"studyType": null,
"trialDbId": null,
"trialName": null,
"studyDbId": "1e826807-22ce-41a1-8803-600e15ae8f33"
}
]
Below are descriptions for errors in the POST germplasm endpoint. Quick summary, there seems to be issues with the germplasmOrigin and storageTypes fields and the donors, institute code, institute name, synonyms, or taxons do not cause errors, but are not saved properly.
I'm doing POST germplasm to the brapi test server and it errors out when I include a germplasmOrigin in there. Here is the body I am sending,
[
{
"accessionNumber": "A0000001",
"acquisitionDate": "2000-04-09",
"additionalInfo": {
"dummyData": "True"
},
"biologicalStatusOfAccessionCode": "120",
"biologicalStatusOfAccessionDescription": "Semi-natural/wild",
"breedingMethodDbId": "breeding_method1",
"collection": "Fake Foods Collection",
"commonCropName": "Tomatillo",
"countryOfOriginCode": "USA",
"defaultDisplayName": "Fantastico",
"documentationURL": "https://wiki.brapi.org",
"donors": [
{
"donorAccessionNumber": "A1111111",
"donorInstituteCode": "USA999",
"germplasmPUI": "doi:10.12345/A1111111"
}
],
"externalReferences": [
{
"referenceID": "https://brapi.org/specification",
"referenceSource": "BrAPI Doc"
}
],
"genus": "Aspergillus",
"germplasmName": "Tomatillo Fantastico",
"germplasmOrigin": [
{
"coordinateUncertainty": "20",
"coordinates": {
"geometry": {
"coordinates": [
42.535140,
-76.554040,
123.099800
],
"type": "Point"
},
"type": "Feature"
}
}
],
"germplasmPUI": "doi:10.12345/A0000001",
"germplasmPreprocessing": "EO:0007210; transplanted from study 2351 observation unit ID: pot:894",
"instituteCode": "USA999",
"instituteName": "BrAPI Science Institute",
"pedigree": "A2342345/A1231234",
"seedSource": "Root Stock",
"seedSourceDescription": "Branches were collected from a 10-year-old tree growing in a progeny trial established in a loamy brown earth soil.",
"species": "fructus",
"speciesAuthority": "Smith, 1822",
"storageTypes": [
{
"value": "10",
"description": "Seed collection"
}
],
"subtaxa": "Aspergillus fructus A",
"subtaxaAuthority": "Smith, 1822",
"synonyms": [
{
"synonym": "Variety 123",
"type": "Pre-Code"
}
],
"taxonIds": [
{
"sourceName": "NCBI",
"taxonId": "2026747"
}
]
}
]
Here is the error I am getting:
{
"timestamp": 1600345699155,
"status": 500,
"error": "Internal Server Error",
"message": "Type definition error: [simple type, class io.swagger.model.GeoJSONGeometry]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `io.swagger.model.GeoJSONGeometry` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information\n at [Source: (PushbackInputStream); line: 35, column: 27] (through reference chain: java.util.ArrayList[0]->io.swagger.model.germ.GermplasmNewRequest[\"germplasmOrigin\"]->java.util.ArrayList[0]->io.swagger.model.germ.GermplasmOrigin[\"coordinates\"]->io.swagger.model.GeoJSON[\"geometry\"])",
"path": "/brapi/v2/germplasm"
}
When I remove germplasmOrigin I get an error about storageTypes:
{
"timestamp": 1600345988841,
"status": 500,
"error": "Internal Server Error",
"message": "Type definition error: [simple type, class io.swagger.model.germ.GermplasmStorageTypes]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `io.swagger.model.germ.GermplasmStorageTypes` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: (PushbackInputStream); line: 42, column: 13] (through reference chain: java.util.ArrayList[0]->io.swagger.model.germ.GermplasmNewRequest[\"storageTypes\"]->java.util.ArrayList[0])",
"path": "/brapi/v2/germplasm"
}
Removed storageTypes and it works
Also, when you POST and you have donors, institute code, institute name, synonyms, or taxons populated, it doesn't seem to save those fields. It will return them in the POST response but if you GET that specific germplasm afterward it doesn't return those fields.
When run with studyDbId set to 1001 or 1002 the response says 200 update successful. When I then GET 1001 or 1002 I get nothing back. On the client side there is no indication of failure.
When I use pageSize 1, the response says I asked for 1000.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.