Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cgendreau committed Dec 4, 2024
2 parents de741cd + 4c765db commit 9326b51
Show file tree
Hide file tree
Showing 58 changed files with 2,000 additions and 51 deletions.
28 changes: 25 additions & 3 deletions docs/sequencingModule.drawio
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" version="24.8.6">
<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" version="25.0.1">
<diagram id="R2lEEEUBdFMjLlhIrx00" name="Page-1">
<mxGraphModel dx="3774" dy="2232" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0" extFonts="Permanent Marker^https://fonts.googleapis.com/css?family=Permanent+Marker">
<root>
Expand Down Expand Up @@ -255,10 +255,10 @@
<mxGeometry y="50" width="220" height="70" as="geometry" />
</mxCell>
<mxCell id="eqc2HW3YAauhOSHSL4pR-13" value="GenericMolecularAnalysisItem" style="swimlane;childLayout=stackLayout;horizontal=1;startSize=50;horizontalStack=0;rounded=1;fontSize=14;fontStyle=0;strokeWidth=2;resizeParent=0;resizeLast=1;shadow=0;dashed=0;align=center;arcSize=4;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-795" y="810" width="315" height="160" as="geometry" />
<mxGeometry x="-795" y="810" width="315" height="140" as="geometry" />
</mxCell>
<mxCell id="eqc2HW3YAauhOSHSL4pR-14" value="+ id: uuid&lt;div style=&quot;&quot;&gt;+ g&lt;span style=&quot;text-align: center; text-wrap: wrap;&quot;&gt;enericMolecularAnalysis:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;text-align: center; text-wrap: wrap;&quot;&gt;GenericMolecularAnalysis&lt;/span&gt;&lt;br&gt;+&amp;nbsp;materialSample: uuid&lt;div&gt;+&amp;nbsp;storageUnitUsage: uuid&lt;/div&gt;&lt;div&gt;+ molecularAnalysisRunItem: M&lt;span style=&quot;background-color: initial;&quot;&gt;olecularAnalysisRunItem&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="align=left;strokeColor=none;fillColor=none;spacingLeft=4;fontSize=12;verticalAlign=top;resizable=0;rotatable=0;part=1;html=1;" parent="eqc2HW3YAauhOSHSL4pR-13" vertex="1">
<mxGeometry y="50" width="315" height="110" as="geometry" />
<mxGeometry y="50" width="315" height="90" as="geometry" />
</mxCell>
<mxCell id="eqc2HW3YAauhOSHSL4pR-15" value="GenericMolecularAnalysis" style="swimlane;childLayout=stackLayout;horizontal=1;startSize=50;horizontalStack=0;rounded=1;fontSize=14;fontStyle=0;strokeWidth=2;resizeParent=0;resizeLast=1;shadow=0;dashed=0;align=center;arcSize=4;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-757" y="622" width="240" height="120" as="geometry" />
Expand Down Expand Up @@ -542,6 +542,28 @@
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="k8eRWqbm7Qu-VPUC3GOa-1" value="QualityControl" style="swimlane;childLayout=stackLayout;horizontal=1;startSize=50;horizontalStack=0;rounded=1;fontSize=14;fontStyle=0;strokeWidth=2;resizeParent=0;resizeLast=1;shadow=0;dashed=0;align=center;arcSize=4;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="-1230" y="720" width="340" height="130" as="geometry" />
</mxCell>
<mxCell id="k8eRWqbm7Qu-VPUC3GOa-2" value="+ id: uuid&lt;br&gt;+ name: string&lt;div&gt;+ qcType: string&lt;/div&gt;&lt;div&gt;+&amp;nbsp;molecularAnalysisRunItem: MolecularAnalysisRunItem&lt;/div&gt;" style="align=left;strokeColor=none;fillColor=none;spacingLeft=4;fontSize=12;verticalAlign=top;resizable=0;rotatable=0;part=1;html=1;" vertex="1" parent="k8eRWqbm7Qu-VPUC3GOa-1">
<mxGeometry y="50" width="340" height="80" as="geometry" />
</mxCell>
<mxCell id="k8eRWqbm7Qu-VPUC3GOa-4" value="" style="endArrow=none;html=1;rounded=0;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;edgeStyle=orthogonalEdgeStyle;" edge="1" parent="1" source="QrDlIFSupUpyl6qbgHXB-9" target="k8eRWqbm7Qu-VPUC3GOa-1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="-1000" y="654.5" as="sourcePoint" />
<mxPoint x="-895" y="709.5" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="k8eRWqbm7Qu-VPUC3GOa-5" value="0 ..1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="k8eRWqbm7Qu-VPUC3GOa-4">
<mxGeometry x="0.6952" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="k8eRWqbm7Qu-VPUC3GOa-6" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="k8eRWqbm7Qu-VPUC3GOa-4">
<mxGeometry x="-0.6381" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
Expand Down
Binary file modified docs/sequencingModule.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>ca.gc.aafc</groupId>
<artifactId>seqdb.api</artifactId>
<version>2.17.0</version>
<version>2.18.0</version>
<packaging>jar</packaging>

<name>seqdb-api</name>
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/ca/gc/aafc/seqdb/api/ResourceRepositoryConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package ca.gc.aafc.seqdb.api;

import io.crnk.core.engine.registry.ResourceRegistry;
import javax.inject.Inject;

import ca.gc.aafc.dina.DinaBaseApiAutoConfiguration;
import ca.gc.aafc.seqdb.api.dto.SequenceManagedAttributeDto;
import ca.gc.aafc.seqdb.api.util.ManagedAttributeIdMapper;

import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
Expand All @@ -11,4 +17,14 @@
@EntityScan("ca.gc.aafc.seqdb.api.entities")
@ComponentScan(basePackageClasses = DinaBaseApiAutoConfiguration.class)
public class ResourceRepositoryConfig {

@Inject
@SuppressWarnings({"deprecation", "unchecked"})
public void setupManagedAttributeLookup(ResourceRegistry resourceRegistry) {
var resourceInfo = resourceRegistry.getEntry(SequenceManagedAttributeDto.class)
.getResourceInformation();

resourceInfo.setIdStringMapper(
new ManagedAttributeIdMapper(resourceInfo.getIdStringMapper()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
@PropertySource(value = "classpath:vocabulary/pcrBatchType.yml", factory = YamlPropertyLoaderFactory.class)
@PropertySource(value = "classpath:vocabulary/sequencingType.yml", factory = YamlPropertyLoaderFactory.class)
@PropertySource(value = "classpath:vocabulary/molecularAnalysisType.yml", factory = YamlPropertyLoaderFactory.class)
@PropertySource(value = "classpath:vocabulary/qualityControlType.yml", factory = YamlPropertyLoaderFactory.class)
@ConfigurationProperties
@Validated
public class SequenceVocabularyConfiguration extends VocabularyConfiguration<VocabularyElementConfiguration> {

public static final String PCR_BATCH_TYPE_VOCAB_KEY = "pcrBatchType";
public static final String SEQUENCING_TYPE_VOCAB_KEY = "sequencingType";
public static final String MOLECULAR_ANALYSIS_TYPE_VOCAB_KEY = "molecularAnalysisType";
public static final String QUALITY_CONTROL_TYPE_VOCAB_KEY = "qualityControlType";

public SequenceVocabularyConfiguration(Map<String, List<VocabularyElementConfiguration>> vocabulary) {
super(vocabulary);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package ca.gc.aafc.seqdb.api.dto;

import io.crnk.core.resource.annotations.JsonApiField;
import io.crnk.core.resource.annotations.JsonApiId;
import io.crnk.core.resource.annotations.JsonApiRelation;
import io.crnk.core.resource.annotations.JsonApiResource;
import io.crnk.core.resource.annotations.PatchStrategy;
import java.time.OffsetDateTime;
import java.util.Map;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down Expand Up @@ -41,4 +44,11 @@ public class GenericMolecularAnalysisDto {
@JsonApiRelation
private ExternalRelationDto protocol;

/**
* Map of Managed attribute key to value object.
*/
@JsonApiField(patchStrategy = PatchStrategy.SET)
@Builder.Default
private Map<String, String> managedAttributes = Map.of();

}
45 changes: 45 additions & 0 deletions src/main/java/ca/gc/aafc/seqdb/api/dto/MetagenomicsBatchDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package ca.gc.aafc.seqdb.api.dto;

import ca.gc.aafc.dina.dto.ExternalRelationDto;
import ca.gc.aafc.dina.dto.RelatedEntity;
import ca.gc.aafc.dina.repository.meta.JsonApiExternalRelation;
import ca.gc.aafc.seqdb.api.entities.MetagenomicsBatch;

import io.crnk.core.resource.annotations.JsonApiId;
import io.crnk.core.resource.annotations.JsonApiRelation;
import io.crnk.core.resource.annotations.JsonApiResource;
import java.time.OffsetDateTime;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonApiResource(type = MetagenomicsBatchDto.TYPENAME)
@RelatedEntity(MetagenomicsBatch.class)
public class MetagenomicsBatchDto {

public static final String TYPENAME = "metagenomics-batch";

@JsonApiId
private UUID uuid;

private String createdBy;

private OffsetDateTime createdOn;
private String group;

private String name;

@JsonApiExternalRelation(type = "protocol")
@JsonApiRelation
private ExternalRelationDto protocol;

@JsonApiRelation
private IndexSetDto indexSet;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package ca.gc.aafc.seqdb.api.dto;

import ca.gc.aafc.dina.dto.RelatedEntity;
import ca.gc.aafc.seqdb.api.dto.pcr.PcrBatchItemDto;
import ca.gc.aafc.seqdb.api.entities.MetagenomicsBatchItem;

import io.crnk.core.resource.annotations.JsonApiId;
import io.crnk.core.resource.annotations.JsonApiRelation;
import io.crnk.core.resource.annotations.JsonApiResource;
import java.time.OffsetDateTime;
import java.util.UUID;

import org.javers.core.metamodel.annotation.ShallowReference;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonApiResource(type = MetagenomicsBatchItemDto.TYPENAME)
@RelatedEntity(MetagenomicsBatchItem.class)
public class MetagenomicsBatchItemDto {

public static final String TYPENAME = "metagenomics-batch-item";

@JsonApiId
private UUID uuid;

private String createdBy;

private OffsetDateTime createdOn;

@JsonApiRelation
private MetagenomicsBatchDto metagenomicsBatch;

@JsonApiRelation
private PcrBatchItemDto pcrBatchItem;

@ShallowReference
@JsonApiRelation
private MolecularAnalysisRunItemDto molecularAnalysisRunItem;

@JsonApiRelation
private NgsIndexDto indexI5;

@JsonApiRelation
private NgsIndexDto indexI7;

}
48 changes: 48 additions & 0 deletions src/main/java/ca/gc/aafc/seqdb/api/dto/QualityControlDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package ca.gc.aafc.seqdb.api.dto;

import io.crnk.core.resource.annotations.JsonApiId;
import io.crnk.core.resource.annotations.JsonApiRelation;
import io.crnk.core.resource.annotations.JsonApiResource;
import java.time.OffsetDateTime;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import org.javers.core.metamodel.annotation.Id;
import org.javers.core.metamodel.annotation.PropertyName;
import org.javers.core.metamodel.annotation.TypeName;

import ca.gc.aafc.dina.dto.RelatedEntity;
import ca.gc.aafc.seqdb.api.entities.QualityControl;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonApiResource(type = QualityControlDto.TYPENAME)
@TypeName(QualityControlDto.TYPENAME)
@RelatedEntity(QualityControl.class)
public class QualityControlDto {

public static final String TYPENAME = "quality-control";

@JsonApiId
@Id
@PropertyName("id")
private UUID uuid;

private String createdBy;
private OffsetDateTime createdOn;

private String group;

private String name;

private String qcType;

@JsonApiRelation
private MolecularAnalysisRunItemDto molecularAnalysisRunItem;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package ca.gc.aafc.seqdb.api.dto;

import ca.gc.aafc.dina.dto.RelatedEntity;
import ca.gc.aafc.dina.i18n.MultilingualDescription;
import ca.gc.aafc.dina.vocabulary.TypedVocabularyElement;
import ca.gc.aafc.seqdb.api.entities.SequenceManagedAttribute;

import io.crnk.core.resource.annotations.JsonApiId;
import io.crnk.core.resource.annotations.JsonApiResource;
import lombok.Data;

import java.time.OffsetDateTime;
import java.util.UUID;

import org.javers.core.metamodel.annotation.Id;
import org.javers.core.metamodel.annotation.PropertyName;
import org.javers.core.metamodel.annotation.TypeName;

@RelatedEntity(SequenceManagedAttribute.class)
@Data
@JsonApiResource(type = SequenceManagedAttributeDto.TYPENAME)
@TypeName(SequenceManagedAttributeDto.TYPENAME)
public class SequenceManagedAttributeDto {
public static final String TYPENAME = "managed-attribute";

@JsonApiId
@Id
@PropertyName("id")
private UUID uuid;
private String name;
private String key;
private TypedVocabularyElement.VocabularyElementType vocabularyElementType;
private String unit;
private SequenceManagedAttribute.ManagedAttributeComponent managedAttributeComponent;
private String[] acceptedValues;
private OffsetDateTime createdOn;
private String createdBy;
private String group;
private MultilingualDescription multilingualDescription;

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ca.gc.aafc.seqdb.api.entities;

import java.time.OffsetDateTime;
import java.util.Map;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
Expand All @@ -20,6 +21,7 @@
import org.hibernate.annotations.Generated;
import org.hibernate.annotations.GenerationTime;
import org.hibernate.annotations.NaturalId;
import org.hibernate.annotations.Type;

import ca.gc.aafc.dina.entity.DinaEntity;

Expand Down Expand Up @@ -61,4 +63,10 @@ public class GenericMolecularAnalysis implements DinaEntity {
@Size(max = 50)
private String analysisType;

@Type(type = "jsonb")
@NotNull
@Builder.Default
@Column(name = "managed_attributes")
private Map<String, String> managedAttributes = Map.of();

}
Loading

0 comments on commit 9326b51

Please sign in to comment.