Skip to content

Commit

Permalink
chore(deps): SILO v0.5.0 (#3529)
Browse files Browse the repository at this point in the history
* chore(deps): SILO v0.5.0 (#3529)

* refactor: remove remains of pango_lineage from source code (#3529)
  • Loading branch information
Taepper authored Jan 16, 2025
1 parent f3d3b8b commit 9aa28ab
Show file tree
Hide file tree
Showing 17 changed files with 16 additions and 70 deletions.
3 changes: 0 additions & 3 deletions backend/src/main/kotlin/org/loculus/backend/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ enum class MetadataType {
@JsonProperty("date")
DATE,

@JsonProperty("pango_lineage")
PANGO_LINEAGE,

@JsonProperty("boolean")
BOOLEAN,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import java.time.format.DateTimeFormatter
import java.time.format.DateTimeParseException

private const val DATE_FORMAT = "yyyy-MM-dd"
private const val PANGO_LINEAGE_REGEX_PATTERN = "[a-zA-Z]{1,3}(\\.\\d{1,3}){0,3}"
private val pangoLineageRegex = Regex(PANGO_LINEAGE_REGEX_PATTERN)

interface Symbol {
val symbol: Char
Expand Down Expand Up @@ -100,9 +98,6 @@ private fun <T> validateNoUnknownInMetaData(data: Map<String, T>, known: List<St
}
}

private fun isValidPangoLineage(pangoLineageCandidate: String): Boolean =
pangoLineageCandidate.matches(pangoLineageRegex)

private fun validateKnownMetadataField(metadata: BaseMetadata, processedMetadataMap: MetadataMap): MetadataMap {
val fieldName = metadata.name
val fieldValue = processedMetadataMap[fieldName]
Expand Down Expand Up @@ -141,17 +136,6 @@ private fun validateType(fieldValue: JsonNode, metadata: BaseMetadata) {
return
}

MetadataType.PANGO_LINEAGE -> {
if (!isValidPangoLineage(fieldValue.asText())) {
throw ProcessingValidationException(
"Expected type 'pango_lineage' for field '${metadata.name}', " +
"found value '$fieldValue'. " +
"A pango lineage must be of the form $PANGO_LINEAGE_REGEX_PATTERN, e.g. 'XBB' or 'BA.1.5'.",
)
}
return
}

else -> {}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,6 @@ object PreparedProcessedData {
),
)

fun withWrongPangoLineageFormat(accession: Accession) = defaultSuccessfulSubmittedData.copy(
accession = accession,
data = defaultProcessedData.copy(
metadata = defaultProcessedData.metadata + mapOf(
"pangoLineage" to TextNode("A.5.invalid"),
),
),
)

fun withWrongBooleanFormat(accession: Accession) = defaultSuccessfulSubmittedData.copy(
accession = accession,
data = defaultProcessedData.copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,15 +506,6 @@ class SubmitProcessedDataEndpointTest(
expectedErrorMessage =
"Expected type 'boolean' for field 'booleanColumn', found value '\"not a boolean\"'.",
),
InvalidDataScenario(
name = "data with wrong pango lineage format",
processedDataThatNeedsAValidAccession = PreparedProcessedData.withWrongPangoLineageFormat(
accession = "DoesNotMatter",
),
expectedErrorMessage =
"Expected type 'pango_lineage' for field 'pangoLineage', found value '\"A.5.invalid\"'. " +
"A pango lineage must be of the form [a-zA-Z]{1,3}(\\.\\d{1,3}){0,3}, e.g. 'XBB' or 'BA.1.5'.",
),
InvalidDataScenario(
name = "data with explicit null for required field",
processedDataThatNeedsAValidAccession = PreparedProcessedData.withNullForFields(
Expand Down
4 changes: 2 additions & 2 deletions backend/src/test/resources/backend_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
{
"name": "pangoLineage",
"type": "pango_lineage",
"type": "string",
"autocomplete": true
},
{
Expand Down Expand Up @@ -172,7 +172,7 @@
},
{
"name": "pangoLineage",
"type": "pango_lineage",
"type": "string",
"autocomplete": true
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
{
"name": "pangoLineage",
"type": "pango_lineage",
"type": "string",
"autocomplete": true
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ organisms:
type: string
autocomplete: true
- name: pangoLineage
type: pango_lineage
type: string
autocomplete: true
required: true
- name: insdcAccessionFull
Expand Down
6 changes: 3 additions & 3 deletions kubernetes/loculus/silo_import_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,17 @@ preprocessing() {
cp "$new_input_data_path" "$silo_input_data_path"

set +e
time /app/siloApi --preprocessing --preprocessingConfig=$preprocessing_config_file_merged
time /app/silo preprocessing --preprocessing-config=$preprocessing_config_file_merged
exit_code=$?
set -e

if [ $exit_code -ne 0 ]; then
echo "SiloApi command failed with exit code $exit_code, cleaning up and exiting."
echo "silo command failed with exit code $exit_code, cleaning up and exiting."
delete_all_input # Delete input so that we don't skip preprocessing next time due to hash equality
exit $exit_code
fi

echo "SiloApi command succeeded"
echo "silo command succeeded"
echo "Removing touchfile $new_input_touchfile to indicate successful processing"
rm "$new_input_touchfile"

Expand Down
4 changes: 0 additions & 4 deletions kubernetes/loculus/templates/lapis-silo-database-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ data:

preprocessing_config.yaml: |
ndjsonInputFilename: data.ndjson.zst
pangoLineageDefinitionFilename: pangolineage_alias.json
referenceGenomeFilename: reference_genomes.json
reference_genomes.json: |
Expand All @@ -32,7 +31,4 @@ data:
silo_import_wrapper.sh: |
{{ range $importScriptWrapperLines }}
{{ . }}{{ end }}
pangolineage_alias.json: |
{{ $instance.pangolineage_alias | default dict | toJson }}
{{- end }}
9 changes: 3 additions & 6 deletions kubernetes/loculus/templates/lapis-silo-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
ports:
- containerPort: 8081
args:
- "--api"
- "api"
volumeMounts:
- name: lapis-silo-shared-data
mountPath: /data
Expand Down Expand Up @@ -94,14 +94,11 @@ spec:
mountPath: /preprocessing/input/reference_genomes.json
subPath: reference_genomes.json
- name: lapis-silo-database-config-processed
mountPath: /preprocessing/input/pangolineage_alias.json
subPath: pangolineage_alias.json
mountPath: /preprocessing/input/database_config.yaml
subPath: database_config.yaml
- name: lapis-silo-database-config-processed
mountPath: /app/preprocessing_config.yaml
subPath: preprocessing_config.yaml
- name: lapis-silo-database-config-processed
mountPath: /app/database_config.yaml
subPath: database_config.yaml
- name: lapis-silo-shared-data
mountPath: /preprocessing/output
- name: lapis-silo-input-data-cache
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/loculus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ bannerMessage: "This is a demonstration environment. It may contain non-accurate
welcomeMessageHTML: null
additionalHeadHTML: ""
images:
lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.3.2"
lapisSilo: "ghcr.io/genspectrum/lapis-silo:0.5.0"
lapis: "ghcr.io/genspectrum/lapis:0.3.10"
secrets:
smtp-password:
Expand Down
1 change: 0 additions & 1 deletion preprocessing/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ The `metadata` field should contain a flat object consisting of the fields speci
- `int` (integer)
- `float`
- `date` (supplied as a string with complete ISO-8601 date, e.g., "2023-08-30")
- `pango_lineage` (supplied as a string with a properly formatted SARS-CoV-2 Pango lineage, e.g., "B.1.1.7")
- `authors` (comma separated list of authors, treated as a string in the current prepro pipeline)

#### Sequences
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/SearchPage/SearchForm.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const defaultSearchFormFilters: MetadataFilter[] = [
},
{
name: 'field3',
type: 'pango_lineage',
type: 'string',
label: 'Field 3',
autocomplete: true,
initiallyVisible: true,
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/SearchPage/SearchFullUI.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const defaultSearchFormFilters: MetadataFilter[] = [
},
{
name: 'field3',
type: 'pango_lineage',
type: 'string',
label: 'Field 3',
autocomplete: true,
initiallyVisible: true,
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/SearchPage/fields/FieldProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export type FieldProps = {
onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
fieldValue: string;
type?: 'string' | 'boolean' | 'float' | 'int' | 'pango_lineage' | 'authors';
type?: 'string' | 'boolean' | 'float' | 'int' | 'authors';
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type NormalFieldProps = {
onFocus?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
fieldValue: string | number;
type?: 'string' | 'boolean' | 'float' | 'int' | 'pango_lineage' | 'authors';
type?: 'string' | 'boolean' | 'float' | 'int' | 'authors';
};

export const NormalTextField = forwardRef<HTMLInputElement, NormalFieldProps>((props, ref) => {
Expand Down
11 changes: 1 addition & 10 deletions website/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@ import { mutationProportionCount, orderByType } from './lapis.ts';
import { referenceGenomes } from './referencesGenomes.ts';

// These metadata types need to be kept in sync with the backend config class `MetadataType` in Config.kt
const metadataPossibleTypes = z.enum([
'string',
'date',
'int',
'float',
'pango_lineage',
'timestamp',
'boolean',
'authors',
] as const);
const metadataPossibleTypes = z.enum(['string', 'date', 'int', 'float', 'timestamp', 'boolean', 'authors'] as const);

export const segmentedMutations = z.object({
segment: z.string(),
Expand Down

0 comments on commit 9aa28ab

Please sign in to comment.