Repository navigation
[BI-2925] Swap externalIds with real Ids for BrAPI endpoints for observationVariables - #573
jloux-brapi wants to merge 8 commits into
Conversation
|
|
||
| private void processObservationVariables(List<BrAPIObservationVariable> observationVariables, Program program) { | ||
| observationVariables.forEach(observationVariable -> { | ||
| observationVariable.setObservationVariableName(Utilities.removeProgramKey(observationVariable.getObservationVariableName(), program.getKey())); |
There was a problem hiding this comment.
This strips only the current program’s key. For a program subscribed to a shared ontology, variables are stored with the owner’s key, so the single GET returns names like Height [OWN] while the list shows Height. Also, getObservationVariableName() isn’t null-checked like the scale/method/trait names, so a null name throws an NPE inside removeProgramKey.
There was a problem hiding this comment.
I removed these changes in favor of unifying the response data between the get by dbId and the general GET, so this comment is not relevant anymore I think.
There was a problem hiding this comment.
Agreed, thanks. Searching only the program’s traits covers it.
One thing I noticed: the lookup on line 161 of the controller uses traitService.getByProgramId, which doesn’t follow subscribed ontologies, while the list uses ontologyService.getTraitsByProgramId. So for a subscribed program, the list shows a variable but GET by its id returns 404. Could we switch to ontologyService.getTraitsByProgramId(programId, true)? (OntologyService is already injected into BrAPIObservationVariableService but isn’t used.)
There was a problem hiding this comment.
As discussed in Slack, to me this is an existing bug I'm not sure I want to handle in the glob of code that is the cache removal branch.
I think it would be worth discussing the problem with the team, so I made this ticket for the effort. We can discuss at next backlog refinement.
Description
Story: BI-2925
BrAPIObservationController.get methodsconvertToBrAPImethod use to doDependencies
Testing
observationVariableDbId,methodDbId,scaleDbId,traitDbIdare all valid brapiDbIds for their associated entity/table.observationVariableDbId,methodDbId,scaleDbId,traitDbId. These parameters must use the brapi dbIds for these in order to filter properly. You will need a auth bearer token from the BrAPI sidebar tab in DeltaBreed. Verify theobservationVariableDbId,methodDbId,scaleDbId,traitDbIdare all valid brapiDbIds for their associated entity/table.studyDbIdparameters to filter. This studyDbId must be related to the program referenced in the url. These parameters must use the brapi dbIds for these in order to filter properly. You will need a auth bearer token from the BrAPI sidebar tab in DeltaBreed. Verify theobservationVariableDbIdis a valid brapiDbId for the associated entity/table.traittable belonging to or shared for the program. You will need an auth bearer token from the BrAPI sidebar tab in DeltaBreed. Verify theobservationVariableDbIdis a valid brapi id for the table/entity.Checklist: