Giter Club home page Giter Club logo

brapi-java-testserver's People

Contributors

brapicoordinatorselby avatar chaneylc avatar dependabot[bot] avatar nickpalladino avatar selbizzle avatar timparsons avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brapi-java-testserver's Issues

Scale doesn't update to null with PUT /variables

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.

Read the pedigree string and assign parents

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",    
     }
  }
]

Test Server Studies post_search_studies sortBy, sortOrder Fails

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.

Test Server Studies post_search_studies metadata Incorrect

To reproduce:

  1. Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3

  2. Click first GET under Studies.

  3. Click "Try it out."

  4. 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": []
}
  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.

Search Observation Units doesn't work

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.

GET /studies/{studyDbId}/table

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?

Exception when running TestServer: Error creating bean with name 'entityManagerFactory'

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 :)

Test Data 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.

Post to /crosses does not save external references

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

GET Crosses does not return parents

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.

Test Server is down

Server seems to be down since Friday (22 Nov), are you able to restore it?

Trait is not updated in PUT /variables

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.

CrossParents are null in GET plannedcrosses

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"
}

Default value for study "active" parameter in studies-search

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:

@RequestParam(required=false, defaultValue="true") boolean active,

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.

GET /observationunits

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"
}

Internal Server Error in /brapi/v2/germplasm?studyDbId=

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 ๐Ÿ™ˆ

PUT /studies/1002/observationunits Produces Error Code 400 Bad Request

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
}]
}"

Additional Info only supports strings, arrays and objects return 400

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.

Internal Error

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

Test Server Studies post_search_studies commonCropName Ignored

To reproduce:

  1. Visit https://app.swaggerhub.com/apis/PlantBreedingAPI/BrAPI/1.3

  2. Click first POST under Studies.

  3. Click "Try it out."

  4. Click "Edit."

  5. 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": []
}
  1. Click Execute.

No matter what you do in step 5., the response that is produced is unaffected by the commonCropName value.

POST /studies lastUpdate field successful but GET /studies lastUpdate is always null

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"
      }
]

Errors with POST Germplasm endpoint

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.