From fa85a1f9b7288d21317be65f94c5e4fdf716187d Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Sun, 21 Apr 2024 17:16:30 +0530 Subject: [PATCH 01/10] AREG-129 - fix the applications M2M relation in fields - django admin --- applications/portal/backend/api/admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/portal/backend/api/admin.py b/applications/portal/backend/api/admin.py index a90affaf..5df7922d 100644 --- a/applications/portal/backend/api/admin.py +++ b/applications/portal/backend/api/admin.py @@ -105,7 +105,7 @@ class AntibodyFilesAdmin(admin.TabularInline): "ab_name", "ab_id", "accession", "commercial_type", "catalog_num", "cat_alt", "vendor", "url","ab_target", "entrez_id", "uniprot_id", "target_species_raw", "subregion", "modifications", "epitope", "source_organism", "clonality", "clone_id", "product_isotype", - "product_conjugate", "defining_citation", "product_form", "comments", "applications", + "product_conjugate", "defining_citation", "product_form", "comments", "kit_contents", "feedback", "curator_comment", "disc_date", "status", "show_link", # also in the read-only fields "uid", "uid_legacy", "insert_time", "lastedit_time", "curate_time", @@ -129,7 +129,7 @@ class AntibodyAdmin(ImportExportModelAdmin): # the following - maintains the order of the fields fields = antibody_fields_shown - inlines = [TargetSpeciesInlineAdmin, AntibodyFilesAdmin] + inlines = [TargetSpeciesInlineAdmin, AntibodyFilesAdmin, ApplicationsInlineAdmin] readonly_fields = ( "submitter_name", From ff2397c48ada946a30526378621f2ef32123bc48 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Sun, 21 Apr 2024 17:17:32 +0530 Subject: [PATCH 02/10] AREG-130 add "Under Review" as new status - BE --- ...emove_antibodysearch_citations_and_more.py | 19 +++++++++++++++++++ applications/portal/backend/api/models.py | 1 + .../portal/backend/portal/constants.py | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py diff --git a/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py b/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py new file mode 100644 index 00000000..70f49709 --- /dev/null +++ b/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.9 on 2024-04-21 11:30 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0010_auto_20240315_0451'), + ] + + operations = [ + migrations.AlterField( + model_name='vendor', + name='commercial_type', + field=models.CharField(choices=[('commercial', 'commercial'), ('personal', 'personal'), ('non-profit', 'non-profit'), ('other', 'other')], db_index=True, default='commercial', max_length=32, null=True), + ), + ] diff --git a/applications/portal/backend/api/models.py b/applications/portal/backend/api/models.py index e79a45e8..89f2e21e 100644 --- a/applications/portal/backend/api/models.py +++ b/applications/portal/backend/api/models.py @@ -82,6 +82,7 @@ class STATUS(models.TextChoices): CURATED = 'CURATED', 'Curated' REJECTED = 'REJECTED', 'Rejected' QUEUE = 'QUEUE', 'Queued' + UNDER_REVIEW = 'UNDER_REVIEW', 'Under Review' class Vendor(models.Model): diff --git a/applications/portal/backend/portal/constants.py b/applications/portal/backend/portal/constants.py index 995f2321..595c8440 100644 --- a/applications/portal/backend/portal/constants.py +++ b/applications/portal/backend/portal/constants.py @@ -36,7 +36,7 @@ ANTIBODY_DISC_DATE_MAX_LEN = 128 # 85 ANTIBODY_ID_MAX_LEN = 32 # 8 ANTIBODY_UID_MAX_LEN = 256 -STATUS_MAX_LEN = 8 +STATUS_MAX_LEN = 12 ANTIBODY_CAT_ALT_MAX_LEN = 512 # 334 VENDOR_COMMERCIAL_TYPE_MAX_LEN = 32 # 10 ANTIGEN_UNIPROT_ID_MAX_LEN = 255 # 32 From cc0ad5562c3da46d0af8c2b77d3a8d762f56d6d9 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Mon, 22 Apr 2024 15:47:35 +0530 Subject: [PATCH 03/10] AREG-130 update the migrations for under review --- ...0011_remove_antibodysearch_citations_and_more.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py b/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py index 70f49709..abe5ca5e 100644 --- a/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py +++ b/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.9 on 2024-04-21 11:30 +# Generated by Django 4.2.9 on 2024-04-22 10:15 from django.db import migrations, models import django.db.models.deletion @@ -12,8 +12,13 @@ class Migration(migrations.Migration): operations = [ migrations.AlterField( - model_name='vendor', - name='commercial_type', - field=models.CharField(choices=[('commercial', 'commercial'), ('personal', 'personal'), ('non-profit', 'non-profit'), ('other', 'other')], db_index=True, default='commercial', max_length=32, null=True), + model_name='antibody', + name='status', + field=models.CharField(choices=[('CURATED', 'Curated'), ('REJECTED', 'Rejected'), ('QUEUE', 'Queued'), ('UNDER_REVIEW', 'Under Review')], db_index=True, default='QUEUE', max_length=12), + ), + migrations.AlterField( + model_name='vendordomain', + name='status', + field=models.CharField(choices=[('CURATED', 'Curated'), ('REJECTED', 'Rejected'), ('QUEUE', 'Queued'), ('UNDER_REVIEW', 'Under Review')], db_index=True, default='QUEUE', max_length=12), ), ] From e0daf38003595894f2c466f9882a9c9333c4b125 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Mon, 22 Apr 2024 15:57:05 +0530 Subject: [PATCH 04/10] AREG-130 update openapi spec --- applications/portal/api/openapi.yaml | 5 +++-- applications/portal/backend/openapi/models.py | 5 +++-- applications/portal/frontend/src/rest/api.ts | 18 ++++++++++-------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/applications/portal/api/openapi.yaml b/applications/portal/api/openapi.yaml index bb6c3c78..1fd1e391 100644 --- a/applications/portal/api/openapi.yaml +++ b/applications/portal/api/openapi.yaml @@ -60,7 +60,7 @@ paths: query parameter added as - status=rejected: value: /api/antibodies?page=1&size=100&status=rejected name: status - description: 'Add a status to filter the query - CURATED, REJECTED, QUEUE. ' + description: 'Add a status to filter the query - CURATED, REJECTED, QUEUE, UNDER_REVIEW. ' schema: type: string in: query @@ -438,11 +438,12 @@ components: type: string status: description: | - Can include: curated, rejected, queue + Can include: curated, rejected, queue, under_review enum: - CURATED - REJECTED - QUEUE + - UNDER_REVIEW type: string feedback: description: Feedback to the submitted stored here diff --git a/applications/portal/backend/openapi/models.py b/applications/portal/backend/openapi/models.py index 8c641804..edd1db9a 100644 --- a/applications/portal/backend/openapi/models.py +++ b/applications/portal/backend/openapi/models.py @@ -1,6 +1,6 @@ # generated by fastapi-codegen: # filename: openapi.yaml -# timestamp: 2024-03-08T11:33:31+00:00 +# timestamp: 2024-04-22T10:23:28+00:00 from __future__ import annotations @@ -20,6 +20,7 @@ class Status(Enum): CURATED = 'CURATED' REJECTED = 'REJECTED' QUEUE = 'QUEUE' + UNDER_REVIEW = 'UNDER_REVIEW' class Clonality(Enum): @@ -200,7 +201,7 @@ class Antibody(AbstractAntibody, AntibodyCoreId): description='Thus value is the same as the Antibody identifier for newly added antibodies, different if antibody records have been consolidated or are not unique.\n', ) status: Optional[Status] = Field( - None, description='Can include: curated, rejected, queue\n' + None, description='Can include: curated, rejected, queue, under_review\n' ) feedback: Optional[str] = Field( None, description='Feedback to the submitted stored here' diff --git a/applications/portal/frontend/src/rest/api.ts b/applications/portal/frontend/src/rest/api.ts index d1e317dc..f1a3e54a 100644 --- a/applications/portal/frontend/src/rest/api.ts +++ b/applications/portal/frontend/src/rest/api.ts @@ -357,7 +357,7 @@ export interface Antibody { */ 'accession'?: string; /** - * Can include: curated, rejected, queue + * Can include: curated, rejected, queue, under_review * @type {string} * @memberof Antibody */ @@ -577,7 +577,8 @@ export interface Antibody { export const AntibodyStatusEnum = { Curated: 'CURATED', Rejected: 'REJECTED', - Queue: 'QUEUE' + Queue: 'QUEUE', + UnderReview: 'UNDER_REVIEW' } as const; export type AntibodyStatusEnum = typeof AntibodyStatusEnum[keyof typeof AntibodyStatusEnum]; @@ -621,7 +622,7 @@ export interface AntibodyAllOf { */ 'accession'?: string; /** - * Can include: curated, rejected, queue + * Can include: curated, rejected, queue, under_review * @type {string} * @memberof AntibodyAllOf */ @@ -715,7 +716,8 @@ export interface AntibodyAllOf { export const AntibodyAllOfStatusEnum = { Curated: 'CURATED', Rejected: 'REJECTED', - Queue: 'QUEUE' + Queue: 'QUEUE', + UnderReview: 'UNDER_REVIEW' } as const; export type AntibodyAllOfStatusEnum = typeof AntibodyAllOfStatusEnum[keyof typeof AntibodyAllOfStatusEnum]; @@ -1219,7 +1221,7 @@ export const AntibodyApiAxiosParamCreator = function (configuration?: Configurat * @param {number} [size] Corresponds to the cardinality of antibodies requested * @param {string} [updatedFrom] start date to include. ISO format * @param {string} [updatedTo] end update date to include. ISO format - * @param {string} [status] Add a status to filter the query - CURATED, REJECTED, QUEUE. + * @param {string} [status] Add a status to filter the query - CURATED, REJECTED, QUEUE, UNDER_REVIEW. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1468,7 +1470,7 @@ export const AntibodyApiFp = function(configuration?: Configuration) { * @param {number} [size] Corresponds to the cardinality of antibodies requested * @param {string} [updatedFrom] start date to include. ISO format * @param {string} [updatedTo] end update date to include. ISO format - * @param {string} [status] Add a status to filter the query - CURATED, REJECTED, QUEUE. + * @param {string} [status] Add a status to filter the query - CURATED, REJECTED, QUEUE, UNDER_REVIEW. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1557,7 +1559,7 @@ export const AntibodyApiFactory = function (configuration?: Configuration, baseP * @param {number} [size] Corresponds to the cardinality of antibodies requested * @param {string} [updatedFrom] start date to include. ISO format * @param {string} [updatedTo] end update date to include. ISO format - * @param {string} [status] Add a status to filter the query - CURATED, REJECTED, QUEUE. + * @param {string} [status] Add a status to filter the query - CURATED, REJECTED, QUEUE, UNDER_REVIEW. * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -1645,7 +1647,7 @@ export class AntibodyApi extends BaseAPI { * @param {number} [size] Corresponds to the cardinality of antibodies requested * @param {string} [updatedFrom] start date to include. ISO format * @param {string} [updatedTo] end update date to include. ISO format - * @param {string} [status] Add a status to filter the query - CURATED, REJECTED, QUEUE. + * @param {string} [status] Add a status to filter the query - CURATED, REJECTED, QUEUE, UNDER_REVIEW. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AntibodyApi From aec76c008e5a45a2e11e703e099956234cc63a37 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Mon, 22 Apr 2024 17:52:23 +0530 Subject: [PATCH 05/10] AREG-131 - default to COMMERCIAL for vendor's commerial_type --- ...0011_remove_antibodysearch_citations_and_more.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py b/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py index abe5ca5e..70f49709 100644 --- a/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py +++ b/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.9 on 2024-04-22 10:15 +# Generated by Django 4.2.9 on 2024-04-21 11:30 from django.db import migrations, models import django.db.models.deletion @@ -12,13 +12,8 @@ class Migration(migrations.Migration): operations = [ migrations.AlterField( - model_name='antibody', - name='status', - field=models.CharField(choices=[('CURATED', 'Curated'), ('REJECTED', 'Rejected'), ('QUEUE', 'Queued'), ('UNDER_REVIEW', 'Under Review')], db_index=True, default='QUEUE', max_length=12), - ), - migrations.AlterField( - model_name='vendordomain', - name='status', - field=models.CharField(choices=[('CURATED', 'Curated'), ('REJECTED', 'Rejected'), ('QUEUE', 'Queued'), ('UNDER_REVIEW', 'Under Review')], db_index=True, default='QUEUE', max_length=12), + model_name='vendor', + name='commercial_type', + field=models.CharField(choices=[('commercial', 'commercial'), ('personal', 'personal'), ('non-profit', 'non-profit'), ('other', 'other')], db_index=True, default='commercial', max_length=32, null=True), ), ] From f48102dfb81cfd7b05fc359963a9d4966b32a766 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Mon, 22 Apr 2024 17:53:15 +0530 Subject: [PATCH 06/10] AREG-130 migration for under_review --- ...emove_antibodysearch_citations_and_more.py | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 applications/portal/backend/api/migrations/0012_remove_antibodysearch_citations_and_more.py diff --git a/applications/portal/backend/api/migrations/0012_remove_antibodysearch_citations_and_more.py b/applications/portal/backend/api/migrations/0012_remove_antibodysearch_citations_and_more.py new file mode 100644 index 00000000..b40920ec --- /dev/null +++ b/applications/portal/backend/api/migrations/0012_remove_antibodysearch_citations_and_more.py @@ -0,0 +1,91 @@ +# Generated by Django 4.2.9 on 2024-04-22 10:15 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0011_remove_antibodysearch_citations_and_more'), + ] + + operations = [ + # First need to drop the MATERIALIZED VIEW antibody_search; + migrations.RunSQL( + sql=""" + DROP MATERIALIZED VIEW IF EXISTS antibody_search; + """, + reverse_sql = """ + DROP MATERIALIZED VIEW antibody_search; + """ + ), + migrations.AlterField( + model_name='antibody', + name='status', + field=models.CharField(choices=[('CURATED', 'Curated'), ('REJECTED', 'Rejected'), ('QUEUE', 'Queued'), ('UNDER_REVIEW', 'Under Review')], db_index=True, default='QUEUE', max_length=12), + ), + migrations.AlterField( + model_name='vendordomain', + name='status', + field=models.CharField(choices=[('CURATED', 'Curated'), ('REJECTED', 'Rejected'), ('QUEUE', 'Queued'), ('UNDER_REVIEW', 'Under Review')], db_index=True, default='QUEUE', max_length=12), + ), + # CREATE THE MATERIALIZED VIEW AGAIN - antibody_search; + migrations.RunSQL( + sql=""" + DROP MATERIALIZED VIEW IF EXISTS antibody_search; + CREATE MATERIALIZED VIEW antibody_search AS + SELECT ix, + ( + setweight(to_tsvector('english'::regconfig, ((( + COALESCE(ab_name, ''::text) || ' '::text) || + COALESCE(clone_id, ''::text) || ' '::text)) + ), 'A'::"char") || + + setweight(to_tsvector('english'::regconfig, ((((((((((((((((((((((((( + COALESCE(api_vendor.vendor, ''::text) || ' '::text) || + COALESCE(api_specie.name, ''::text) || ' '::text) || + COALESCE(target_subregion, ''::text) || ' '::text) || + COALESCE(clonality, ''::text)) || ' '::text) || + COALESCE(target_modification, ''::text)) || ' '::text) || + COALESCE(epitope, ''::character varying)::text) || ' '::text) || + COALESCE(product_isotype, ''::character varying)::text) || ' '::text) || + COALESCE(ab_target, ''::character varying)::text) || ' '::text) || + COALESCE(ab_target_entrez_gid, ''::character varying)::text) || ' '::text) || + COALESCE(uniprot_id, ''::character varying)::text) || ' '::text) || + COALESCE(product_isotype, ''::character varying)::text) || ' '::text) || + COALESCE(product_conjugate, ''::text) || + COALESCE(product_form, ''::character varying)::text) || ' '::text) || + COALESCE(target_species_raw, ''::character varying)::text) || ' '::text) || + COALESCE(kit_contents, ''::character varying)::text) || ' '::text)), 'C'::"char") || + setweight(to_tsvector('english'::regconfig, ((( + COALESCE(comments, ''::text) || ' '::text) || + COALESCE(curator_comment, ''::text) || ' '::text)) + ), 'D'::"char") + + ) AS search_vector, + defining_citation, + disc_date, + status + FROM api_antibody + LEFT JOIN api_vendor ON api_vendor.id = api_antibody.vendor_id + LEFT JOIN api_specie ON api_specie.id = api_antibody.source_organism_id + """, + reverse_sql = ''' + DROP MATERIALIZED VIEW antibody_search; + ''' + ), + migrations.RunSQL( + sql="""CREATE UNIQUE INDEX IF NOT EXISTS antibody_search_idx + ON antibody_search + (ix); + """, + ), + migrations.AddIndex( + model_name="antibodysearch", + index=django.contrib.postgres.indexes.GinIndex( + fields=["search_vector"], name="antibody_search_fts_idx" + ), + ) + ] + From 94771618c29a19f1eff32186305323bdaf894e35 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Mon, 22 Apr 2024 17:53:43 +0530 Subject: [PATCH 07/10] AREG-130 FE changes for antibody table to include under_review --- .../portal/frontend/src/components/Home/AntibodiesTable.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/portal/frontend/src/components/Home/AntibodiesTable.tsx b/applications/portal/frontend/src/components/Home/AntibodiesTable.tsx index b88b9232..fefcb662 100644 --- a/applications/portal/frontend/src/components/Home/AntibodiesTable.tsx +++ b/applications/portal/frontend/src/components/Home/AntibodiesTable.tsx @@ -262,6 +262,7 @@ const RenderStatus = (props: GridRenderCellParams) => { CURATED: ["Accepted", "success"], REJECTED: ["Rejected", "error"], QUEUE: ["In Queue", "warning"], + UNDER_REVIEW: ["Under Review", "warning"], }; return ( @@ -564,7 +565,7 @@ const AntibodiesTable = (props) => { headerName: "Status", hide: props.activeTab === ALLRESULTS, renderCell: RenderStatus, - flex: 1.3, + flex: 1.4, filterable: false, sortable: false, }, From 8f968d72f1a56ad6adf9a02c39b5fa0af18eefee Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Mon, 22 Apr 2024 19:18:56 +0530 Subject: [PATCH 08/10] AREG-130 sync openapi spec with apicurio --- applications/portal/api/openapi.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/applications/portal/api/openapi.yaml b/applications/portal/api/openapi.yaml index 1fd1e391..7f719e5d 100644 --- a/applications/portal/api/openapi.yaml +++ b/applications/portal/api/openapi.yaml @@ -437,8 +437,7 @@ components: different if antibody records have been consolidated or are not unique. type: string status: - description: | - Can include: curated, rejected, queue, under_review + description: 'Can include: curated, rejected, queue, under_review' enum: - CURATED - REJECTED From 20d07bd3d356daef893f883ef0e998287af68881 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Tue, 23 Apr 2024 15:25:47 +0530 Subject: [PATCH 09/10] AREG-130 rename migration files --- ...tations_and_more.py => 0011_alter_commercial_type_vendor.py} | 0 ...more.py => 0012_alter_status_field_antibody_vendordomain.py} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename applications/portal/backend/api/migrations/{0011_remove_antibodysearch_citations_and_more.py => 0011_alter_commercial_type_vendor.py} (100%) rename applications/portal/backend/api/migrations/{0012_remove_antibodysearch_citations_and_more.py => 0012_alter_status_field_antibody_vendordomain.py} (98%) diff --git a/applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py b/applications/portal/backend/api/migrations/0011_alter_commercial_type_vendor.py similarity index 100% rename from applications/portal/backend/api/migrations/0011_remove_antibodysearch_citations_and_more.py rename to applications/portal/backend/api/migrations/0011_alter_commercial_type_vendor.py diff --git a/applications/portal/backend/api/migrations/0012_remove_antibodysearch_citations_and_more.py b/applications/portal/backend/api/migrations/0012_alter_status_field_antibody_vendordomain.py similarity index 98% rename from applications/portal/backend/api/migrations/0012_remove_antibodysearch_citations_and_more.py rename to applications/portal/backend/api/migrations/0012_alter_status_field_antibody_vendordomain.py index b40920ec..a014d8e4 100644 --- a/applications/portal/backend/api/migrations/0012_remove_antibodysearch_citations_and_more.py +++ b/applications/portal/backend/api/migrations/0012_alter_status_field_antibody_vendordomain.py @@ -7,7 +7,7 @@ class Migration(migrations.Migration): dependencies = [ - ('api', '0011_remove_antibodysearch_citations_and_more'), + ('api', '0011_alter_commercial_type_vendor'), ] operations = [ From a5305a765565816bbcaf3cbaf5f00a9ecdfe3101 Mon Sep 17 00:00:00 2001 From: "D. Gopal Krishna" Date: Wed, 24 Apr 2024 15:20:56 +0530 Subject: [PATCH 10/10] AREG-130 fix and cast to integer - defining_citation and disc --- .../0012_alter_status_field_antibody_vendordomain.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/applications/portal/backend/api/migrations/0012_alter_status_field_antibody_vendordomain.py b/applications/portal/backend/api/migrations/0012_alter_status_field_antibody_vendordomain.py index a014d8e4..167253b1 100644 --- a/applications/portal/backend/api/migrations/0012_alter_status_field_antibody_vendordomain.py +++ b/applications/portal/backend/api/migrations/0012_alter_status_field_antibody_vendordomain.py @@ -64,8 +64,14 @@ class Migration(migrations.Migration): ), 'D'::"char") ) AS search_vector, - defining_citation, - disc_date, + CASE + WHEN api_antibody.defining_citation ~ '^[0-9,]+$' THEN CAST(SPLIT_PART(api_antibody.defining_citation, ',', 1) AS INTEGER) + ELSE 10000000 + END as defining_citation, + CASE + WHEN disc_date IS NOT NULL THEN 1 + ELSE 0 + END AS disc, status FROM api_antibody LEFT JOIN api_vendor ON api_vendor.id = api_antibody.vendor_id @@ -87,5 +93,5 @@ class Migration(migrations.Migration): fields=["search_vector"], name="antibody_search_fts_idx" ), ) - ] +]