Skip to content

KPMP-6538: added code to return the ontology id to cell type mapping#205

Merged
zwright merged 2 commits intodevelopfrom
KPMP-6538_HubmapMapping
Mar 2, 2026
Merged

KPMP-6538: added code to return the ontology id to cell type mapping#205
zwright merged 2 commits intodevelopfrom
KPMP-6538_HubmapMapping

Conversation

@rlreamy
Copy link
Contributor

@rlreamy rlreamy commented Feb 26, 2026

Summary by CodeRabbit

  • New Features

    • Added new GraphQL query endpoint to retrieve HUBMAP cell type ontology term mappings for improved data integration and interoperability
  • Chores

    • Updated Java runtime environment version from 11 to 21.0.4, providing better performance and security improvements
    • Refactored and simplified build configuration to streamline the development process
    • Removed unused imports and cleaned up dependencies across the application

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

Walkthrough

Introduces Hubmap cell type mapping feature with new JPA entity, repository, and service for building ID-to-cell-type maps. Extends QueryController to expose GraphQL query endpoint. Updates build configuration and removes unused imports.

Changes

Cohort / File(s) Summary
Core Hubmap Cell Type Feature
src/main/java/org/kpmp/cellType/HubmapOntologyCellType.java, src/main/java/org/kpmp/cellType/HubmapOnotologyCellTypeRepository.java, src/main/java/org/kpmp/cellType/HubmapCellTypeMappingService.java
Added new JPA entity mapping to humbapOntology_celltype_v table with hubmapOntologyId and cell_type fields. Added Spring Data repository with cacheable findAll(). Added service to build Map<String, String> from ontology IDs to cell types.
QueryController Extension
src/main/java/org/kpmp/QueryController.java
Injected HubmapCellTypeMappingService dependency. Extended constructor to accept service. Added new public GraphQL query getHubmapTermMap() that returns Map<String, String>.
GraphQL Schema Update
src/main/resources/graphql/knowledge_environment.graphqls
Added JSON scalar type and exposed getHubmapTermMap(): JSON field on Query type.
Test Coverage
src/test/java/org/kpmp/QueryControllerTest.java, src/test/java/org/kpmp/cellType/HubmapCellTypeMappingServiceTest.java, src/test/java/org/kpmp/cellType/HubmapOntologyCellTypeTest.java
Added QueryController test for new GraphQL query with mocked service. Added unit tests for HubmapCellTypeMappingService covering normal and empty-list scenarios. Added entity tests for getters/setters and default values.
Code Cleanup
src/main/java/org/kpmp/cellTypeSummary/ClusterHiearchyRepository.java, src/main/java/org/kpmp/cellTypeSummary/ClusterHierarchy.java, src/main/java/org/kpmp/umap/SNMetadataRepository2025.java
Removed unused imports.
Build Configuration
.classpath, .java-version
Updated Java version from 11 to 21.0.4. Restructured classpath with simplified main/test scope annotations, new container entries, and updated output paths.

Sequence Diagram

sequenceDiagram
    actor Client
    participant GraphQL as GraphQL API
    participant QueryController
    participant HubmapCellTypeMappingService
    participant HubmapOnotologyCellTypeRepository
    participant Database

    Client->>GraphQL: getHubmapTermMap()
    GraphQL->>QueryController: getHubmapTermMap()
    QueryController->>HubmapCellTypeMappingService: buildHubmapIdToCellTypeMap()
    HubmapCellTypeMappingService->>HubmapOnotologyCellTypeRepository: findAll()
    HubmapOnotologyCellTypeRepository->>Database: SELECT * FROM humbapOntology_celltype_v
    Database-->>HubmapOnotologyCellTypeRepository: HubmapOntologyCellType list
    HubmapOnotologyCellTypeRepository-->>HubmapCellTypeMappingService: cached result
    HubmapCellTypeMappingService->>HubmapCellTypeMappingService: build Map<hubmapOntologyId, cell_type>
    HubmapCellTypeMappingService-->>QueryController: Map<String, String>
    QueryController-->>GraphQL: Map<String, String>
    GraphQL-->>Client: JSON response
Loading
✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch KPMP-6538_HubmapMapping

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/main/java/org/kpmp/cellType/HubmapOnotologyCellTypeRepository.java (1)

11-11: Rename repository type to fix spelling (OnotologyOntology).

The current type name is misspelled and will propagate across service/tests. Please rename to HubmapOntologyCellTypeRepository for maintainability.


ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b9f00a and 8c4111c.

📒 Files selected for processing (13)
  • .classpath
  • .java-version
  • src/main/java/org/kpmp/QueryController.java
  • src/main/java/org/kpmp/cellType/HubmapCellTypeMappingService.java
  • src/main/java/org/kpmp/cellType/HubmapOnotologyCellTypeRepository.java
  • src/main/java/org/kpmp/cellType/HubmapOntologyCellType.java
  • src/main/java/org/kpmp/cellTypeSummary/ClusterHiearchyRepository.java
  • src/main/java/org/kpmp/cellTypeSummary/ClusterHierarchy.java
  • src/main/java/org/kpmp/umap/SNMetadataRepository2025.java
  • src/main/resources/graphql/knowledge_environment.graphqls
  • src/test/java/org/kpmp/QueryControllerTest.java
  • src/test/java/org/kpmp/cellType/HubmapCellTypeMappingServiceTest.java
  • src/test/java/org/kpmp/cellType/HubmapOntologyCellTypeTest.java
💤 Files with no reviewable changes (3)
  • src/main/java/org/kpmp/cellTypeSummary/ClusterHierarchy.java
  • src/main/java/org/kpmp/umap/SNMetadataRepository2025.java
  • src/main/java/org/kpmp/cellTypeSummary/ClusterHiearchyRepository.java

import jakarta.persistence.Table;

@Entity
@Table(name = "humbapOntology_celltype_v")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

rg -n "humbapOntology_celltype_v|hubmapOntology_celltype_v|hubmap_ontology_celltype_v|humbap|hubmap" --type-list | head -20

Repository: KPMP/pegasus-data

Length of output: 450


🏁 Script executed:

# Check for SQL migrations, schema files, or database definitions
fd -e sql -e ddl -e schema | head -20

Repository: KPMP/pegasus-data

Length of output: 43


🏁 Script executed:

# Search for other `@Table` annotations to understand naming conventions
rg -n "@Table" -A 1 | head -40

Repository: KPMP/pegasus-data

Length of output: 3356


🏁 Script executed:

rg "humbap|hubmap" -n

Repository: KPMP/pegasus-data

Length of output: 1750


🏁 Script executed:

# Check the specific file mentioned in the review
cat -n src/main/java/org/kpmp/cellType/HubmapOntologyCellType.java | head -30

Repository: KPMP/pegasus-data

Length of output: 927


🏁 Script executed:

# Search for SQL files or migrations that define tables
find . -type f \( -name "*.sql" -o -name "*.migration" -o -name "*schema*" \) | head -20

Repository: KPMP/pegasus-data

Length of output: 43


Fix @Table name annotation: typo "humbap" should be "hubmap".

The table name humbapOntology_celltype_v contains a typo. The class name, field names, methods, service names, and cache key all consistently use hubmap, not humbap. This mismatch will cause JPA to fail mapping the entity to the database table at runtime.

@@ -1,3 +1,5 @@
scalar JSON
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

rg -n "ExtendedScalars\\.Json|GraphQLScalarType|RuntimeWiringConfigurer|scalar\s+JSON|@SchemaMapping|GraphQLQueryResolver" --type graphql --type java --type kotlin

Repository: KPMP/pegasus-data

Length of output: 92


🏁 Script executed:

# Also look for GraphQL configuration files and beans
fd -e java -e kt | xargs rg -l "Scalar|graphql.*config|GraphQLSchema" | head -20

Repository: KPMP/pegasus-data

Length of output: 43


🏁 Script executed:

# Search for scalar wiring patterns more broadly
rg -n "withScalar|addScalar|scalar.*Json|JSON.*Scalar" --type java --type kt

Repository: KPMP/pegasus-data

Length of output: 87


🏁 Script executed:

# Search without file type restrictions
rg "ExtendedScalars|GraphQLScalarType|RuntimeWiringConfigurer|withScalar|addScalar" -i

Repository: KPMP/pegasus-data

Length of output: 43


🏁 Script executed:

# Find all GraphQL-related files and Java configuration files
fd -e graphqls -o -e java | grep -E "(config|scalar|graphql)" -i

Repository: KPMP/pegasus-data

Length of output: 177


🏁 Script executed:

# Look at the directory structure
tree src/main/resources/graphql -L 2 2>/dev/null || find src/main/resources/graphql -type f

Repository: KPMP/pegasus-data

Length of output: 143


🏁 Script executed:

# Search for GraphQL schema provider or wiring configuration
rg "GraphQL|Scalar|Schema" --type java -l | head -10

Repository: KPMP/pegasus-data

Length of output: 236


🏁 Script executed:

# Search for GraphQL configuration classes and beans
rg "@Configuration|@Bean.*GraphQL|@Bean.*Scalar" -A 2

Repository: KPMP/pegasus-data

Length of output: 235


🏁 Script executed:

# Look for GraphQL Java dependencies and setup
rg "graphql|GraphQL" -i | grep -E "(import|package|config|scalar)" | head -20

Repository: KPMP/pegasus-data

Length of output: 628


🏁 Script executed:

# Examine the QueryController file
cat -n src/main/java/org/kpmp/QueryController.java

Repository: KPMP/pegasus-data

Length of output: 12114


🏁 Script executed:

# Search for pom.xml or gradle files to see GraphQL dependencies
find . -name "pom.xml" -o -name "build.gradle" -o -name "build.gradle.kts" | head -5

Repository: KPMP/pegasus-data

Length of output: 75


🏁 Script executed:

# Read Application.java for GraphQL configuration
cat -n src/main/java/org/kpmp/Application.java

Repository: KPMP/pegasus-data

Length of output: 1275


🏁 Script executed:

# Read build.gradle for GraphQL dependencies
cat -n build.gradle

Repository: KPMP/pegasus-data

Length of output: 3416


🏁 Script executed:

# Search for any GraphQL schema provider or wiring configuration
rg "SchemaProvider|RuntimeWiring|graphql.*config" -i -A 3

Repository: KPMP/pegasus-data

Length of output: 43


🏁 Script executed:

# Look for application properties/yml files
find . -name "application*.properties" -o -name "application*.yml" -o -name "application*.yaml"

Repository: KPMP/pegasus-data

Length of output: 104


🏁 Script executed:

# Search for any schema loading configuration
rg "location.*graphql|graphql.*location|schema.*location" -i

Repository: KPMP/pegasus-data

Length of output: 43


🏁 Script executed:

# Check if there's a GraphQL configuration file elsewhere
find . -type f -name "*config*" -o -name "*graphql*" | grep -v node_modules | grep -v build | head -20

Repository: KPMP/pegasus-data

Length of output: 163


🏁 Script executed:

# Look for CustomScalar or scalar registration patterns
rg "CustomScalar|Scalar.*String|@Scalar" -i -A 2

Repository: KPMP/pegasus-data

Length of output: 43


🏁 Script executed:

# Read application.properties
cat -n src/main/resources/application.properties

Repository: KPMP/pegasus-data

Length of output: 1241


🏁 Script executed:

# Check if there's any GraphQL configuration in properties/yml
rg "graphql" -i src/main/resources/

Repository: KPMP/pegasus-data

Length of output: 230


🏁 Script executed:

# Search for RuntimeWiring, SchemaProvider, or any Bean that might provide scalars
rg "RuntimeWiring|SchemaProvider|GraphQLSchema" -A 5

Repository: KPMP/pegasus-data

Length of output: 43


🏁 Script executed:

# Look for any files that might contain scalar configuration
find src -name "*.java" | xargs rg -l "Scalar|scalar" -i

Repository: KPMP/pegasus-data

Length of output: 45


🏁 Script executed:

# Check if graphql-java-tools or spring-graphql auto-configures scalars
rg "JSON.*scalar|scalar.*JSON" -i

Repository: KPMP/pegasus-data

Length of output: 130


🏁 Script executed:

# Search more broadly for any schema provider or configuration that might be loading/wiring scalars
rg -A 10 "extends.*SchemaProvider|implements.*SchemaProvider|SchemaFactory"

Repository: KPMP/pegasus-data

Length of output: 43


🏁 Script executed:

# Check for any bean definitions or factory methods related to GraphQL schema
rg "@Bean|@Component|public.*GraphQL" -A 3 src/main/java

Repository: KPMP/pegasus-data

Length of output: 3631


🏁 Script executed:

# Look for any TypeDefinitionRegistry or SDL-to-schema conversion
rg "TypeDefinitionRegistry|SDLValidation|GraphQLSchema\\.newSchema"

Repository: KPMP/pegasus-data

Length of output: 43


Add JSON scalar wiring to resolve schema at runtime.

The scalar JSON declaration requires explicit wiring to function. GraphQL Java does not auto-register custom scalars, and no scalar configuration was found in the codebase (no ExtendedScalars, GraphQLScalarType, or RuntimeWiringConfigurer). Without wiring, query execution will fail with scalar serialization errors.

Register the JSON scalar in your GraphQL schema provider or configuration bean using ExtendedScalars.Json or a custom GraphQLScalarType.

getAtlasMessages: [AtlasMessages]
getExperimentalStrategyCountsByParticipant(redcapId: String!): [ParticipantRepoDataTypeInformation]
getParticipantClinicalDataset(redcapId: String!): ParticipantClinicalDataset
getHubmapTermMap(): JSON
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

GraphQL SDL field definition empty argument list () syntax specification

💡 Result:

In GraphQL SDL, a field’s argument definitions cannot use an empty parentheses list ().

Per the spec grammar:

So field(): String is invalid SDL; omit the parentheses instead: field: String.

Citations:


🏁 Script executed:

# Locate and read the GraphQL schema file
find . -name "knowledge_environment.graphqls" -type f | head -5

Repository: KPMP/pegasus-data

Length of output: 120


🏁 Script executed:

# Read the GraphQL file to see the context around line 26
cat -n ./src/main/resources/graphql/knowledge_environment.graphqls | head -35

Repository: KPMP/pegasus-data

Length of output: 2254


Remove empty argument list from GraphQL field definition.

getHubmapTermMap(): JSON violates GraphQL SDL specification. Per the spec, ArgumentsDefinition requires one or more arguments when parentheses are present; no-argument fields must omit the parentheses entirely.

Fix
-  getHubmapTermMap(): JSON
+  getHubmapTermMap: JSON
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
getHubmapTermMap(): JSON
getHubmapTermMap: JSON

@zwright zwright merged commit 78501e7 into develop Mar 2, 2026
1 check passed
@zwright zwright deleted the KPMP-6538_HubmapMapping branch March 2, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants