Skip to content

Commit

Permalink
Support xlsx upload for measurement metadata registration (#803)
Browse files Browse the repository at this point in the history
Adds XLSX file upload support for measurement metadata registration.

Solves #677

Co-authored-by: KochTobi <[email protected]>
(cherry picked from commit 5de2e98)
  • Loading branch information
sven1103 authored and KochTobi committed Aug 28, 2024
1 parent fb69b1b commit d037c4d
Show file tree
Hide file tree
Showing 15 changed files with 901 additions and 390 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public enum ErrorCode {
NO_ANALYTE_DEFINED,
DATA_ATTACHED_TO_SAMPLES,
SAMPLES_ATTACHED_TO_EXPERIMENT,
SERVICE_FAILED;
SERVICE_FAILED,
UNKNOWN_METADATA;

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ private int readInjectionVolume(String value) throws NumberFormatException {
if (value.isBlank()) {
return -1;
}
return Integer.parseInt(value);
return (int) Double.parseDouble(value);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ protected SampleCode() {
// needed for JPA
}

private SampleCode(String code) {
private SampleCode(String code) throws IllegalArgumentException{
Objects.requireNonNull(code, "Sample code must not be null");
if (code.isBlank()) {
throw new IllegalArgumentException("Sample code must not be blank");
}
this.code = code;
}

public static SampleCode create(String code) {
public static SampleCode create(String code) throws IllegalArgumentException {
return new SampleCode(code);
}

Expand Down
Binary file modified user-interface/src/main/bundles/dev.bundle
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package life.qbic.datamanager.parser;

import java.util.List;
import life.qbic.projectmanagement.application.measurement.MeasurementMetadata;

/**
* <b>Measurement Metadata Converter</b>
* <p>
* Measurement metadata converter enable the client to process a {@link ParsingResult} object and
* convert them into known implementations of the {@link MeasurementMetadata} interface.
*
* @since 1.4.0
*/
public interface MeasurementMetadataConverter {

/**
* Takes an instance of {@link ParsingResult} and tries to convert it to known implementations of
* the {@link MeasurementMetadata} interface.
* <p>
* Currently supported implementations are:
*
* <ul>
* <li>NGS Measurement Metadata {@link life.qbic.projectmanagement.application.measurement.NGSMeasurementMetadata}</li>
* <li>Proteomics Measurement Metadata {@link life.qbic.projectmanagement.application.measurement.ProteomicsMeasurementMetadata}</li>
* </ul>
*
* @param parsingResult the parsing result to take as input for the conversion.
* @param ignoreMeasurementId weather to ignore the measurement identifier or not
* @return a list of converted implementations of {@link MeasurementMetadata}.
* @throws UnknownMetadataTypeException if no matching implementation of
* {@link MeasurementMetadata} can be associated from the
* provided {@link ParsingResult#keys()}.
* @since 1.4.0
*/
List<? extends MeasurementMetadata> convert(ParsingResult parsingResult,
boolean ignoreMeasurementId)
throws UnknownMetadataTypeException;

class UnknownMetadataTypeException extends RuntimeException {

public UnknownMetadataTypeException(String message) {
super(message);
}
}

class MissingSampleIdException extends RuntimeException {
public MissingSampleIdException(String message) {
super(message);
}
}

}
Loading

0 comments on commit d037c4d

Please sign in to comment.