From c77a61c4b9f6e2d6bbf34d4f361de2047d53f476 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Tue, 3 Sep 2024 15:11:06 -0400 Subject: [PATCH 01/47] Add migration for geo fields --- .../migrations/0005_schema_config_update.py | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 specifyweb/specify/migrations/0005_schema_config_update.py diff --git a/specifyweb/specify/migrations/0005_schema_config_update.py b/specifyweb/specify/migrations/0005_schema_config_update.py new file mode 100644 index 00000000000..ac31d54598d --- /dev/null +++ b/specifyweb/specify/migrations/0005_schema_config_update.py @@ -0,0 +1,110 @@ +""" +This migration updates the Schema Config entries for pre-geo tables. +Geo migration added new fields to already existing tables. This migration updates the Schema Config to reflect those changes. + +Fields added: +Collection -> collectionObjectType +GeographyTreeDef -> discipline +GeologicTimePeriodTreeDef -> discipline +LithostratTreeDef -> discipline +StorageTreeDef -> institution +TaxonTreeDef -> discipline +""" +from django.db import migrations + +FIELD_DATA = [ + { + "table": "Collection", + "field": "collectionObjectType", + "isrequired": False, + }, + { + "table": "GeographyTreeDef", + "field": "discipline", + "isrequired": True, + }, + { + "table": "GeologicTimePeriodTreeDef", + "field": "discipline", + "isrequired": True, + }, + { + "table": "LithostratTreeDef", + "field": "discipline", + "isrequired": True, + }, + { + "table": "StorageTreeDef", + "field": "institution", + "isrequired": True, + }, + { + "table": "TaxonTreeDef", + "field": "discipline", + "isrequired": True, + }, +] + + +def add_fields(apps): + Splocalecontainer = apps.get_model('specify', 'Splocalecontainer') + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') + + for data in FIELD_DATA: + for container in Splocalecontainer.objects.filter(name=data['table'], schematype=0): + container_item, _ = Splocalecontaineritem.objects.get_or_create( + name=data["field"], + type='ManyToOne', + container=container, + isrequired=data["isrequired"] + ) + Splocaleitemstr.objects.get_or_create( + language='en', + text=data["field"], + itemname=container_item + ) + Splocaleitemstr.objects.get_or_create( + language='en', + text=data["field"], + itemdesc=container_item + ) + +def remove_fields(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') + + for data in FIELD_DATA: + Splocaleitemstr.objects.filter( + text=data["field"].title(), + itemname__name=data["field"], + itemname__container__name=data["table"], + itemname__container__schematype=0 + ).delete() + Splocaleitemstr.objects.filter( + text=data["field"], + itemdesc__name=data["field"], + itemdesc__container__name=data["table"], + itemdesc__container__schematype=0 + ).delete() + Splocalecontaineritem.objects.filter( + name=data["field"], + container__name=data["table"], + container__schematype=0, + ).delete() + + +class Migration(migrations.Migration): + dependencies = [ + ('specify', '0004_cogtype_picklist'), + ] + + def apply_migration(apps, schema_editor): + add_fields(apps) + + def revert_migration(apps, schema_editor): + remove_fields(apps) + + operations = [ + migrations.RunPython(apply_migration, revert_migration, atomic=True) + ] \ No newline at end of file From 942b8a4dab402b998943326827e6e16ff49151c7 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Tue, 3 Sep 2024 15:11:16 -0400 Subject: [PATCH 02/47] Update Schema Config README --- .../js_src/lib/components/SchemaConfig/README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/SchemaConfig/README.md b/specifyweb/frontend/js_src/lib/components/SchemaConfig/README.md index 4c2bc03d7d7..bb1c97adc8a 100644 --- a/specifyweb/frontend/js_src/lib/components/SchemaConfig/README.md +++ b/specifyweb/frontend/js_src/lib/components/SchemaConfig/README.md @@ -5,11 +5,14 @@ fields and formatters/aggregators. Tables used: -- SpLocaleContainer -- SpLocaleContainerItem -- SpLocaleItemStr +- SpLocaleContainer: Refers to each table in Schema Config. Each Specify table has one `SpLocaleContainer` record for each discipline. +- SpLocaleContainerItem: Contains the entries (fields/relations) for tables in Schema Config. +- SpLocaleItemStr: Contains the name and description strings for each `SpLocaleContainerItem`. Also, the PickList tables: -- PickList -- PickListItem +- PickList: Defines a picklist in the database. Picklists can be one of 3 types: + - `type=0`: Refers to user-defined picklists. i.e: picklists containing explicitly specified values. + - `type=1`: Picklists that are related to a table. The values of the picklist are based on a specified formatter. e.g: CollectionObject > CollectionObjectType. + - `type=2`: Picklists that generates its values from a field in a given table. Essentially works as a user-defined picklist, but with autogenerated values. +- PickListItem: Contains the values for user-defined picklists. Only used for `type 1` picklists. From 7ff19825e51bf9f4c2c5386491f7a530b99aae2b Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:42:58 -0700 Subject: [PATCH 03/47] Add COG picklist migration --- .../lib/components/PickLists/definitions.ts | 18 +++ .../components/Toolbar/QueryTablesEdit.tsx | 1 - specifyweb/specify/migrations/0002_geo.py | 4 +- .../migrations/0005_schema_config_update.py | 110 ------------------ 4 files changed, 19 insertions(+), 114 deletions(-) delete mode 100644 specifyweb/specify/migrations/0005_schema_config_update.py diff --git a/specifyweb/frontend/js_src/lib/components/PickLists/definitions.ts b/specifyweb/frontend/js_src/lib/components/PickLists/definitions.ts index 49f808b47a2..23597013e73 100644 --- a/specifyweb/frontend/js_src/lib/components/PickLists/definitions.ts +++ b/specifyweb/frontend/js_src/lib/components/PickLists/definitions.ts @@ -60,6 +60,12 @@ export const userTypes = [ 'Guest', ] as const; +export const collectionObjectGroupTypeTypes = [ + 'Discrete', + 'Consolidated', + 'Drill Core', +] as const; + export const PickListTypes = { // Items are defined in the PickListItems table ITEMS: 0, @@ -210,6 +216,18 @@ export const getFrontEndPickLists = f.store<{ .set('tableName', 'collectionobjecttype') .set('fieldName', 'name'), }, + CollectionObjectGroupType: { + name: definePicklist('_CollectionObjectGroupType', []) + .set('type', PickListTypes.FIELDS) + .set('tableName', 'collectionobjectgrouptype') + .set('fieldName', 'name'), + type: definePicklist( + '_CollectionObjectGroupTypeType', + collectionObjectGroupTypeTypes.map((title) => + createPickListItem(title, title) + ) + ), + }, CollectionRelType: { name: definePicklist('_CollectionRelType', []) .set('type', PickListTypes.FIELDS) diff --git a/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesEdit.tsx b/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesEdit.tsx index 613975104d3..9618bde2d10 100644 --- a/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesEdit.tsx +++ b/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesEdit.tsx @@ -45,7 +45,6 @@ export const HIDDEN_GEO_TABLES = new Set([ 'CollectionObjectType', 'CollectionObjectGroup', 'CollectionObjectGroupJoin', - 'CollectionObjectGroupType', ]); export function TablesListEdit({ isNoRestrictionMode, diff --git a/specifyweb/specify/migrations/0002_geo.py b/specifyweb/specify/migrations/0002_geo.py index fa78a5a8195..99a8940f68f 100644 --- a/specifyweb/specify/migrations/0002_geo.py +++ b/specifyweb/specify/migrations/0002_geo.py @@ -123,9 +123,8 @@ def create_default_collection_object_types(): for collection in Collection.objects.all(): cog_type_picklist = Picklist.objects.create( name='Default Collection Object Group Types', - tablename='Collectionobjectgrouptype', issystem=False, - type=1, + type=0, readonly=False, collection=collection ) @@ -140,7 +139,6 @@ def revert_default_collection_object_types(): for collection in Collection.objects.all(): cog_type_picklist_qs = Picklist.objects.filter( name='Default Collection Object Group Types', - tablename='Collectionobjectgrouptype', collection=collection ) if cog_type_picklist_qs.exists(): diff --git a/specifyweb/specify/migrations/0005_schema_config_update.py b/specifyweb/specify/migrations/0005_schema_config_update.py deleted file mode 100644 index ac31d54598d..00000000000 --- a/specifyweb/specify/migrations/0005_schema_config_update.py +++ /dev/null @@ -1,110 +0,0 @@ -""" -This migration updates the Schema Config entries for pre-geo tables. -Geo migration added new fields to already existing tables. This migration updates the Schema Config to reflect those changes. - -Fields added: -Collection -> collectionObjectType -GeographyTreeDef -> discipline -GeologicTimePeriodTreeDef -> discipline -LithostratTreeDef -> discipline -StorageTreeDef -> institution -TaxonTreeDef -> discipline -""" -from django.db import migrations - -FIELD_DATA = [ - { - "table": "Collection", - "field": "collectionObjectType", - "isrequired": False, - }, - { - "table": "GeographyTreeDef", - "field": "discipline", - "isrequired": True, - }, - { - "table": "GeologicTimePeriodTreeDef", - "field": "discipline", - "isrequired": True, - }, - { - "table": "LithostratTreeDef", - "field": "discipline", - "isrequired": True, - }, - { - "table": "StorageTreeDef", - "field": "institution", - "isrequired": True, - }, - { - "table": "TaxonTreeDef", - "field": "discipline", - "isrequired": True, - }, -] - - -def add_fields(apps): - Splocalecontainer = apps.get_model('specify', 'Splocalecontainer') - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') - - for data in FIELD_DATA: - for container in Splocalecontainer.objects.filter(name=data['table'], schematype=0): - container_item, _ = Splocalecontaineritem.objects.get_or_create( - name=data["field"], - type='ManyToOne', - container=container, - isrequired=data["isrequired"] - ) - Splocaleitemstr.objects.get_or_create( - language='en', - text=data["field"], - itemname=container_item - ) - Splocaleitemstr.objects.get_or_create( - language='en', - text=data["field"], - itemdesc=container_item - ) - -def remove_fields(apps): - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') - - for data in FIELD_DATA: - Splocaleitemstr.objects.filter( - text=data["field"].title(), - itemname__name=data["field"], - itemname__container__name=data["table"], - itemname__container__schematype=0 - ).delete() - Splocaleitemstr.objects.filter( - text=data["field"], - itemdesc__name=data["field"], - itemdesc__container__name=data["table"], - itemdesc__container__schematype=0 - ).delete() - Splocalecontaineritem.objects.filter( - name=data["field"], - container__name=data["table"], - container__schematype=0, - ).delete() - - -class Migration(migrations.Migration): - dependencies = [ - ('specify', '0004_cogtype_picklist'), - ] - - def apply_migration(apps, schema_editor): - add_fields(apps) - - def revert_migration(apps, schema_editor): - remove_fields(apps) - - operations = [ - migrations.RunPython(apply_migration, revert_migration, atomic=True) - ] \ No newline at end of file From c20eeb2f1d3d9447e8d02bccce5eaa9741e59a4d Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:43:44 -0700 Subject: [PATCH 04/47] Add missing file --- .../migrations/0004_schema_config_update.py | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 specifyweb/specify/migrations/0004_schema_config_update.py diff --git a/specifyweb/specify/migrations/0004_schema_config_update.py b/specifyweb/specify/migrations/0004_schema_config_update.py new file mode 100644 index 00000000000..0c7f24d539f --- /dev/null +++ b/specifyweb/specify/migrations/0004_schema_config_update.py @@ -0,0 +1,177 @@ +""" +This migration updates the Schema Config entries for pre-geo tables. +Geo migration added new fields to already existing tables. This migration updates the Schema Config to reflect those changes. + +Fields added: +Collection -> collectionObjectType +GeographyTreeDef -> discipline +GeologicTimePeriodTreeDef -> discipline +LithostratTreeDef -> discipline +StorageTreeDef -> institution +TaxonTreeDef -> discipline +""" +from django.db import migrations + +FIELD_DATA = [ + { + "table": "Collection", + "field": "collectionObjectType", + "isrequired": False, + }, + { + "table": "GeographyTreeDef", + "field": "discipline", + "isrequired": True, + }, + { + "table": "GeologicTimePeriodTreeDef", + "field": "discipline", + "isrequired": True, + }, + { + "table": "LithostratTreeDef", + "field": "discipline", + "isrequired": True, + }, + { + "table": "StorageTreeDef", + "field": "institution", + "isrequired": True, + }, + { + "table": "TaxonTreeDef", + "field": "discipline", + "isrequired": True, + }, +] + +PICKLIST_NAME = 'CollectionObjectGroupType' +COGTYPE_FIELD_NAME = 'cogType' +PICKLIST_TEXT = 'Collection Object Group Type' + +def add_fields(apps): + Splocalecontainer = apps.get_model('specify', 'Splocalecontainer') + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') + + for data in FIELD_DATA: + for container in Splocalecontainer.objects.filter(name=data['table'], schematype=0): + container_item, _ = Splocalecontaineritem.objects.get_or_create( + name=data["field"], + type='ManyToOne', + container=container, + isrequired=data["isrequired"] + ) + Splocaleitemstr.objects.get_or_create( + language='en', + text=data["field"], + itemname=container_item + ) + Splocaleitemstr.objects.get_or_create( + language='en', + text=data["field"], + itemdesc=container_item + ) + +def remove_fields(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') + + for data in FIELD_DATA: + Splocaleitemstr.objects.filter( + text=data["field"].title(), + itemname__name=data["field"], + itemname__container__name=data["table"], + itemname__container__schematype=0 + ).delete() + Splocaleitemstr.objects.filter( + text=data["field"], + itemdesc__name=data["field"], + itemdesc__container__name=data["table"], + itemdesc__container__schematype=0 + ).delete() + Splocalecontaineritem.objects.filter( + name=data["field"], + container__name=data["table"], + container__schematype=0, + ).delete() + +def create_cogtype_picklist(apps): + Collection = apps.get_model('specify', 'Collection') + Picklist = apps.get_model('specify', 'Picklist') + + # Create a cogtype picklist for each collection + for collection in Collection.objects.all(): + Picklist.objects.get_or_create( + name=PICKLIST_NAME, + issystem=True, + readonly=True, + sizelimit=-1, + sorttype=1, + type=1, + tablename='collectionobjectgrouptype', + collection=collection, + formatter=PICKLIST_NAME + ) + +def revert_cogtype_picklist(apps): + Picklist = apps.get_model('specify', 'Picklist') + + Picklist.objects.filter(name=PICKLIST_NAME).delete() + +# Updates COG -> cogtype to use the type 1 picklist created above +def update_cogtype_splocalecontaineritem(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + + Splocalecontaineritem.objects.filter(container__name='collectionobjectgroup', container__schematype=0, name=COGTYPE_FIELD_NAME).update( + picklistname=PICKLIST_NAME, + type='ManyToOne', + isrequired=True + ) + +def revert_cogtype_splocalecontaineritem(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + + Splocalecontaineritem.objects.filter(container__name='collectionobjectgroup', container__schematype=0, name=COGTYPE_FIELD_NAME).update( + picklistname=None, + type=None, + isrequired=None + ) + +# Updates cogtype -> type to use the Default COGType picklist (Drill Core, Discrete, Consolidated) +def update_cogtype_type_splocalecontaineritem(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + + Splocalecontaineritem.objects.filter(container__name='collectionobjectgrouptype', container__schematype=0, name='type').update( + picklistname='Default Collection Object Group Types', + isrequired=True + ) + +def revert_cogtype_type_splocalecontaineritem(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + + Splocalecontaineritem.objects.filter(container__name='collectionobjectgrouptype', container__schematype=0, name='type').update( + picklistname=None, + isrequired=None + ) + +class Migration(migrations.Migration): + dependencies = [ + ('specify', '0003_cotype_picklist'), + ] + + def apply_migration(apps, schema_editor): + add_fields(apps) + create_cogtype_picklist(apps) + update_cogtype_splocalecontaineritem(apps) + update_cogtype_type_splocalecontaineritem(apps) + + def revert_migration(apps, schema_editor): + remove_fields(apps) + revert_cogtype_picklist(apps) + revert_cogtype_splocalecontaineritem(apps) + revert_cogtype_type_splocalecontaineritem(apps) + + operations = [ + migrations.RunPython(apply_migration, revert_migration, atomic=True) + ] \ No newline at end of file From 87db68602af5ca97254c4cad60d07e6bb3f03131 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Mon, 30 Sep 2024 14:56:25 -0400 Subject: [PATCH 05/47] Use correct picklist in cogtype business rule --- specifyweb/businessrules/rules/cogtype_rules.py | 1 - 1 file changed, 1 deletion(-) diff --git a/specifyweb/businessrules/rules/cogtype_rules.py b/specifyweb/businessrules/rules/cogtype_rules.py index 028e0603e81..eec347d23ea 100644 --- a/specifyweb/businessrules/rules/cogtype_rules.py +++ b/specifyweb/businessrules/rules/cogtype_rules.py @@ -10,7 +10,6 @@ def cogtype_pre_save(cog_type): # NOTE: Maybe add constraint on the cog_type name in the future. default_cog_types_picklist = Picklist.objects.get( name="Default Collection Object Group Types", - tablename="collectionobjectgrouptype", collection=cog_type.collection ) if Picklistitem.objects.filter(picklist=default_cog_types_picklist, value=cog_type.type).count() == 0: From bee072c383b85784f6e05d480554915e60d7b4c8 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Fri, 4 Oct 2024 11:41:45 -0400 Subject: [PATCH 06/47] Update discipline relations and change dependency --- .../js_src/lib/components/DataModel/types.ts | 221 +++++++++--------- specifyweb/specify/datamodel.py | 4 +- ...update.py => 0005_schema_config_update.py} | 8 +- 3 files changed, 119 insertions(+), 114 deletions(-) rename specifyweb/specify/migrations/{0004_schema_config_update.py => 0005_schema_config_update.py} (97%) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 31a0a227385..c0533d3377f 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -229,24 +229,33 @@ export type Tables = { readonly CollectionObjectGroup: CollectionObjectGroup; readonly CollectionObjectGroupJoin: CollectionObjectGroupJoin; readonly CollectionObjectGroupType: CollectionObjectGroupType; + readonly AbsoluteAge: AbsoluteAge; + readonly RelativeAge: RelativeAge; + readonly AbsoluteAgeAttachment: AbsoluteAgeAttachment; + readonly RelativeAgeAttachment: RelativeAgeAttachment; + readonly AbsoluteAgeCitation: AbsoluteAgeCitation; + readonly RelativeAgeCitation: RelativeAgeCitation; + readonly TectonicUnitTreeDef: TectonicUnitTreeDef; + readonly TectonicUnitTreeDefItem: TectonicUnitTreeDefItem; + readonly TectonicUnit: TectonicUnit; }; export type Accession = { readonly tableName: 'Accession'; readonly fields: { - readonly accessionNumber: string; readonly accessionCondition: string | null; - readonly dateAccessioned: string | null; + readonly accessionNumber: string; readonly actualTotalCountAmt: number | null; readonly collectionObjectCount: number | null; + readonly dateAccessioned: string | null; readonly dateAcknowledged: string | null; - readonly remarks: string | null; + readonly dateReceived: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; readonly number1: number | null; readonly number2: number | null; readonly preparationCount: number | null; - readonly dateReceived: string | null; + readonly remarks: string | null; readonly status: string | null; readonly text1: string | null; readonly text2: string | null; @@ -452,10 +461,10 @@ export type Agent = { readonly initials: string | null; readonly integer1: number | null; readonly integer2: number | null; + readonly interests: string | null; readonly jobTitle: string | null; readonly lastName: string | null; readonly middleInitial: string | null; - readonly interests: string | null; readonly remarks: string | null; readonly suffix: string | null; readonly text1: string | null; @@ -488,8 +497,8 @@ export type Agent = { readonly agentAttachments: RA; readonly agentGeographies: RA; readonly agentSpecialties: RA; - readonly identifiers: RA; readonly groups: RA; + readonly identifiers: RA; readonly variants: RA; }; readonly toManyIndependent: { @@ -920,13 +929,13 @@ export type BorrowMaterial = { readonly tableName: 'BorrowMaterial'; readonly fields: { readonly collectionMemberId: number; + readonly description: string | null; readonly inComments: string | null; readonly materialNumber: string; readonly outComments: string | null; readonly quantity: number | null; readonly quantityResolved: number | null; readonly quantityReturned: number | null; - readonly description: string | null; readonly text1: string | null; readonly text2: string | null; readonly timestampCreated: string; @@ -968,22 +977,24 @@ export type BorrowReturnMaterial = { export type CollectingEvent = { readonly tableName: 'CollectingEvent'; readonly fields: { - readonly startDate: string | null; + readonly verbatimDate: string | null; + readonly remarks: string | null; readonly endDate: string | null; readonly endDatePrecision: number | null; readonly endDateVerbatim: string | null; readonly endTime: number | null; - readonly stationFieldNumber: string | null; - readonly method: string | null; readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly remarks: string | null; + readonly stationFieldNumber: string | null; + readonly verbatimLocality: string | null; + readonly method: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; readonly reservedText1: string | null; readonly reservedText2: string | null; readonly sgrStatus: number | null; + readonly startDate: string | null; readonly startDatePrecision: number | null; readonly startDateVerbatim: string | null; readonly startTime: number | null; @@ -1001,8 +1012,6 @@ export type CollectingEvent = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; - readonly verbatimDate: string | null; - readonly verbatimLocality: string | null; readonly version: number | null; readonly visibility: number | null; }; @@ -1070,10 +1079,6 @@ export type CollectingEventAttr = { export type CollectingEventAttribute = { readonly tableName: 'CollectingEventAttribute'; readonly fields: { - readonly text8: string | null; - readonly text5: string | null; - readonly text4: string | null; - readonly text9: string | null; readonly integer1: number | null; readonly integer10: number | null; readonly integer2: number | null; @@ -1084,11 +1089,11 @@ export type CollectingEventAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly number12: number | null; - readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number2: number | null; readonly number3: number | null; readonly number4: number | null; @@ -1098,22 +1103,26 @@ export type CollectingEventAttribute = { readonly number8: number | null; readonly number9: number | null; readonly remarks: string | null; - readonly text6: string | null; readonly text1: string | null; readonly text10: string | null; readonly text11: string | null; + readonly text12: string | null; readonly text13: string | null; readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; readonly text2: string | null; + readonly text3: string | null; + readonly text4: string | null; + readonly text5: string | null; + readonly text6: string | null; readonly text7: string | null; + readonly text8: string | null; + readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text12: string | null; readonly version: number | null; - readonly text3: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -1154,7 +1163,6 @@ export type CollectingTrip = { readonly tableName: 'CollectingTrip'; readonly fields: { readonly cruise: string | null; - readonly text2: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly date2: string | null; @@ -1172,6 +1180,8 @@ export type CollectingTrip = { readonly startDatePrecision: number | null; readonly startDateVerbatim: string | null; readonly startTime: number | null; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -1183,7 +1193,6 @@ export type CollectingTrip = { readonly timestampModified: string | null; readonly collectingTripName: string | null; readonly version: number | null; - readonly text1: string | null; readonly vessel: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -1359,16 +1368,19 @@ export type Collection = { export type CollectionObject = { readonly tableName: 'CollectionObject'; readonly fields: { + readonly yesNo1: boolean | null; readonly actualTotalCountAmt: number | null; readonly age: number | null; + readonly altCatalogNumber: string | null; readonly availability: string | null; - readonly catalogNumber: string | null; readonly catalogedDate: string | null; readonly catalogedDatePrecision: number | null; readonly catalogedDateVerbatim: string | null; + readonly catalogNumber: string | null; + readonly remarks: string | null; readonly collectionMemberId: number; readonly countAmt: number | null; - readonly reservedText: string | null; + readonly timestampCreated: string; readonly timestampModified: string | null; readonly date1: string | null; readonly date1Precision: number | null; @@ -1381,9 +1393,10 @@ export type CollectionObject = { readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly text2: string | null; readonly inventoryDate: string | null; readonly inventoryDatePrecision: number | null; + readonly text2: string | null; + readonly fieldNumber: string | null; readonly modifier: string | null; readonly name: string | null; readonly notifications: string | null; @@ -1392,16 +1405,15 @@ export type CollectionObject = { readonly number2: number | null; readonly objectCondition: string | null; readonly ocr: string | null; - readonly altCatalogNumber: string | null; + readonly text1: string | null; readonly projectNumber: string | null; - readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; + readonly reservedText: string | null; readonly reservedText2: string | null; readonly reservedText3: string | null; readonly restrictions: string | null; readonly sgrStatus: number | null; - readonly text1: string | null; readonly description: string | null; readonly text3: string | null; readonly text4: string | null; @@ -1409,14 +1421,11 @@ export type CollectionObject = { readonly text6: string | null; readonly text7: string | null; readonly text8: string | null; - readonly timestampCreated: string; readonly totalCountAmt: number | null; readonly totalValue: number | null; readonly uniqueIdentifier: string | null; readonly version: number | null; readonly visibility: number | null; - readonly fieldNumber: string | null; - readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; @@ -1431,17 +1440,17 @@ export type CollectionObject = { readonly agent1: Agent | null; readonly appraisal: Appraisal | null; readonly cataloger: Agent | null; + readonly collectingEvent: CollectingEvent | null; readonly collection: Collection; readonly collectionObjectType: CollectionObjectType; readonly container: Container | null; readonly containerOwner: Container | null; readonly createdByAgent: Agent | null; readonly currentDetermination: Determination | null; - readonly modifiedByAgent: Agent | null; readonly embargoAuthority: Agent | null; - readonly collectingEvent: CollectingEvent | null; readonly fieldNotebookPage: FieldNotebookPage | null; readonly inventorizedBy: Agent | null; + readonly modifiedByAgent: Agent | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -1524,11 +1533,11 @@ export type CollectionObjectAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly number12: number | null; - readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number14: number | null; readonly number15: number | null; readonly number16: number | null; @@ -1566,19 +1575,20 @@ export type CollectionObjectAttribute = { readonly number7: number | null; readonly number8: number | null; readonly number9: number | null; - readonly text13: string | null; - readonly text14: string | null; - readonly text1: string | null; readonly positionState: string | null; - readonly text10: string | null; readonly remarks: string | null; - readonly text8: string | null; + readonly text1: string | null; + readonly text10: string | null; readonly text11: string | null; + readonly text12: string | null; + readonly text13: string | null; + readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; readonly text18: string | null; readonly text19: string | null; + readonly text2: string | null; readonly text20: string | null; readonly text21: string | null; readonly text22: string | null; @@ -1605,13 +1615,12 @@ export type CollectionObjectAttribute = { readonly text5: string | null; readonly text6: string | null; readonly text7: string | null; + readonly text8: string | null; readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text12: string | null; readonly topDistance: number | null; readonly version: number | null; - readonly text2: string | null; readonly yesNo1: boolean | null; readonly yesNo10: boolean | null; readonly yesNo11: boolean | null; @@ -1649,10 +1658,10 @@ export type CollectionObjectCitation = { readonly fields: { readonly collectionMemberId: number; readonly figureNumber: string | null; + readonly remarks: string | null; readonly isFigured: boolean | null; readonly pageNumber: string | null; readonly plateNumber: string | null; - readonly remarks: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly version: number | null; @@ -2185,9 +2194,7 @@ export type DNASequence = { readonly compT: number | null; readonly extractionDate: string | null; readonly extractionDatePrecision: number | null; - readonly text2: string | null; readonly genbankAccessionNumber: string | null; - readonly text1: string | null; readonly geneSequence: string | null; readonly moleculeType: string | null; readonly number1: number | null; @@ -2197,6 +2204,8 @@ export type DNASequence = { readonly sequenceDate: string | null; readonly sequenceDatePrecision: number | null; readonly targetMarker: string | null; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; @@ -2289,8 +2298,8 @@ export type DNASequencingRun = { readonly runByAgent: Agent | null; }; readonly toManyDependent: { - readonly citations: RA; readonly attachments: RA; + readonly citations: RA; }; readonly toManyIndependent: RR; }; @@ -2452,13 +2461,11 @@ export type Determination = { readonly addendum: string | null; readonly alternateName: string | null; readonly collectionMemberId: number; - readonly confidence: string | null; readonly isCurrent: boolean; readonly determinedDate: string | null; readonly determinedDatePrecision: number | null; readonly featureOrBasis: string | null; readonly guid: string | null; - readonly yesNo1: boolean | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -2471,10 +2478,11 @@ export type Determination = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; + readonly text1: string | null; readonly qualifier: string | null; + readonly confidence: string | null; readonly remarks: string | null; readonly subSpQualifier: string | null; - readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -2487,6 +2495,7 @@ export type Determination = { readonly typeStatusName: string | null; readonly varQualifier: string | null; readonly version: number | null; + readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; @@ -2513,9 +2522,9 @@ export type DeterminationCitation = { readonly collectionMemberId: number; readonly figureNumber: string | null; readonly isFigured: boolean | null; + readonly remarks: string | null; readonly pageNumber: string | null; readonly plateNumber: string | null; - readonly remarks: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly version: number | null; @@ -3082,12 +3091,13 @@ export type FundingAgent = { export type GeoCoordDetail = { readonly tableName: 'GeoCoordDetail'; readonly fields: { + readonly validation: string | null; + readonly source: string | null; readonly errorPolygon: string | null; readonly geoRefAccuracy: number | null; readonly geoRefAccuracyUnits: string | null; readonly geoRefCompiledDate: string | null; readonly geoRefDetDate: string | null; - readonly geoRefDetRef: string | null; readonly geoRefRemarks: string | null; readonly geoRefVerificationStatus: string | null; readonly integer1: number | null; @@ -3106,7 +3116,7 @@ export type GeoCoordDetail = { readonly number5: number | null; readonly originalCoordSystem: string | null; readonly protocol: string | null; - readonly source: string | null; + readonly geoRefDetRef: string | null; readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; @@ -3115,7 +3125,6 @@ export type GeoCoordDetail = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly uncertaintyPolygon: string | null; - readonly validation: string | null; readonly version: number | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -3190,7 +3199,7 @@ export type GeographyTreeDef = { readonly toOneDependent: RR; readonly toOneIndependent: { readonly createdByAgent: Agent | null; - readonly discipline: Discipline; + readonly discipline: Discipline | null; readonly modifiedByAgent: Agent | null; }; readonly toManyDependent: { readonly treeDefItems: RA }; @@ -3278,7 +3287,7 @@ export type GeologicTimePeriodTreeDef = { readonly toOneDependent: RR; readonly toOneIndependent: { readonly createdByAgent: Agent | null; - readonly discipline: Discipline; + readonly discipline: Discipline | null; readonly modifiedByAgent: Agent | null; }; readonly toManyDependent: { @@ -3337,8 +3346,8 @@ export type Gift = { readonly srcTaxonomy: string | null; readonly specialConditions: string | null; readonly status: string | null; - readonly text2: string | null; readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3707,7 +3716,6 @@ export type Loan = { readonly dateClosed: string | null; readonly dateReceived: string | null; readonly yesNo1: boolean | null; - readonly text2: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -3729,6 +3737,7 @@ export type Loan = { readonly specialConditions: string | null; readonly status: string | null; readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3854,22 +3863,26 @@ export type LoanReturnPreparation = { export type Locality = { readonly tableName: 'Locality'; readonly fields: { + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly datum: string | null; readonly elevationAccuracy: number | null; + readonly elevationMethod: string | null; readonly gml: string | null; readonly guid: string | null; readonly latLongMethod: string | null; readonly lat1text: string | null; readonly lat2text: string | null; - readonly latLongAccuracy: number | null; readonly latLongType: string | null; readonly latitude1: number | null; readonly latitude2: number | null; + readonly latLongAccuracy: number | null; readonly localityName: string; readonly long1text: string | null; readonly long2text: string | null; readonly longitude1: number | null; readonly longitude2: number | null; + readonly text1: string | null; readonly maxElevation: number | null; readonly minElevation: number | null; readonly namedPlace: string | null; @@ -3880,20 +3893,16 @@ export type Locality = { readonly sgrStatus: number | null; readonly shortName: string | null; readonly srcLatLongUnit: number; - readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; - readonly timestampCreated: string; - readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; readonly verbatimElevation: string | null; readonly verbatimLatitude: string | null; readonly verbatimLongitude: string | null; readonly version: number | null; readonly visibility: number | null; - readonly elevationMethod: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -3966,7 +3975,6 @@ export type LocalityCitation = { export type LocalityDetail = { readonly tableName: 'LocalityDetail'; readonly fields: { - readonly baseMeridian: string | null; readonly drainage: string | null; readonly endDepth: number | null; readonly endDepthUnit: string | null; @@ -3975,6 +3983,7 @@ export type LocalityDetail = { readonly hucCode: string | null; readonly island: string | null; readonly islandGroup: string | null; + readonly text1: string | null; readonly mgrsZone: string | null; readonly nationalParkName: string | null; readonly number1: number | null; @@ -3991,7 +4000,7 @@ export type LocalityDetail = { readonly startDepth: number | null; readonly startDepthUnit: string | null; readonly startDepthVerbatim: string | null; - readonly text1: string | null; + readonly baseMeridian: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -4168,6 +4177,7 @@ export type PaleoContext = { readonly tableName: 'PaleoContext'; readonly fields: { readonly text1: string | null; + readonly text2: string | null; readonly paleoContextName: string | null; readonly number1: number | null; readonly number2: number | null; @@ -4175,7 +4185,6 @@ export type PaleoContext = { readonly number4: number | null; readonly number5: number | null; readonly remarks: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -4374,6 +4383,7 @@ export type Preparation = { readonly date4Precision: number | null; readonly description: string | null; readonly guid: string | null; + readonly text1: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly isOnLoan: boolean | null; @@ -4391,6 +4401,7 @@ export type Preparation = { readonly text11: string | null; readonly text12: string | null; readonly text13: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -4400,10 +4411,8 @@ export type Preparation = { readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text1: string | null; - readonly yesNo1: boolean | null; readonly version: number | null; - readonly text2: string | null; + readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; }; @@ -4780,10 +4789,7 @@ export type RecordSetItem = { export type ReferenceWork = { readonly tableName: 'ReferenceWork'; readonly fields: { - readonly text1: string | null; - readonly workDate: string | null; readonly doi: string | null; - readonly text2: string | null; readonly guid: string | null; readonly isPublished: boolean | null; readonly isbn: string | null; @@ -4794,6 +4800,8 @@ export type ReferenceWork = { readonly placeOfPublication: string | null; readonly publisher: string | null; readonly remarks: string | null; + readonly text1: string | null; + readonly text2: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly title: string; @@ -4802,6 +4810,7 @@ export type ReferenceWork = { readonly url: string | null; readonly version: number | null; readonly volume: string | null; + readonly workDate: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; }; @@ -4899,9 +4908,9 @@ export type RepositoryAgreementAttachment = { export type Shipment = { readonly tableName: 'Shipment'; readonly fields: { - readonly numberOfPackages: number | null; readonly insuredForAmount: string | null; readonly shipmentMethod: string | null; + readonly numberOfPackages: number | null; readonly number1: number | null; readonly number2: number | null; readonly remarks: string | null; @@ -5615,6 +5624,7 @@ export type Taxon = { readonly colStatus: string | null; readonly commonName: string | null; readonly cultivarName: string | null; + readonly environmentalProtectionStatus: string | null; readonly esaStatus: string | null; readonly fullName: string | null; readonly groupNumber: string | null; @@ -5638,7 +5648,6 @@ export type Taxon = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; - readonly environmentalProtectionStatus: string | null; readonly rankId: number; readonly remarks: string | null; readonly source: string | null; @@ -6463,8 +6472,8 @@ export type CollectionObjectType = { readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; - readonly timestampcreated: string; - readonly timestampmodified: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly version: number | null; }; readonly toOneDependent: RR; @@ -6493,8 +6502,8 @@ export type CollectionObjectGroup = { readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; - readonly timestampcreated: string; - readonly timestampmodified: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly version: number | null; readonly yesno1: boolean | null; readonly yesno2: boolean | null; @@ -6502,14 +6511,14 @@ export type CollectionObjectGroup = { }; readonly toOneDependent: RR; readonly toOneIndependent: { - readonly cogtype: CollectionObjectGroupType; + readonly cogType: CollectionObjectGroupType; readonly collection: Collection | null; readonly createdByAgent: Agent | null; readonly modifiedByAgent: Agent | null; }; readonly toManyDependent: { readonly cojo: RA; - readonly parentcojos: RA; + readonly parentCojos: RA; }; readonly toManyIndependent: RR; }; @@ -6519,14 +6528,14 @@ export type CollectionObjectGroupJoin = { readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; - readonly isprimary: boolean; - readonly issubstrate: boolean; + readonly isPrimary: boolean; + readonly isSubstrate: boolean; readonly precedence: number; readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; - readonly timestampcreated: string; - readonly timestampmodified: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly version: number | null; readonly yesno1: boolean | null; readonly yesno2: boolean | null; @@ -6534,9 +6543,9 @@ export type CollectionObjectGroupJoin = { }; readonly toOneDependent: RR; readonly toOneIndependent: { - readonly childco: CollectionObject | null; - readonly childcog: CollectionObjectGroup | null; - readonly parentcog: CollectionObjectGroup; + readonly childCo: CollectionObject | null; + readonly childCog: CollectionObjectGroup | null; + readonly parentCog: CollectionObjectGroup; }; readonly toManyDependent: RR; readonly toManyIndependent: RR; @@ -6545,8 +6554,8 @@ export type CollectionObjectGroupType = { readonly tableName: 'CollectionObjectGroupType'; readonly fields: { readonly name: string; - readonly timestampcreated: string; - readonly timestampmodified: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly type: string; readonly version: number | null; }; @@ -6575,10 +6584,10 @@ export type AbsoluteAge = { readonly remarks: string | null; readonly text1: string | null; readonly text2: string | null; - readonly yesno1: boolean | null; - readonly yesno2: boolean | null; readonly timestampCreated: string; readonly timestampModified: string | null; + readonly yesno1: boolean | null; + readonly yesno2: boolean | null; }; readonly toOneDependent: RR; readonly toOneIndependent: { @@ -6588,32 +6597,32 @@ export type AbsoluteAge = { readonly modifiedByAgent: Agent | null; }; readonly toManyDependent: { - readonly absoluteAgeAttachments: RA; + readonly absoluteAgeAttachments: RA; }; readonly toManyIndependent: RR; }; export type RelativeAge = { readonly tableName: 'RelativeAge'; readonly fields: { - readonly ageRype: string | null; + readonly ageType: string | null; readonly ageUncertainty: number | null; readonly collectionDate: string | null; readonly date1: string | null; readonly date2: string | null; readonly datingMethod: string | null; readonly datingMethodRemarks: string | null; - readonly relativeAgePeriod: number | null; readonly number1: number | null; readonly number2: number | null; + readonly relativeAgePeriod: number | null; readonly remarks: string | null; readonly text1: string | null; readonly text2: string | null; - readonly yesno1: boolean | null; - readonly yesno2: boolean | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly verbatimName: string | null; readonly verbatimPeriod: string | null; + readonly yesno1: boolean | null; + readonly yesno2: boolean | null; }; readonly toOneDependent: RR; readonly toOneIndependent: { @@ -6626,7 +6635,7 @@ export type RelativeAge = { readonly modifiedByAgent: Agent | null; }; readonly toManyDependent: { - readonly relativeAgeAttachments: RA; + readonly relativeAgeAttachments: RA; }; readonly toManyIndependent: RR; }; @@ -6639,9 +6648,7 @@ export type AbsoluteAgeAttachment = { readonly timestampModified: string | null; readonly version: number | null; }; - readonly toOneDependent: { - readonly attachment: Attachment; - }; + readonly toOneDependent: { readonly attachment: Attachment }; readonly toOneIndependent: { readonly absoluteAge: AbsoluteAge; readonly collectionMember: Collection; @@ -6660,9 +6667,7 @@ export type RelativeAgeAttachment = { readonly timestampModified: string | null; readonly version: number | null; }; - readonly toOneDependent: { - readonly attachment: Attachment; - }; + readonly toOneDependent: { readonly attachment: Attachment }; readonly toOneIndependent: { readonly collectionMember: Collection; readonly createdByAgent: Agent | null; @@ -6731,8 +6736,8 @@ export type TectonicUnitTreeDef = { readonly toOneDependent: RR; readonly toOneIndependent: { readonly createdByAgent: Agent | null; - readonly modifiedByAgent: Agent | null; readonly discipline: Discipline; + readonly modifiedByAgent: Agent | null; }; readonly toManyDependent: RR; readonly toManyIndependent: RR; @@ -6755,7 +6760,7 @@ export type TectonicUnitTreeDefItem = { }; readonly toOneDependent: RR; readonly toOneIndependent: { - readonly createdByAgent: Agent | null; + readonly createdbyagent: Agent | null; readonly modifiedByAgent: Agent | null; readonly parentItem: TectonicUnitTreeDefItem | null; readonly tectonicUnitTreeDef: TectonicUnitTreeDef; @@ -6763,7 +6768,7 @@ export type TectonicUnitTreeDefItem = { readonly toManyDependent: RR; readonly toManyIndependent: { readonly children: RA; - readonly treeEntries: RA; + readonly tectonicUnits: RA; }; }; export type TectonicUnit = { @@ -6792,7 +6797,7 @@ export type TectonicUnit = { readonly acceptedTectonicUnit: TectonicUnit | null; readonly createdByAgent: Agent | null; readonly modifiedByAgent: Agent | null; - readonly parent: TectonicUnit; + readonly parent: TectonicUnit | null; readonly tectonicUnitTreeDef: TectonicUnitTreeDef; readonly tectonicUnitTreeDefItem: TectonicUnitTreeDefItem; }; diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 33ca80b446d..8ac9cbe088f 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -3847,7 +3847,7 @@ ], relationships=[ Relationship(name='createdByAgent', type='many-to-one',required=False, relatedModelName='Agent', column='CreatedByAgentID'), - Relationship(name='discipline', type='many-to-one',required=True, relatedModelName='Discipline', column='DisciplineID', otherSideName='geographyTreeDefs'), + Relationship(name='discipline', type='many-to-one',required=False, relatedModelName='Discipline', column='DisciplineID', otherSideName='geographyTreeDefs'), Relationship(name='modifiedByAgent', type='many-to-one',required=False, relatedModelName='Agent', column='ModifiedByAgentID'), Relationship(name='treeDefItems', type='one-to-many',required=False, relatedModelName='GeographyTreeDefItem', otherSideName='treeDef', dependent=True), Relationship(name='treeEntries', type='one-to-many',required=False, relatedModelName='Geography', otherSideName='definition') @@ -3963,7 +3963,7 @@ ], relationships=[ Relationship(name='createdByAgent', type='many-to-one',required=False, relatedModelName='Agent', column='CreatedByAgentID'), - Relationship(name='discipline', type='many-to-one',required=True, relatedModelName='Discipline', column='DisciplineID', otherSideName='geologicTimePeriodTreeDefs'), + Relationship(name='discipline', type='many-to-one',required=False, relatedModelName='Discipline', column='DisciplineID', otherSideName='geologicTimePeriodTreeDefs'), Relationship(name='modifiedByAgent', type='many-to-one',required=False, relatedModelName='Agent', column='ModifiedByAgentID'), Relationship(name='treeDefItems', type='one-to-many',required=False, relatedModelName='GeologicTimePeriodTreeDefItem', otherSideName='treeDef', dependent=True), Relationship(name='treeEntries', type='one-to-many',required=False, relatedModelName='GeologicTimePeriod', otherSideName='definition') diff --git a/specifyweb/specify/migrations/0004_schema_config_update.py b/specifyweb/specify/migrations/0005_schema_config_update.py similarity index 97% rename from specifyweb/specify/migrations/0004_schema_config_update.py rename to specifyweb/specify/migrations/0005_schema_config_update.py index 0c7f24d539f..9eb0d09146b 100644 --- a/specifyweb/specify/migrations/0004_schema_config_update.py +++ b/specifyweb/specify/migrations/0005_schema_config_update.py @@ -21,12 +21,12 @@ { "table": "GeographyTreeDef", "field": "discipline", - "isrequired": True, + "isrequired": False, }, { "table": "GeologicTimePeriodTreeDef", "field": "discipline", - "isrequired": True, + "isrequired": False, }, { "table": "LithostratTreeDef", @@ -79,7 +79,7 @@ def remove_fields(apps): for data in FIELD_DATA: Splocaleitemstr.objects.filter( - text=data["field"].title(), + text=data["field"], itemname__name=data["field"], itemname__container__name=data["table"], itemname__container__schematype=0 @@ -157,7 +157,7 @@ def revert_cogtype_type_splocalecontaineritem(apps): class Migration(migrations.Migration): dependencies = [ - ('specify', '0003_cotype_picklist'), + ('specify', '0004_stratigraphy_age'), ] def apply_migration(apps, schema_editor): From e7f82b4761f74e50367f904609458d27505ac890 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Fri, 4 Oct 2024 12:56:18 -0400 Subject: [PATCH 07/47] Update cogtype -> type picklist --- .../businessrules/rules/cogtype_rules.py | 4 ++- .../migrations/0005_schema_config_update.py | 35 +++++++++++++++---- specifyweb/specify/tests/test_api.py | 10 +++--- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/specifyweb/businessrules/rules/cogtype_rules.py b/specifyweb/businessrules/rules/cogtype_rules.py index eec347d23ea..7f106cbd8d0 100644 --- a/specifyweb/businessrules/rules/cogtype_rules.py +++ b/specifyweb/businessrules/rules/cogtype_rules.py @@ -3,13 +3,15 @@ from specifyweb.businessrules.orm_signal_handler import orm_signal_handler from specifyweb.specify.models import Picklist, Picklistitem +SYSTEM_COGTYPES_PICKLIST = "SystemCOGTypes" + @orm_signal_handler('pre_save', 'Collectionobjectgrouptype') def cogtype_pre_save(cog_type): # Ensure the cog_type type is validated by being the picklist. # NOTE: Maybe add constraint on the cog_type name in the future. default_cog_types_picklist = Picklist.objects.get( - name="Default Collection Object Group Types", + name=SYSTEM_COGTYPES_PICKLIST, collection=cog_type.collection ) if Picklistitem.objects.filter(picklist=default_cog_types_picklist, value=cog_type.type).count() == 0: diff --git a/specifyweb/specify/migrations/0005_schema_config_update.py b/specifyweb/specify/migrations/0005_schema_config_update.py index 9eb0d09146b..efe5cf11b2d 100644 --- a/specifyweb/specify/migrations/0005_schema_config_update.py +++ b/specifyweb/specify/migrations/0005_schema_config_update.py @@ -1,6 +1,5 @@ """ -This migration updates the Schema Config entries for pre-geo tables. -Geo migration added new fields to already existing tables. This migration updates the Schema Config to reflect those changes. +This migration updates the Schema Config entries for pre-geo tables and creates picklists for COGTypes. Fields added: Collection -> collectionObjectType @@ -9,6 +8,8 @@ LithostratTreeDef -> discipline StorageTreeDef -> institution TaxonTreeDef -> discipline + +Picklist created for COGType -> type and updates an existing incorrect picklist for COG -> COGType """ from django.db import migrations @@ -45,9 +46,10 @@ }, ] -PICKLIST_NAME = 'CollectionObjectGroupType' +PICKLIST_NAME = 'COGTypes' COGTYPE_FIELD_NAME = 'cogType' PICKLIST_TEXT = 'Collection Object Group Type' +SYSTEM_COGTYPE_PICKLIST_NAME = "SystemCOGTypes" def add_fields(apps): Splocalecontainer = apps.get_model('specify', 'Splocalecontainer') @@ -80,13 +82,11 @@ def remove_fields(apps): for data in FIELD_DATA: Splocaleitemstr.objects.filter( text=data["field"], - itemname__name=data["field"], itemname__container__name=data["table"], itemname__container__schematype=0 ).delete() Splocaleitemstr.objects.filter( text=data["field"], - itemdesc__name=data["field"], itemdesc__container__name=data["table"], itemdesc__container__schematype=0 ).delete() @@ -138,12 +138,33 @@ def revert_cogtype_splocalecontaineritem(apps): isrequired=None ) +def update_systemcogtypes_picklist(apps): + Picklist = apps.get_model('specify', 'Picklist') + + Picklist.objects.filter(name='Default Collection Object Group Types').update( + name=SYSTEM_COGTYPE_PICKLIST_NAME, + type=0, + issystem=True, + readonly=True, + sizelimit=3, + tablename=None + ) + +def revert_systemcogtypes_picklist(apps): + Picklist = apps.get_model('specify', 'Picklist') + + # revert only changes the name and not the other attributes as those were incorrect + Picklist.objects.filter(name=SYSTEM_COGTYPE_PICKLIST_NAME).update( + name='Default Collection Object Group Types', + ) + + # Updates cogtype -> type to use the Default COGType picklist (Drill Core, Discrete, Consolidated) def update_cogtype_type_splocalecontaineritem(apps): Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') Splocalecontaineritem.objects.filter(container__name='collectionobjectgrouptype', container__schematype=0, name='type').update( - picklistname='Default Collection Object Group Types', + picklistname=SYSTEM_COGTYPE_PICKLIST_NAME, isrequired=True ) @@ -164,12 +185,14 @@ def apply_migration(apps, schema_editor): add_fields(apps) create_cogtype_picklist(apps) update_cogtype_splocalecontaineritem(apps) + update_systemcogtypes_picklist(apps) update_cogtype_type_splocalecontaineritem(apps) def revert_migration(apps, schema_editor): remove_fields(apps) revert_cogtype_picklist(apps) revert_cogtype_splocalecontaineritem(apps) + revert_systemcogtypes_picklist(apps) revert_cogtype_type_splocalecontaineritem(apps) operations = [ diff --git a/specifyweb/specify/tests/test_api.py b/specifyweb/specify/tests/test_api.py index 3969e0c48e2..3a8a704e614 100644 --- a/specifyweb/specify/tests/test_api.py +++ b/specifyweb/specify/tests/test_api.py @@ -12,6 +12,7 @@ from specifyweb.permissions.models import UserPolicy from specifyweb.specify import api, models, scoping from specifyweb.businessrules.uniqueness_rules import UNIQUENESS_DISPATCH_UID, check_unique, apply_default_uniqueness_rules +from specifyweb.businessrules.rules.cogtype_rules import SYSTEM_COGTYPES_PICKLIST from specifyweb.businessrules.orm_signal_handler import connect_signal, disconnect_signal from specifyweb.specify.model_extras import Specifyuser from specifyweb.specify.models import ( @@ -663,11 +664,10 @@ class DefaultsSetup(MainSetupTearDown, TestCase): def setUp(self): super().setUp() cog_type_picklist = Picklist.objects.create( - name='Default Collection Object Group Types', - tablename='CollectionObjectGroupType', - issystem=False, - type=1, - readonly=False, + name=SYSTEM_COGTYPES_PICKLIST, + issystem=True, + type=0, + readonly=True, collection=self.collection ) Picklistitem.objects.create( From 0a5547d34660caee47c7e87b393d9d1c5ea213e1 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Tue, 8 Oct 2024 11:38:48 -0400 Subject: [PATCH 08/47] Rename migration --- .../js_src/lib/components/DataModel/types.ts | 66 +++++++------------ ...update.py => 0006_schema_config_update.py} | 4 +- 2 files changed, 24 insertions(+), 46 deletions(-) rename specifyweb/specify/migrations/{0005_schema_config_update.py => 0006_schema_config_update.py} (97%) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index a9f499eef82..86ea5401b01 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -244,14 +244,11 @@ export type Accession = { readonly fields: { readonly accessionCondition: string | null; readonly accessionNumber: string; - readonly accessionNumber: string; readonly actualTotalCountAmt: number | null; readonly collectionObjectCount: number | null; readonly dateAccessioned: string | null; - readonly dateAccessioned: string | null; readonly dateAcknowledged: string | null; readonly dateReceived: string | null; - readonly dateReceived: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -1371,11 +1368,11 @@ export type Collection = { export type CollectionObject = { readonly tableName: 'CollectionObject'; readonly fields: { + readonly yesNo1: boolean | null; readonly actualTotalCountAmt: number | null; readonly age: number | null; readonly altCatalogNumber: string | null; readonly availability: string | null; - readonly catalogNumber: string | null; readonly catalogedDate: string | null; readonly catalogedDatePrecision: number | null; readonly catalogedDateVerbatim: string | null; @@ -1383,34 +1380,33 @@ export type CollectionObject = { readonly remarks: string | null; readonly collectionMemberId: number; readonly countAmt: number | null; - readonly reservedText: string | null; + readonly timestampCreated: string; readonly timestampModified: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly deaccessioned: boolean | null; - readonly timestampModified: string | null; readonly embargoReason: string | null; readonly embargoReleaseDate: string | null; readonly embargoReleaseDatePrecision: number | null; readonly embargoStartDate: string | null; readonly embargoStartDatePrecision: number | null; - readonly yesNo2: boolean | null; - readonly fieldNumber: string | null; readonly guid: string | null; - readonly text2: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly inventoryDate: string | null; readonly inventoryDatePrecision: number | null; + readonly text2: string | null; + readonly fieldNumber: string | null; readonly modifier: string | null; readonly name: string | null; readonly notifications: string | null; readonly numberOfDuplicates: number | null; + readonly number1: number | null; + readonly number2: number | null; readonly objectCondition: string | null; readonly ocr: string | null; - readonly altCatalogNumber: string | null; + readonly text1: string | null; readonly projectNumber: string | null; - readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; readonly reservedText: string | null; @@ -1418,7 +1414,6 @@ export type CollectionObject = { readonly reservedText3: string | null; readonly restrictions: string | null; readonly sgrStatus: number | null; - readonly text1: string | null; readonly description: string | null; readonly text3: string | null; readonly text4: string | null; @@ -1429,11 +1424,8 @@ export type CollectionObject = { readonly totalCountAmt: number | null; readonly totalValue: number | null; readonly uniqueIdentifier: string | null; - readonly number1: number | null; readonly version: number | null; readonly visibility: number | null; - readonly fieldNumber: string | null; - readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; @@ -1448,13 +1440,13 @@ export type CollectionObject = { readonly agent1: Agent | null; readonly appraisal: Appraisal | null; readonly cataloger: Agent | null; + readonly collectingEvent: CollectingEvent | null; readonly collection: Collection; readonly collectionObjectType: CollectionObjectType; readonly container: Container | null; readonly containerOwner: Container | null; readonly createdByAgent: Agent | null; readonly currentDetermination: Determination | null; - readonly modifiedByAgent: Agent | null; readonly embargoAuthority: Agent | null; readonly fieldNotebookPage: FieldNotebookPage | null; readonly inventorizedBy: Agent | null; @@ -1525,23 +1517,12 @@ export type CollectionObjectAttr = { export type CollectionObjectAttribute = { readonly tableName: 'CollectionObjectAttribute'; readonly fields: { - readonly number1: number | null; - readonly text4: string | null; readonly bottomDistance: number | null; readonly collectionMemberId: number; - readonly text11: string | null; - readonly text12: string | null; - readonly text10: string | null; - readonly text2: string | null; - readonly number37: number | null; readonly date1: string | null; readonly date1Precision: number | null; - readonly remarks: string | null; - readonly text15: string | null; readonly direction: string | null; readonly distanceUnits: string | null; - readonly text6: string | null; - readonly number2: number | null; readonly integer1: number | null; readonly integer10: number | null; readonly integer2: number | null; @@ -1552,8 +1533,6 @@ export type CollectionObjectAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly number12: number | null; - readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; @@ -1565,6 +1544,7 @@ export type CollectionObjectAttribute = { readonly number17: number | null; readonly number18: number | null; readonly number19: number | null; + readonly number2: number | null; readonly number20: number | null; readonly number21: number | null; readonly number22: number | null; @@ -1583,9 +1563,12 @@ export type CollectionObjectAttribute = { readonly number34: number | null; readonly number35: number | null; readonly number36: number | null; + readonly number37: number | null; + readonly number38: number | null; readonly number39: number | null; readonly number4: number | null; readonly number40: number | null; + readonly number41: number | null; readonly number42: number | null; readonly number5: number | null; readonly number6: number | null; @@ -1616,6 +1599,7 @@ export type CollectionObjectAttribute = { readonly text27: string | null; readonly text28: string | null; readonly text29: string | null; + readonly text3: string | null; readonly text30: string | null; readonly text31: string | null; readonly text32: string | null; @@ -1626,17 +1610,17 @@ export type CollectionObjectAttribute = { readonly text37: string | null; readonly text38: string | null; readonly text39: string | null; + readonly text4: string | null; readonly text40: string | null; readonly text5: string | null; readonly text6: string | null; readonly text7: string | null; + readonly text8: string | null; readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly topDistance: number | null; - readonly text1: string | null; readonly version: number | null; - readonly text2: string | null; readonly yesNo1: boolean | null; readonly yesNo10: boolean | null; readonly yesNo11: boolean | null; @@ -2384,10 +2368,11 @@ export type DataType = { export type Deaccession = { readonly tableName: 'Deaccession'; readonly fields: { + readonly timestampModified: string | null; readonly date1: string | null; readonly date2: string | null; - readonly deaccessionDate: string | null; readonly deaccessionNumber: string; + readonly deaccessionDate: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -2406,7 +2391,6 @@ export type Deaccession = { readonly text4: string | null; readonly text5: string | null; readonly timestampCreated: string; - readonly timestampModified: string | null; readonly totalItems: number | null; readonly totalPreps: number | null; readonly type: string | null; @@ -2475,12 +2459,12 @@ export type Determination = { readonly tableName: 'Determination'; readonly fields: { readonly addendum: string | null; - readonly text1: string | null; readonly alternateName: string | null; readonly collectionMemberId: number; readonly isCurrent: boolean; readonly determinedDate: string | null; readonly determinedDatePrecision: number | null; + readonly featureOrBasis: string | null; readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; @@ -2499,7 +2483,6 @@ export type Determination = { readonly confidence: string | null; readonly remarks: string | null; readonly subSpQualifier: string | null; - readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -2509,10 +2492,8 @@ export type Determination = { readonly text8: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text2: string | null; readonly typeStatusName: string | null; readonly varQualifier: string | null; - readonly featureOrBasis: string | null; readonly version: number | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -2526,8 +2507,8 @@ export type Determination = { readonly createdByAgent: Agent | null; readonly determiner: Agent | null; readonly modifiedByAgent: Agent | null; - readonly taxon: Taxon | null; readonly preferredTaxon: Taxon | null; + readonly taxon: Taxon | null; }; readonly toManyDependent: { readonly determinationCitations: RA; @@ -3882,6 +3863,8 @@ export type LoanReturnPreparation = { export type Locality = { readonly tableName: 'Locality'; readonly fields: { + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly datum: string | null; readonly elevationAccuracy: number | null; readonly elevationMethod: string | null; @@ -3910,7 +3893,6 @@ export type Locality = { readonly sgrStatus: number | null; readonly shortName: string | null; readonly srcLatLongUnit: number; - readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -4415,7 +4397,6 @@ export type Preparation = { readonly sampleNumber: string | null; readonly status: string | null; readonly storageLocation: string | null; - readonly text1: string | null; readonly text10: string | null; readonly text11: string | null; readonly text12: string | null; @@ -6536,10 +6517,7 @@ export type CollectionObjectGroup = { readonly modifiedByAgent: Agent | null; readonly parentCojo: CollectionObjectGroupJoin | null; }; - readonly toManyDependent: { - readonly cojo: RA; - readonly parentcojos: RA; - }; + readonly toManyDependent: { readonly cojo: RA }; readonly toManyIndependent: RR; }; export type CollectionObjectGroupJoin = { diff --git a/specifyweb/specify/migrations/0005_schema_config_update.py b/specifyweb/specify/migrations/0006_schema_config_update.py similarity index 97% rename from specifyweb/specify/migrations/0005_schema_config_update.py rename to specifyweb/specify/migrations/0006_schema_config_update.py index efe5cf11b2d..25c37049dcd 100644 --- a/specifyweb/specify/migrations/0005_schema_config_update.py +++ b/specifyweb/specify/migrations/0006_schema_config_update.py @@ -9,7 +9,7 @@ StorageTreeDef -> institution TaxonTreeDef -> discipline -Picklist created for COGType -> type and updates an existing incorrect picklist for COG -> COGType +Creates a picklist for COGType -> type and updates an existing incorrect picklist for COG -> COGType """ from django.db import migrations @@ -178,7 +178,7 @@ def revert_cogtype_type_splocalecontaineritem(apps): class Migration(migrations.Migration): dependencies = [ - ('specify', '0004_stratigraphy_age'), + ('specify', '0005_collectionobjectgroup_parentcojo'), ] def apply_migration(apps, schema_editor): From eea7c34e1da57d2cdebcf4766305be0cb6414bd8 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Tue, 8 Oct 2024 09:54:45 -0700 Subject: [PATCH 09/47] Add tectonic default ranks Fixes #5294 --- .../specify/migrations/0006_tectonic_ranks.py | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 specifyweb/specify/migrations/0006_tectonic_ranks.py diff --git a/specifyweb/specify/migrations/0006_tectonic_ranks.py b/specifyweb/specify/migrations/0006_tectonic_ranks.py new file mode 100644 index 00000000000..90c74ff9c83 --- /dev/null +++ b/specifyweb/specify/migrations/0006_tectonic_ranks.py @@ -0,0 +1,79 @@ +from django.apps import apps as specify_apps +from django.db import migrations, models +from specifyweb.specify.models import protect_with_blockers + + +def create_default_tectonic_ranks(apps): + TectonicUnit = apps.get_model('specify', 'TectonicUnitTreeDefItem') + TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') + Discipline = apps.get_model('specify', 'Discipline') + for discipline in Discipline.objects.all(): + tectonic_tree_def = TectonicTreeDef.objects.create(name="Tectonic Unit", discipline=discipline) + + root = TectonicUnit.objects.create( + name="Root", + title="Root", + rankid=0, + parentitem=None, + tectonicunittreedef=tectonic_tree_def, + ) + superstructure = TectonicUnit.objects.create( + name="Superstructure", + title="Superstructure", + rankid=10, + parentitem=root, + tectonicunittreedef=tectonic_tree_def, + ) + tectonic_domain = TectonicUnit.objects.create( + name="Tectonic Domain", + title="Tectonic Domain", + rankid=20, + parentitem=superstructure, + tectonicunittreedef=tectonic_tree_def, + ) + tectonic_subdomain = TectonicUnit.objects.create( + name="Tectonic Subdomain", + title="Tectonic Subdomain", + rankid=30, + parentitem=tectonic_domain, + tectonicunittreedef=tectonic_tree_def, + ) + tectonic_unit = TectonicUnit.objects.create( + name="Tectonic Unit", + title="Tectonic Unit", + rankid=40, + parentitem=tectonic_subdomain, + tectonicunittreedef=tectonic_tree_def, + ) + tectonic_subunit = TectonicUnit.objects.create( + name="Tectonic Subunit", + title="Tectonic Subunit", + rankid=50, + parentitem=tectonic_unit, + tectonicunittreedef=tectonic_tree_def, + ) + +def revert_default_tectonic_ranks(apps, schema_editor): + TectonicUnit = apps.get_model('specify', 'TectonicUnit') + TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') + Discipline = apps.get_model('specify', 'Discipline') + for discipline in Discipline.objects.all(): + tectonic_tree_def = TectonicTreeDef.objects.filter(name="Tectonic Unit", discipline=discipline) + if tectonic_tree_def: + tectonic_tree_def.delete() + +class Migration(migrations.Migration): + + dependencies = [ + ('specify', '0005_collectionobjectgroup_parentcojo'), + ] + + def consolidated_python_django_migration_operations(apps, schema_editor): + create_default_tectonic_ranks(apps) + + def revert_cosolidated_python_django_migration_operations(apps, schema_editor): + revert_default_tectonic_ranks(apps, schema_editor) + + operations = [ + migrations.RunPython(consolidated_python_django_migration_operations, revert_cosolidated_python_django_migration_operations, atomic=True), + ] \ No newline at end of file From 1ec1c4e373d19fff9ccd79e87e0183eedae32adf Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Tue, 8 Oct 2024 11:01:39 -0700 Subject: [PATCH 10/47] Add geo tree --- .../js_src/lib/components/InitialContext/treeRanks.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/InitialContext/treeRanks.ts b/specifyweb/frontend/js_src/lib/components/InitialContext/treeRanks.ts index 29c84c9da1c..57736005759 100644 --- a/specifyweb/frontend/js_src/lib/components/InitialContext/treeRanks.ts +++ b/specifyweb/frontend/js_src/lib/components/InitialContext/treeRanks.ts @@ -39,7 +39,12 @@ let treeDefinitions: TreeInformation = undefined!; */ const commonTrees = ['Geography', 'Storage', 'Taxon'] as const; const treesForPaleo = ['GeologicTimePeriod', 'LithoStrat'] as const; -export const allTrees = [...commonTrees, ...treesForPaleo] as const; +// Const treesForGeo = ['TectonicUnit'] as const; +export const allTrees = [ + ...commonTrees, + ...treesForPaleo, + // ...treesForGeo, +] as const; /* * Until discipline information is loaded, assume all trees are appropriate in * this discipline From ee3467a9b2e6d5cc87a5a82b061c3182bbdd3f70 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:58:04 -0700 Subject: [PATCH 11/47] Add tectonicTree to mutations --- specifyweb/specify/tree_views.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/specifyweb/specify/tree_views.py b/specifyweb/specify/tree_views.py index 41eca5b1c82..51fbcc68b2f 100644 --- a/specifyweb/specify/tree_views.py +++ b/specifyweb/specify/tree_views.py @@ -26,8 +26,8 @@ logger = logging.getLogger(__name__) TREE_TABLE = Literal['Taxon', 'Storage', - 'Geography', 'Geologictimeperiod', 'Lithostrat'] - + 'Geography', 'Geologictimeperiod', 'Lithostrat', 'TectonicUnit'] +# TODO: Move TectonicUnit to new Geo trees COMMON_TREES: Tuple[TREE_TABLE, ...] = ['Taxon', 'Storage', 'Geography'] @@ -521,6 +521,14 @@ class LithostratMutationPT(PermissionTarget): desynonymize = PermissionTargetAction() repair = PermissionTargetAction() +class TectonicUnitMutationPT(PermissionTarget): + resource = "/tree/edit/tectonicunit" + merge = PermissionTargetAction() + move = PermissionTargetAction() + synonymize = PermissionTargetAction() + desynonymize = PermissionTargetAction() + repair = PermissionTargetAction() + def perm_target(tree): return { @@ -529,4 +537,5 @@ def perm_target(tree): 'storage': StorageMutationPT, 'geologictimeperiod': GeologictimeperiodMutationPT, 'lithostrat': LithostratMutationPT, + 'tectonicunit': TectonicUnitMutationPT }[tree] From 09e90c857a1a57105018dadfeaef53257201f48e Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:07:23 -0700 Subject: [PATCH 12/47] Chnage tectonic place --- specifyweb/specify/tree_views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specifyweb/specify/tree_views.py b/specifyweb/specify/tree_views.py index 51fbcc68b2f..c433751d24b 100644 --- a/specifyweb/specify/tree_views.py +++ b/specifyweb/specify/tree_views.py @@ -26,10 +26,10 @@ logger = logging.getLogger(__name__) TREE_TABLE = Literal['Taxon', 'Storage', - 'Geography', 'Geologictimeperiod', 'Lithostrat', 'TectonicUnit'] + 'Geography', 'Geologictimeperiod', 'Lithostrat'] # TODO: Move TectonicUnit to new Geo trees COMMON_TREES: Tuple[TREE_TABLE, ...] = ['Taxon', 'Storage', - 'Geography'] + 'Geography', 'Tectonicunit'] ALL_TRESS: Tuple[TREE_TABLE, ...] = [ *COMMON_TREES, 'Geologictimeperiod', 'Lithostrat'] From 8ac636998ffd5800f1ce714a983cac13d895f1e0 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:13:55 -0700 Subject: [PATCH 13/47] Consistency naming --- specifyweb/specify/tree_views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specifyweb/specify/tree_views.py b/specifyweb/specify/tree_views.py index c433751d24b..b1b3f3b1405 100644 --- a/specifyweb/specify/tree_views.py +++ b/specifyweb/specify/tree_views.py @@ -521,7 +521,7 @@ class LithostratMutationPT(PermissionTarget): desynonymize = PermissionTargetAction() repair = PermissionTargetAction() -class TectonicUnitMutationPT(PermissionTarget): +class TectonicunitMutationPT(PermissionTarget): resource = "/tree/edit/tectonicunit" merge = PermissionTargetAction() move = PermissionTargetAction() @@ -537,5 +537,5 @@ def perm_target(tree): 'storage': StorageMutationPT, 'geologictimeperiod': GeologictimeperiodMutationPT, 'lithostrat': LithostratMutationPT, - 'tectonicunit': TectonicUnitMutationPT + 'tectonicunit': TectonicunitMutationPT }[tree] From 42e7f5986f0dd40d89852c9b1ddeefdbbe91c7f9 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:20:58 -0700 Subject: [PATCH 14/47] Test reformating --- specifyweb/frontend/js_src/lib/components/DataModel/types.ts | 1 + specifyweb/specify/datamodel.py | 1 + specifyweb/specify/models.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 082e8f17c92..f96ce36e662 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -2579,6 +2579,7 @@ export type Discipline = { readonly division: Division; readonly geographyTreeDef: GeographyTreeDef; readonly lithoStratTreeDef: LithoStratTreeDef | null; + readonly tectonicUnitTreeDef: TectonicUnitTreeDef | null; readonly modifiedByAgent: Agent | null; readonly taxonTreeDef: TaxonTreeDef | null; }; diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index ae783de341f..b99f8f0f00c 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -2992,6 +2992,7 @@ Relationship(name='taxonTreeDef', type='many-to-one',required=False, relatedModelName='TaxonTreeDef', column='TaxonTreeDefID', otherSideName='disciplines'), Relationship(name='geologicTimePeriodTreeDef', type='many-to-one',required=True, relatedModelName='GeologicTimePeriodTreeDef', column='GeologicTimePeriodTreeDefID', otherSideName='disciplines'), Relationship(name='lithoStratTreeDef', type='many-to-one',required=False, relatedModelName='LithoStratTreeDef', column='LithoStratTreeDefID', otherSideName='disciplines'), + Relationship(name='tectonicUnitTreeDef', type='many-to-one',required=False, relatedModelName='TectonicUnitTreeDef', column='TectonicUnitTreeDefID', otherSideName='disciplines'), Relationship(name='modifiedByAgent', type='many-to-one',required=False, relatedModelName='Agent', column='ModifiedByAgentID'), Relationship(name='numberingSchemes', type='many-to-many',required=False, relatedModelName='AutoNumberingScheme', otherSideName='disciplines'), Relationship(name='spExportSchemas', type='one-to-many',required=False, relatedModelName='SpExportSchema', otherSideName='discipline'), diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index 96a40ab312c..16ec641534c 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -2825,6 +2825,7 @@ class Discipline(model_extras.Discipline): taxontreedef = models.ForeignKey('TaxonTreeDef', db_column='TaxonTreeDefID', related_name='disciplines', null=True, on_delete=protect_with_blockers) geologictimeperiodtreedef = models.ForeignKey('GeologicTimePeriodTreeDef', db_column='GeologicTimePeriodTreeDefID', related_name='disciplines', null=False, on_delete=protect_with_blockers) lithostrattreedef = models.ForeignKey('LithoStratTreeDef', db_column='LithoStratTreeDefID', related_name='disciplines', null=True, on_delete=protect_with_blockers) + tectonicunittreedef = models.ForeignKey('TectonicUnitTreeDef', db_column='TectonicUnitTreeDefID', related_name='disciplines', null=True, on_delete=protect_with_blockers) modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) class Meta: @@ -7801,7 +7802,7 @@ class Meta: save = partialmethod(custom_save) -class TectonicUnitTreeDef(models.Model): +class Tectonicunittreedef(models.Model): specify_model = datamodel.get_table('tectonicunittreedef') # ID Field From 9b79eafbe2d471b520af9d64edfd80f343a7e26c Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:29:34 -0700 Subject: [PATCH 15/47] Reorder migrations --- .../js_src/lib/components/DataModel/types.ts | 1 - ...o.py => 0006_collectionobjectgroup_parentcojo.py} | 2 +- ...0006_tectonic_ranks.py => 0007_tectonic_ranks.py} | 2 +- specifyweb/specify/tree_views.py | 12 +----------- 4 files changed, 3 insertions(+), 14 deletions(-) rename specifyweb/specify/migrations/{0005_collectionobjectgroup_parentcojo.py => 0006_collectionobjectgroup_parentcojo.py} (91%) rename specifyweb/specify/migrations/{0006_tectonic_ranks.py => 0007_tectonic_ranks.py} (97%) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index d2600ee1b16..9703af222aa 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -2582,7 +2582,6 @@ export type Discipline = { readonly tectonicUnitTreeDef: TectonicUnitTreeDef | null; readonly modifiedByAgent: Agent | null; readonly taxonTreeDef: TaxonTreeDef | null; - readonly tectonicUnitTreeDef: TectonicUnitTreeDef | null; }; readonly toManyDependent: RR; readonly toManyIndependent: { diff --git a/specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py b/specifyweb/specify/migrations/0006_collectionobjectgroup_parentcojo.py similarity index 91% rename from specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py rename to specifyweb/specify/migrations/0006_collectionobjectgroup_parentcojo.py index dc116f75a48..a97cb5ba5ed 100644 --- a/specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py +++ b/specifyweb/specify/migrations/0006_collectionobjectgroup_parentcojo.py @@ -7,7 +7,7 @@ class Migration(migrations.Migration): dependencies = [ - ('specify', '0004_stratigraphy_age'), + ('specify', '0005_fix_tectonic_tree_fields'), ] operations = [ diff --git a/specifyweb/specify/migrations/0006_tectonic_ranks.py b/specifyweb/specify/migrations/0007_tectonic_ranks.py similarity index 97% rename from specifyweb/specify/migrations/0006_tectonic_ranks.py rename to specifyweb/specify/migrations/0007_tectonic_ranks.py index 90c74ff9c83..f3df58385ca 100644 --- a/specifyweb/specify/migrations/0006_tectonic_ranks.py +++ b/specifyweb/specify/migrations/0007_tectonic_ranks.py @@ -65,7 +65,7 @@ def revert_default_tectonic_ranks(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('specify', '0005_collectionobjectgroup_parentcojo'), + ('specify', '0006_collectionobjectgroup_parentcojo'), ] def consolidated_python_django_migration_operations(apps, schema_editor): diff --git a/specifyweb/specify/tree_views.py b/specifyweb/specify/tree_views.py index 8dfc80b554f..1856f95a22e 100644 --- a/specifyweb/specify/tree_views.py +++ b/specifyweb/specify/tree_views.py @@ -529,16 +529,6 @@ class TectonicunitMutationPT(PermissionTarget): desynonymize = PermissionTargetAction() repair = PermissionTargetAction() - -class TectonicUnitMutationPT(PermissionTarget): - resource = "/tree/edit/tectonicunit" - merge = PermissionTargetAction() - move = PermissionTargetAction() - synonymize = PermissionTargetAction() - desynonymize = PermissionTargetAction() - repair = PermissionTargetAction() - - def perm_target(tree): return { 'taxon': TaxonMutationPT, @@ -546,5 +536,5 @@ def perm_target(tree): 'storage': StorageMutationPT, 'geologictimeperiod': GeologictimeperiodMutationPT, 'lithostrat': LithostratMutationPT, - 'tectonicunit': TectonicUnitMutationPT + 'tectonicunit':TectonicunitMutationPT }[tree] From bf6a6d748a4845636e3806ca8ecad38e05464eb9 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:50:59 -0700 Subject: [PATCH 16/47] Fix migration 7 fields name --- ... 0005_collectionobjectgroup_parentcojo.py} | 2 +- .../specify/migrations/0007_tectonic_ranks.py | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) rename specifyweb/specify/migrations/{0006_collectionobjectgroup_parentcojo.py => 0005_collectionobjectgroup_parentcojo.py} (91%) diff --git a/specifyweb/specify/migrations/0006_collectionobjectgroup_parentcojo.py b/specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py similarity index 91% rename from specifyweb/specify/migrations/0006_collectionobjectgroup_parentcojo.py rename to specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py index a97cb5ba5ed..dc116f75a48 100644 --- a/specifyweb/specify/migrations/0006_collectionobjectgroup_parentcojo.py +++ b/specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py @@ -7,7 +7,7 @@ class Migration(migrations.Migration): dependencies = [ - ('specify', '0005_fix_tectonic_tree_fields'), + ('specify', '0004_stratigraphy_age'), ] operations = [ diff --git a/specifyweb/specify/migrations/0007_tectonic_ranks.py b/specifyweb/specify/migrations/0007_tectonic_ranks.py index f3df58385ca..a7c056a9353 100644 --- a/specifyweb/specify/migrations/0007_tectonic_ranks.py +++ b/specifyweb/specify/migrations/0007_tectonic_ranks.py @@ -14,43 +14,43 @@ def create_default_tectonic_ranks(apps): name="Root", title="Root", rankid=0, - parentitem=None, - tectonicunittreedef=tectonic_tree_def, + parent=None, + treedef=tectonic_tree_def, ) superstructure = TectonicUnit.objects.create( name="Superstructure", title="Superstructure", rankid=10, - parentitem=root, - tectonicunittreedef=tectonic_tree_def, + parent=root, + treedef=tectonic_tree_def, ) tectonic_domain = TectonicUnit.objects.create( name="Tectonic Domain", title="Tectonic Domain", rankid=20, - parentitem=superstructure, - tectonicunittreedef=tectonic_tree_def, + parent=superstructure, + treedef=tectonic_tree_def, ) tectonic_subdomain = TectonicUnit.objects.create( name="Tectonic Subdomain", title="Tectonic Subdomain", rankid=30, - parentitem=tectonic_domain, - tectonicunittreedef=tectonic_tree_def, + parent=tectonic_domain, + treedef=tectonic_tree_def, ) tectonic_unit = TectonicUnit.objects.create( name="Tectonic Unit", title="Tectonic Unit", rankid=40, - parentitem=tectonic_subdomain, - tectonicunittreedef=tectonic_tree_def, + parent=tectonic_subdomain, + treedef=tectonic_tree_def, ) tectonic_subunit = TectonicUnit.objects.create( name="Tectonic Subunit", title="Tectonic Subunit", rankid=50, - parentitem=tectonic_unit, - tectonicunittreedef=tectonic_tree_def, + parent=tectonic_unit, + treedef=tectonic_tree_def, ) def revert_default_tectonic_ranks(apps, schema_editor): @@ -65,7 +65,7 @@ def revert_default_tectonic_ranks(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('specify', '0006_collectionobjectgroup_parentcojo'), + ('specify', '0006_fix_tectonic_tree_fields'), ] def consolidated_python_django_migration_operations(apps, schema_editor): From bd0f7c6cedce8157126b2f06c3a072fcea855c60 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 9 Oct 2024 14:27:16 -0700 Subject: [PATCH 17/47] Start create root node --- .../specify/migrations/0007_tectonic_ranks.py | 58 ++++++++++++++++--- specifyweb/specify/model_extras.py | 8 +++ specifyweb/specify/models.py | 4 +- 3 files changed, 61 insertions(+), 9 deletions(-) diff --git a/specifyweb/specify/migrations/0007_tectonic_ranks.py b/specifyweb/specify/migrations/0007_tectonic_ranks.py index a7c056a9353..c43d319e889 100644 --- a/specifyweb/specify/migrations/0007_tectonic_ranks.py +++ b/specifyweb/specify/migrations/0007_tectonic_ranks.py @@ -4,48 +4,48 @@ def create_default_tectonic_ranks(apps): - TectonicUnit = apps.get_model('specify', 'TectonicUnitTreeDefItem') + TectonicUnitTreeDefItem = apps.get_model('specify', 'TectonicUnitTreeDefItem') TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') Discipline = apps.get_model('specify', 'Discipline') for discipline in Discipline.objects.all(): tectonic_tree_def = TectonicTreeDef.objects.create(name="Tectonic Unit", discipline=discipline) - root = TectonicUnit.objects.create( + root = TectonicUnitTreeDefItem.objects.create( name="Root", title="Root", rankid=0, parent=None, treedef=tectonic_tree_def, ) - superstructure = TectonicUnit.objects.create( + superstructure = TectonicUnitTreeDefItem.objects.create( name="Superstructure", title="Superstructure", rankid=10, parent=root, treedef=tectonic_tree_def, ) - tectonic_domain = TectonicUnit.objects.create( + tectonic_domain = TectonicUnitTreeDefItem.objects.create( name="Tectonic Domain", title="Tectonic Domain", rankid=20, parent=superstructure, treedef=tectonic_tree_def, ) - tectonic_subdomain = TectonicUnit.objects.create( + tectonic_subdomain = TectonicUnitTreeDefItem.objects.create( name="Tectonic Subdomain", title="Tectonic Subdomain", rankid=30, parent=tectonic_domain, treedef=tectonic_tree_def, ) - tectonic_unit = TectonicUnit.objects.create( + tectonic_unit = TectonicUnitTreeDefItem.objects.create( name="Tectonic Unit", title="Tectonic Unit", rankid=40, parent=tectonic_subdomain, treedef=tectonic_tree_def, ) - tectonic_subunit = TectonicUnit.objects.create( + tectonic_subunit = TectonicUnitTreeDefItem.objects.create( name="Tectonic Subunit", title="Tectonic Subunit", rankid=50, @@ -57,11 +57,53 @@ def revert_default_tectonic_ranks(apps, schema_editor): TectonicUnit = apps.get_model('specify', 'TectonicUnit') TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') Discipline = apps.get_model('specify', 'Discipline') + for discipline in Discipline.objects.all(): tectonic_tree_def = TectonicTreeDef.objects.filter(name="Tectonic Unit", discipline=discipline) if tectonic_tree_def: tectonic_tree_def.delete() +def create_root_tectonic_node(apps): + TectonicUnit = apps.get_model('specify', 'TectonicUnit') + TectonicUnitTreeDefItem = apps.get_model('specify', 'TectonicUnitTreeDefItem') + TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') + Discipline = apps.get_model('specify', 'Discipline') + + for discipline in Discipline.objects.all(): + + tectonic_tree_def, created = TectonicTreeDef.objects.get_or_create( + name="Tectonic Unit", + discipline=discipline + ) + + tectonic_tree_def_item, create = TectonicUnitTreeDefItem.objects.get_or_create( + name="Root", + treedef=tectonic_tree_def + ) + + root = TectonicUnit.objects.create( + name="Root", + isaccepted=1, + nodenumber=1, + rankid=1, + parent=None, + definition=tectonic_tree_def, + definitionitem=tectonic_tree_def_item + ) + +def revert_create_root_tectonic_node(apps, schema_editor): + TectonicUnit = apps.get_model('specify', 'TectonicUnit') + TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') + Discipline = apps.get_model('specify', 'Discipline') + + for discipline in Discipline.objects.all(): + tectonic_tree_def = TectonicTreeDef.objects.filter(name="Tectonic Unit", discipline=discipline).first() + + if tectonic_tree_def: + TectonicUnit.objects.filter( + name="Root" + ).delete() + class Migration(migrations.Migration): dependencies = [ @@ -70,9 +112,11 @@ class Migration(migrations.Migration): def consolidated_python_django_migration_operations(apps, schema_editor): create_default_tectonic_ranks(apps) + create_root_tectonic_node(apps) def revert_cosolidated_python_django_migration_operations(apps, schema_editor): revert_default_tectonic_ranks(apps, schema_editor) + revert_create_root_tectonic_node(apps) operations = [ migrations.RunPython(consolidated_python_django_migration_operations, revert_cosolidated_python_django_migration_operations, atomic=True), diff --git a/specifyweb/specify/model_extras.py b/specifyweb/specify/model_extras.py index 82c1492fa84..17e02b5219e 100644 --- a/specifyweb/specify/model_extras.py +++ b/specifyweb/specify/model_extras.py @@ -173,6 +173,10 @@ class Lithostrat(Tree): class Meta: abstract = True +class Tectonicunit(Tree): + class Meta: + abstract = True + class Geographytreedefitem(TreeRank): class Meta: abstract = True @@ -192,3 +196,7 @@ class Meta: class Taxontreedefitem(TreeRank): class Meta: abstract = True + +class Tectonicunittreedefitem(TreeRank): + class Meta: + abstract = True diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index bf9a386cb25..2372009f2ec 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7833,7 +7833,7 @@ class Meta: save = partialmethod(custom_save) -class Tectonicunittreedefitem(models.Model): +class Tectonicunittreedefitem(model_extras.Tectonicunittreedefitem): specify_model = datamodel.get_table('tectonicUnittreedefitem') # ID Field @@ -7865,7 +7865,7 @@ class Meta: save = partialmethod(custom_save) -class Tectonicunit(models.Model): +class Tectonicunit(model_extras.Tectonicunit): specify_model = datamodel.get_table('tectonicunit') # ID Field From d9a3dff1926c8fc6e0597dcb234acdee72e19e04 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Thu, 10 Oct 2024 07:05:23 -0700 Subject: [PATCH 18/47] Chnage rank id for root node --- specifyweb/specify/migrations/0007_tectonic_ranks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/specifyweb/specify/migrations/0007_tectonic_ranks.py b/specifyweb/specify/migrations/0007_tectonic_ranks.py index c43d319e889..c861cb5f6b2 100644 --- a/specifyweb/specify/migrations/0007_tectonic_ranks.py +++ b/specifyweb/specify/migrations/0007_tectonic_ranks.py @@ -66,12 +66,12 @@ def revert_default_tectonic_ranks(apps, schema_editor): def create_root_tectonic_node(apps): TectonicUnit = apps.get_model('specify', 'TectonicUnit') TectonicUnitTreeDefItem = apps.get_model('specify', 'TectonicUnitTreeDefItem') - TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') + TectonicUnitTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') Discipline = apps.get_model('specify', 'Discipline') for discipline in Discipline.objects.all(): - tectonic_tree_def, created = TectonicTreeDef.objects.get_or_create( + tectonic_tree_def, created = TectonicUnitTreeDef.objects.get_or_create( name="Tectonic Unit", discipline=discipline ) @@ -85,7 +85,7 @@ def create_root_tectonic_node(apps): name="Root", isaccepted=1, nodenumber=1, - rankid=1, + rankid=0, parent=None, definition=tectonic_tree_def, definitionitem=tectonic_tree_def_item @@ -119,5 +119,5 @@ def revert_cosolidated_python_django_migration_operations(apps, schema_editor): revert_create_root_tectonic_node(apps) operations = [ - migrations.RunPython(consolidated_python_django_migration_operations, revert_cosolidated_python_django_migration_operations, atomic=True), + migrations.RunPython(consolidated_python_django_migration_operations, revert_cosolidated_python_django_migration_operations, atomic=True), ] \ No newline at end of file From 19276b8d150dcabaa82c4917bab74cc4c4a8fb10 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:12:57 -0700 Subject: [PATCH 19/47] Add todos and tectonic to various files --- .../lib/components/DataModel/schemaOverrides.ts | 14 ++++++++++++++ .../js_src/lib/components/Forms/ResourceView.tsx | 1 + .../js_src/lib/components/PickLists/definitions.ts | 1 + .../static/properties/global_views_en.properties | 1 + specifyweb/specify/build_models.py | 1 + specifyweb/specify/models_by_table_id.py | 2 +- specifyweb/specify/tree_ranks.py | 1 + specifyweb/specify/tree_utils.py | 2 +- specifyweb/stored_queries/execution.py | 2 +- specifyweb/workbench/upload/scoping.py | 3 +++ specifyweb/workbench/upload/upload.py | 2 +- 11 files changed, 26 insertions(+), 4 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/schemaOverrides.ts b/specifyweb/frontend/js_src/lib/components/DataModel/schemaOverrides.ts index 27400e4fb62..971f4f33524 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/schemaOverrides.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/schemaOverrides.ts @@ -91,6 +91,8 @@ const tableOverwrites: Partial> = { StorageTreeDefItem: 'system', TaxonTreeDef: 'system', TaxonTreeDefItem: 'system', + TectonicUnitTreeDef: 'system', + TectonicUnitTreeDefItem: 'system', }; // These field overrides apply to entire front-end @@ -153,6 +155,12 @@ const globalFieldOverrides: { acceptedGeologicTimePeriod: { visibility: 'readOnly' }, fullName: { visibility: 'readOnly' }, }, + TectonicUnit: { + parent: { visibility: 'required' }, + isAccepted: { visibility: 'readOnly' }, + acceptedTectonicUnit: { visibility: 'readOnly' }, + fullName: { visibility: 'readOnly' }, + }, Storage: { parent: { visibility: 'required' }, isAccepted: { visibility: 'readOnly' }, @@ -187,6 +195,12 @@ const globalFieldOverrides: { GeologicTimePeriodTreeDefItem: { fullNameSeparator: { whiteSpaceSensitive: true }, }, + TectonicUnitTreeDef: { + fullNameDirection: { visibility: 'readOnly' }, + }, + TectonicUnitTreeDefItem: { + fullNameSeparator: { whiteSpaceSensitive: true }, + }, LithoStratTreeDef: { fullNameDirection: { visibility: 'readOnly' }, }, diff --git a/specifyweb/frontend/js_src/lib/components/Forms/ResourceView.tsx b/specifyweb/frontend/js_src/lib/components/Forms/ResourceView.tsx index 0dfe0eae213..87441abe3e2 100644 --- a/specifyweb/frontend/js_src/lib/components/Forms/ResourceView.tsx +++ b/specifyweb/frontend/js_src/lib/components/Forms/ResourceView.tsx @@ -42,6 +42,7 @@ export const FORBID_ADDING = new Set([ 'StorageTreeDef', 'GeologicTimePeriodTreeDef', 'GeologicTimePeriodTreeDefItem', + 'TectonicUnitTreeDef', 'LithoStratTreeDef', 'Institution', 'Division', diff --git a/specifyweb/frontend/js_src/lib/components/PickLists/definitions.ts b/specifyweb/frontend/js_src/lib/components/PickLists/definitions.ts index 49f808b47a2..9b5960c84e4 100644 --- a/specifyweb/frontend/js_src/lib/components/PickLists/definitions.ts +++ b/specifyweb/frontend/js_src/lib/components/PickLists/definitions.ts @@ -195,6 +195,7 @@ export const getFrontEndPickLists = f.store<{ }, GeographyTreeDef: { fullNameDirection }, GeologicTimePeriodTreeDef: { fullNameDirection }, + TectonicUnitTreeDef: { fullNameDirection }, LithoStratTreeDef: { fullNameDirection }, StorageTreeDef: { fullNameDirection }, TaxonTreeDef: { fullNameDirection }, diff --git a/specifyweb/frontend/js_src/lib/tests/ajax/static/properties/global_views_en.properties b/specifyweb/frontend/js_src/lib/tests/ajax/static/properties/global_views_en.properties index fa5b3746310..518c2176765 100644 --- a/specifyweb/frontend/js_src/lib/tests/ajax/static/properties/global_views_en.properties +++ b/specifyweb/frontend/js_src/lib/tests/ajax/static/properties/global_views_en.properties @@ -24,6 +24,7 @@ LITHOSTRAT=LithoStrat GEOGRAPHY=Geography GEOLOGICTIMEPERIOD=ChronoStrat STORAGE=Storage +TECTONICUNIT=TectonicUnit # Object Attachment Form FILENAME=File Name diff --git a/specifyweb/specify/build_models.py b/specifyweb/specify/build_models.py index 5177a014201..69256a9fbb8 100644 --- a/specifyweb/specify/build_models.py +++ b/specifyweb/specify/build_models.py @@ -118,6 +118,7 @@ def protect(collector, field, sub_objs, using): 'Lithostrattreedefitem.parent': models.DO_NOTHING, 'Storagetreedefitem.parent': models.DO_NOTHING, 'Taxontreedefitem.parent': models.DO_NOTHING, + 'Tectonicunittreedefitem.parent': models.DO_NOTHING, } def make_relationship(modelname, rel, datamodel): diff --git a/specifyweb/specify/models_by_table_id.py b/specifyweb/specify/models_by_table_id.py index b6de348aceb..794b24ebf3e 100644 --- a/specifyweb/specify/models_by_table_id.py +++ b/specifyweb/specify/models_by_table_id.py @@ -208,7 +208,7 @@ 1017: 'Collectionobjectgroupjoin', 1018: 'Collectionobjectgrouptype', } - +#TODO: do we need to add tectnocUnit to this file? model_names_by_app = { 'accounts': { 'Spuserexternalid' diff --git a/specifyweb/specify/tree_ranks.py b/specifyweb/specify/tree_ranks.py index d8910577cac..0de29720ab1 100644 --- a/specifyweb/specify/tree_ranks.py +++ b/specifyweb/specify/tree_ranks.py @@ -84,6 +84,7 @@ STORAGE_RANK_INCREMENT = 50 GEOLOGIC_TIME_PERIOD_INCREMENT = DEFAULT_RANK_INCREMENT LITHO_STRAT_INCREMENT = DEFAULT_RANK_INCREMENT +#TODO: do we need tectoncUnit here? # Map tree type to default tree ranks and default rank id increment TREE_RANKS_MAPPING = { diff --git a/specifyweb/specify/tree_utils.py b/specifyweb/specify/tree_utils.py index ac9cd0783a0..bca4e4a2b27 100644 --- a/specifyweb/specify/tree_utils.py +++ b/specifyweb/specify/tree_utils.py @@ -5,7 +5,7 @@ lookup = lambda tree: (tree.lower() + 'treedef') -SPECIFY_TREES = {"taxon", "storage", "geography", "geologictimeperiod", "lithostrat"} +SPECIFY_TREES = {"taxon", "storage", "geography", "geologictimeperiod", "lithostrat", 'tectonicunit'} def get_search_filters(collection: spmodels.Collection, tree: str): tree_name = tree.lower() diff --git a/specifyweb/stored_queries/execution.py b/specifyweb/stored_queries/execution.py index d2328e0e1a7..c90e3891489 100644 --- a/specifyweb/stored_queries/execution.py +++ b/specifyweb/stored_queries/execution.py @@ -80,7 +80,7 @@ def filter_by_collection(model, query, collection): if model is models.GeologicTimePeriod: logger.info("filtering geologic time period to discipline: %s", collection.discipline.name) return query.filter(model.GeologicTimePeriodTreeDefID == collection.discipline.geologictimeperiodtreedef_id) - +#TODO: add tectonic? if model is models.GeologicTimePeriodTreeDefItem: logger.info("filtering geologic time period rank to discipline: %s", collection.discipline.name) return query.filter(model.GeologicTimePeriodTreeDefID == collection.discipline.geologictimeperiodtreedef_id) diff --git a/specifyweb/workbench/upload/scoping.py b/specifyweb/workbench/upload/scoping.py index c75d90d4b16..452bcd0a210 100644 --- a/specifyweb/workbench/upload/scoping.py +++ b/specifyweb/workbench/upload/scoping.py @@ -203,6 +203,9 @@ def apply_scoping_to_treerecord(tr: TreeRecord, collection) -> ScopedTreeRecord: elif table.name == 'Storage': treedef = collection.discipline.division.institution.storagetreedef + elif table.name == 'TectonicUnit': + treedef = collection.discipline.division.institution.tectonicunittreedef + else: raise Exception(f'unexpected tree type: {table.name}') diff --git a/specifyweb/workbench/upload/upload.py b/specifyweb/workbench/upload/upload.py index ad151c123e2..c1efdb04e08 100644 --- a/specifyweb/workbench/upload/upload.py +++ b/specifyweb/workbench/upload/upload.py @@ -291,7 +291,7 @@ def fixup_trees(upload_plan: ScopedUploadable, results: List[UploadResult]) -> N to_fix = [ tree - for tree in ('taxon', 'geography', 'geologictimeperiod', 'lithostrat', 'storage') + for tree in ('taxon', 'geography', 'geologictimeperiod', 'lithostrat', 'storage', 'tectonicunit') if any(changed_tree(tree, r) for r in results) ] From b7ece555be3041a446aee40bebffcf73d9b43976 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:19:31 -0700 Subject: [PATCH 20/47] Add todo --- .../js_src/lib/components/Toolbar/QueryTablesWrapper.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesWrapper.tsx b/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesWrapper.tsx index 5739d47bfc9..8111e4e87d7 100644 --- a/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesWrapper.tsx +++ b/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesWrapper.tsx @@ -73,6 +73,7 @@ export const defaultQueryTablesConfig: RA = [ 'Storage', 'Taxon', 'TreatmentEvent', + // TODO: do we need to add tectonicUnit here? ]; export function useQueryTables(): GetSet> { From bedf35e273d5e8b19f7eee431c8796e86b4bda5e Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:50:05 -0700 Subject: [PATCH 21/47] Add aliases --- specifyweb/specify/datamodel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index c9ecebfd817..218dd04fd8b 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8697,8 +8697,8 @@ Relationship(name='definitionItem', type='many-to-one', required=True, relatedModelName='TectonicUnitTreeDefItem', column='TectonicUnitTreeDefItemID', otherSideName='treeEntries'), ], fieldAliases=[ - - ] + {'vname':'acceptedParent', 'aname':'acceptedTectonicUnit'} + ], ), ]) From 61d9247a600c56d144fa524567981df9b1a02c94 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:01:25 -0700 Subject: [PATCH 22/47] Fix accepted_is not being defined --- specifyweb/businessrules/rules/tree_rules.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specifyweb/businessrules/rules/tree_rules.py b/specifyweb/businessrules/rules/tree_rules.py index aab78cf355f..443a779ea9b 100644 --- a/specifyweb/businessrules/rules/tree_rules.py +++ b/specifyweb/businessrules/rules/tree_rules.py @@ -42,5 +42,6 @@ def post_tree_rank_deletion_handler(sender, obj): @orm_signal_handler('pre_save') def set_is_accepted_if_preferred(sender, obj): - if hasattr(obj, 'isaccepted'): + if hasattr(obj, 'isaccepted') and hasattr(obj, 'accepted_id') : obj.isaccepted = obj.accepted_id == None + From 2d4297669c8b41cdcee020f3d5f2e92bb1c3326a Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:37:09 -0700 Subject: [PATCH 23/47] Add new geo tables to models by id --- specifyweb/specify/models_by_table_id.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/specifyweb/specify/models_by_table_id.py b/specifyweb/specify/models_by_table_id.py index 794b24ebf3e..039ee59ed35 100644 --- a/specifyweb/specify/models_by_table_id.py +++ b/specifyweb/specify/models_by_table_id.py @@ -207,8 +207,17 @@ 1016: 'Collectionobjectgroup', 1017: 'Collectionobjectgroupjoin', 1018: 'Collectionobjectgrouptype', + 1019: 'AbsoluteAge', + 1020: 'RelativeAge', + 1021: 'AbsoluteAgeAttachment', + 1022: 'RelativeAgeAttachment', + 1023: 'AbsoluteAgeCitation', + 1024: 'RelativeAgeCitation', + 1025: 'TectonicUnitTreeDef', + 1026: 'TectonicUnitTreeDefItem', + 1027: 'TectonicUnit', } -#TODO: do we need to add tectnocUnit to this file? + model_names_by_app = { 'accounts': { 'Spuserexternalid' @@ -427,6 +436,15 @@ 'Collectionobjectgroup', 'Collectionobjectgroupjoin', 'Collectionobjectgrouptype', + 'AbsoluteAge', + 'RelativeAge', + 'AbsoluteAgeAttachment', + 'RelativeAgeAttachment', + 'AbsoluteAgeCitation', + 'RelativeAgeCitation', + 'TectonicUnitTreeDef', + 'TectonicUnitTreeDefItem', + 'TectonicUnit', } } From 4a962dd0bbc65f0349550f07f04cdd28f07e074e Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:43:16 -0700 Subject: [PATCH 24/47] Add tectonic unit to tree_rans --- specifyweb/specify/tree_ranks.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/specifyweb/specify/tree_ranks.py b/specifyweb/specify/tree_ranks.py index 0de29720ab1..c992443c0b0 100644 --- a/specifyweb/specify/tree_ranks.py +++ b/specifyweb/specify/tree_ranks.py @@ -77,6 +77,18 @@ 'member': 400, 'bed': 500 } +TECTONIC_UNIT_RANKS = { + 'root': 0, + 'superstructure': 10, + 'tectonic_domain': 20, + 'tectonic_subdomain': 30, + 'tectonic_unit': 40, + 'tectonic_subunit': 50, + 'tectonic domain': 20, + 'tectonic subdomain': 30, + 'tectonic unit': 40, + 'tectonic subunit': 50 +} DEFAULT_RANK_INCREMENT = 100 TAXON_RANK_INCREMENT = 10 @@ -84,7 +96,7 @@ STORAGE_RANK_INCREMENT = 50 GEOLOGIC_TIME_PERIOD_INCREMENT = DEFAULT_RANK_INCREMENT LITHO_STRAT_INCREMENT = DEFAULT_RANK_INCREMENT -#TODO: do we need tectoncUnit here? +TECTONIC_UNIT_INCREMENT = 10 # Map tree type to default tree ranks and default rank id increment TREE_RANKS_MAPPING = { @@ -93,6 +105,7 @@ 'storage': (STORAGE_RANKS, STORAGE_RANK_INCREMENT), 'geologictimeperiod': (GEOLOGIC_TIME_PERIOD_RANKS, GEOLOGIC_TIME_PERIOD_INCREMENT), 'lithostrat': (LITHO_STRAT_RANKS, LITHO_STRAT_INCREMENT), + 'tectonicunit': (TECTONIC_UNIT_RANKS, TECTONIC_UNIT_INCREMENT), } TREE_RANK_TO_ITEM_MAP = { @@ -100,7 +113,8 @@ 'Geographytreedefitem': 'Geography', 'Storagetreedefitem': 'Storage', 'Geologictimeperiodtreedefitem': 'Geologictimeperiod', - 'Lithostrattreedefitem': 'Lithostrat' + 'Lithostrattreedefitem': 'Lithostrat', + 'Tectonicunittreedefitem': 'Tectonicunit' } def get_tree_item_model(tree_rank_model_name): From a3bdc900ea3900349b0ebb0c25096eb239fbffbc Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:49:02 -0700 Subject: [PATCH 25/47] Add tectonic to execution --- specifyweb/stored_queries/execution.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/specifyweb/stored_queries/execution.py b/specifyweb/stored_queries/execution.py index c90e3891489..7d0c3a45d7e 100644 --- a/specifyweb/stored_queries/execution.py +++ b/specifyweb/stored_queries/execution.py @@ -80,11 +80,19 @@ def filter_by_collection(model, query, collection): if model is models.GeologicTimePeriod: logger.info("filtering geologic time period to discipline: %s", collection.discipline.name) return query.filter(model.GeologicTimePeriodTreeDefID == collection.discipline.geologictimeperiodtreedef_id) -#TODO: add tectonic? + if model is models.GeologicTimePeriodTreeDefItem: logger.info("filtering geologic time period rank to discipline: %s", collection.discipline.name) return query.filter(model.GeologicTimePeriodTreeDefID == collection.discipline.geologictimeperiodtreedef_id) + if model is models.TectonicUnit: + logger.info("filtering tectonic unit to discipline: %s", collection.discipline.name) + return query.filter(model.TectonicUnitTreeDefID == collection.discipline.tectonicunittreedef_id) + + if model is models.TectonicUnitTreeDefItem: + logger.info("filtering tectonic unit rank to discipline: %s", collection.discipline.name) + return query.filter(model.TectonicUnitTreeDefID == collection.discipline.tectonicunittreedef_id) + if model is models.Storage: logger.info("filtering storage to institution: %s", collection.discipline.division.institution.name) return query.filter(model.StorageTreeDefID == collection.discipline.division.institution.storagetreedef_id) From 4b7da9548920992137d799e5365fe6cad725d955 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:53:04 -0700 Subject: [PATCH 26/47] Add tectonic to queryTables --- .../js_src/lib/components/Toolbar/QueryTablesWrapper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesWrapper.tsx b/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesWrapper.tsx index 8111e4e87d7..07d319df75d 100644 --- a/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesWrapper.tsx +++ b/specifyweb/frontend/js_src/lib/components/Toolbar/QueryTablesWrapper.tsx @@ -72,8 +72,8 @@ export const defaultQueryTablesConfig: RA = [ 'SpAuditLog', 'Storage', 'Taxon', + 'TectonicUnit', 'TreatmentEvent', - // TODO: do we need to add tectonicUnit here? ]; export function useQueryTables(): GetSet> { From 4f0d842b7d284303bb8271900506ee8e39642d4b Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Fri, 11 Oct 2024 10:01:38 -0700 Subject: [PATCH 27/47] Chnage format in models by table id --- specifyweb/specify/models_by_table_id.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/specifyweb/specify/models_by_table_id.py b/specifyweb/specify/models_by_table_id.py index 039ee59ed35..2e6112cfc87 100644 --- a/specifyweb/specify/models_by_table_id.py +++ b/specifyweb/specify/models_by_table_id.py @@ -213,9 +213,9 @@ 1022: 'RelativeAgeAttachment', 1023: 'AbsoluteAgeCitation', 1024: 'RelativeAgeCitation', - 1025: 'TectonicUnitTreeDef', - 1026: 'TectonicUnitTreeDefItem', - 1027: 'TectonicUnit', + 1025: 'Tectonicunittreedef', + 1026: 'Tectonicunittreedefitem', + 1027: 'Tectonicunit', } model_names_by_app = { @@ -442,9 +442,9 @@ 'RelativeAgeAttachment', 'AbsoluteAgeCitation', 'RelativeAgeCitation', - 'TectonicUnitTreeDef', - 'TectonicUnitTreeDefItem', - 'TectonicUnit', + 'Tectonicunittreedef', + 'Tectonicunittreedefitem', + 'Tectonicunit', } } From aabdc8f8ae0aa5d5c84b82b6b745192a67810e8b Mon Sep 17 00:00:00 2001 From: Sharad S Date: Mon, 14 Oct 2024 11:01:28 -0400 Subject: [PATCH 28/47] merge issue-5317 --- .../migrations/0002_default_unique_rules.py | 4 +- .../js_src/lib/components/DataModel/types.ts | 21 +- .../__snapshots__/treeRanks.test.ts.snap | 387 ++++++++++++++++++ .../__tests__/treeRanks.test.ts | 7 +- .../components/InitialContext/remotePrefs.ts | 19 + .../components/InitialContext/treeRanks.ts | 3 +- .../lib/components/Permissions/definitions.ts | 7 + .../Preferences/UserDefinitions.tsx | 26 ++ .../QueryBuilder/__tests__/fromTree.test.ts | 10 +- .../lib/components/QueryBuilder/fromTree.ts | 11 + .../js_src/lib/components/TreeView/Tree.tsx | 1 + specifyweb/specify/datamodel.py | 26 +- specifyweb/specify/migrations/0002_geo.py | 66 +-- .../0006_fix_tectonic_tree_fields.py | 111 +++++ specifyweb/specify/model_extras.py | 8 + specifyweb/specify/models.py | 23 +- specifyweb/specify/tree_views.py | 14 +- 17 files changed, 680 insertions(+), 64 deletions(-) create mode 100644 specifyweb/specify/migrations/0006_fix_tectonic_tree_fields.py diff --git a/specifyweb/businessrules/migrations/0002_default_unique_rules.py b/specifyweb/businessrules/migrations/0002_default_unique_rules.py index 161d1b2f39a..1a3b0d2d563 100644 --- a/specifyweb/businessrules/migrations/0002_default_unique_rules.py +++ b/specifyweb/businessrules/migrations/0002_default_unique_rules.py @@ -1,11 +1,11 @@ from django.db import migrations -from specifyweb.specify import models as spmodels from specifyweb.businessrules.uniqueness_rules import apply_default_uniqueness_rules def apply_rules_to_discipline(apps, schema_editor): - for disp in spmodels.Discipline.objects.all(): + Discipline = apps.get_model('specify', 'Discipline') + for disp in Discipline.objects.all(): apply_default_uniqueness_rules(disp) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 86ea5401b01..61997910389 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -3,8 +3,8 @@ * Afterward, some manual edits have been made. Those are marked with * "NOTE:" comments * - * Schema version: 2.12 - * Date generated: October 07, 2024 + * Schema version: 2.11 + * Date generated: July 17, 2024 * * The dataModel types were generated using the following code snippet. * After schema changes, it needs to be regenerated like this: @@ -2585,6 +2585,7 @@ export type Discipline = { readonly lithoStratTreeDef: LithoStratTreeDef | null; readonly modifiedByAgent: Agent | null; readonly taxonTreeDef: TaxonTreeDef | null; + readonly tectonicUnitTreeDef: TectonicUnitTreeDef | null; }; readonly toManyDependent: RR; readonly toManyIndependent: { @@ -6739,8 +6740,10 @@ export type TectonicUnitTreeDef = { readonly discipline: Discipline; readonly modifiedByAgent: Agent | null; }; - readonly toManyDependent: RR; - readonly toManyIndependent: RR; + readonly toManyDependent: { + readonly treeDefItems: RA; + }; + readonly toManyIndependent: { readonly treeEntries: RA }; }; export type TectonicUnitTreeDefItem = { readonly tableName: 'TectonicUnitTreeDefItem'; @@ -6749,7 +6752,7 @@ export type TectonicUnitTreeDefItem = { readonly isEnforced: boolean | null; readonly isInFullName: boolean | null; readonly name: string; - readonly rankId: number | null; + readonly rankId: number; readonly remarks: string | null; readonly textAfter: string | null; readonly textBefore: string | null; @@ -6762,8 +6765,8 @@ export type TectonicUnitTreeDefItem = { readonly toOneIndependent: { readonly createdbyagent: Agent | null; readonly modifiedByAgent: Agent | null; - readonly parentItem: TectonicUnitTreeDefItem | null; - readonly tectonicUnitTreeDef: TectonicUnitTreeDef; + readonly parent: TectonicUnitTreeDefItem | null; + readonly treeDef: TectonicUnitTreeDef; }; readonly toManyDependent: RR; readonly toManyIndependent: { @@ -6796,11 +6799,13 @@ export type TectonicUnit = { readonly toOneIndependent: { readonly acceptedTectonicUnit: TectonicUnit | null; readonly createdByAgent: Agent | null; + readonly definition: TectonicUnitTreeDef; + readonly definitionItem: TectonicUnitTreeDefItem; readonly modifiedByAgent: Agent | null; readonly parent: TectonicUnit | null; readonly tectonicUnitTreeDef: TectonicUnitTreeDef; readonly tectonicUnitTreeDefItem: TectonicUnitTreeDefItem; }; readonly toManyDependent: RR; - readonly toManyIndependent: RR; + readonly toManyIndependent: { readonly acceptedChildren: RA }; }; diff --git a/specifyweb/frontend/js_src/lib/components/InitialContext/__tests__/__snapshots__/treeRanks.test.ts.snap b/specifyweb/frontend/js_src/lib/components/InitialContext/__tests__/__snapshots__/treeRanks.test.ts.snap index def76761ae1..ecb50e8a773 100644 --- a/specifyweb/frontend/js_src/lib/components/InitialContext/__tests__/__snapshots__/treeRanks.test.ts.snap +++ b/specifyweb/frontend/js_src/lib/components/InitialContext/__tests__/__snapshots__/treeRanks.test.ts.snap @@ -372,3 +372,390 @@ exports[`getDisciplineTrees 1`] = ` "Taxon", ] `; + +exports[`queryFromTree 1`] = ` +[ + { + "_tableName": "SpQuery", + "contextname": "CollectionObject", + "contexttableid": 1, + "countonly": false, + "fields": [ + { + "_tableName": "SpQueryField", + "fieldname": "catalogNumber", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1.collectionobject.catalogNumber", + "tablelist": "1", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 1, + "startvalue": "", + "stringid": "1,9-determinations,4.taxon.fullName", + "tablelist": "1,9-determinations,4", + }, + { + "_tableName": "SpQueryField", + "fieldname": "isCurrent", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 13, + "sorttype": 0, + "startvalue": "", + "stringid": "1,9-determinations.determination.isCurrent", + "tablelist": "1,9-determinations", + }, + { + "_tableName": "SpQueryField", + "fieldname": "localityName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1,10,2.locality.localityName", + "tablelist": "1,10,2", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 1, + "startvalue": "", + "stringid": "1,10,2,3.geography.fullName", + "tablelist": "1,10,2,3", + }, + { + "_tableName": "SpQueryField", + "fieldname": "County ID", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 1, + "sorttype": 0, + "startvalue": "0", + "stringid": "1,10,2,3.geography.County ID", + "tablelist": "1,10,2,3", + }, + ], + "formatauditrecids": false, + "isfavorite": true, + "name": "Collection Object using \\"Los Angeles County\\"", + "ordinal": 32767, + "selectdistinct": false, + "specifyuser": "/api/specify/specifyuser/2/", + }, + { + "_tableName": "SpQuery", + "contextname": "CollectionObject", + "contexttableid": 1, + "countonly": false, + "fields": [ + { + "_tableName": "SpQueryField", + "fieldname": "catalogNumber", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 1, + "startvalue": "", + "stringid": "1.collectionobject.catalogNumber", + "tablelist": "1", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1,9-determinations,4.taxon.fullName", + "tablelist": "1,9-determinations,4", + }, + { + "_tableName": "SpQueryField", + "fieldname": "isCurrent", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 13, + "sorttype": 0, + "startvalue": "", + "stringid": "1,9-determinations.determination.isCurrent", + "tablelist": "1,9-determinations", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1,63-preparations,58.storage.fullName", + "tablelist": "1,63-preparations,58", + }, + { + "_tableName": "SpQueryField", + "fieldname": "Cabinet ID", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 1, + "sorttype": 0, + "startvalue": "4", + "stringid": "1,63-preparations,58.storage.Cabinet ID", + "tablelist": "1,63-preparations,58", + }, + ], + "formatauditrecids": false, + "isfavorite": true, + "name": "Collection Object using \\"Cabinet 1\\"", + "ordinal": 32767, + "selectdistinct": false, + "specifyuser": "/api/specify/specifyuser/2/", + }, + { + "_tableName": "SpQuery", + "contextname": "CollectionObject", + "contexttableid": 1, + "countonly": false, + "fields": [ + { + "_tableName": "SpQueryField", + "fieldname": "catalogNumber", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 1, + "startvalue": "", + "stringid": "1.collectionobject.catalogNumber", + "tablelist": "1", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1,9-determinations,4.taxon.fullName", + "tablelist": "1,9-determinations,4", + }, + { + "_tableName": "SpQueryField", + "fieldname": "Species ID", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 1, + "sorttype": 0, + "startvalue": "8", + "stringid": "1,9-determinations,4.taxon.Species ID", + "tablelist": "1,9-determinations,4", + }, + { + "_tableName": "SpQueryField", + "fieldname": "isCurrent", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 13, + "sorttype": 0, + "startvalue": "", + "stringid": "1,9-determinations.determination.isCurrent", + "tablelist": "1,9-determinations", + }, + { + "_tableName": "SpQueryField", + "fieldname": "localityName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1,10,2.locality.localityName", + "tablelist": "1,10,2", + }, + ], + "formatauditrecids": false, + "isfavorite": true, + "name": "Collection Object using \\"Carpiodes velifer\\"", + "ordinal": 32767, + "selectdistinct": false, + "specifyuser": "/api/specify/specifyuser/2/", + }, + { + "_tableName": "SpQuery", + "contextname": "CollectionObject", + "contexttableid": 1, + "countonly": false, + "fields": [ + { + "_tableName": "SpQueryField", + "fieldname": "catalogNumber", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1.collectionobject.catalogNumber", + "tablelist": "1", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 1, + "startvalue": "", + "stringid": "1,9-determinations,4.taxon.fullName", + "tablelist": "1,9-determinations,4", + }, + { + "_tableName": "SpQueryField", + "fieldname": "isCurrent", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 13, + "sorttype": 0, + "startvalue": "", + "stringid": "1,9-determinations.determination.isCurrent", + "tablelist": "1,9-determinations", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1,32,46-chronosStrat.geologictimeperiod.fullName", + "tablelist": "1,32,46-chronosStrat", + }, + { + "_tableName": "SpQueryField", + "fieldname": "Epoch ID", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 1, + "sorttype": 0, + "startvalue": "12", + "stringid": "1,32,46-chronosStrat.geologictimeperiod.Epoch ID", + "tablelist": "1,32,46-chronosStrat", + }, + ], + "formatauditrecids": false, + "isfavorite": true, + "name": "Collection Object using \\"Paleocene\\"", + "ordinal": 32767, + "selectdistinct": false, + "specifyuser": "/api/specify/specifyuser/2/", + }, + { + "_tableName": "SpQuery", + "contextname": "CollectionObject", + "contexttableid": 1, + "countonly": false, + "fields": [ + { + "_tableName": "SpQueryField", + "fieldname": "catalogNumber", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1.collectionobject.catalogNumber", + "tablelist": "1", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 1, + "startvalue": "", + "stringid": "1,9-determinations,4.taxon.fullName", + "tablelist": "1,9-determinations,4", + }, + { + "_tableName": "SpQueryField", + "fieldname": "isCurrent", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 13, + "sorttype": 0, + "startvalue": "", + "stringid": "1,9-determinations.determination.isCurrent", + "tablelist": "1,9-determinations", + }, + { + "_tableName": "SpQueryField", + "fieldname": "fullName", + "isdisplay": true, + "isnot": false, + "isrelfld": false, + "operstart": 8, + "sorttype": 0, + "startvalue": "", + "stringid": "1,32,100.lithostrat.fullName", + "tablelist": "1,32,100", + }, + { + "_tableName": "SpQueryField", + "fieldname": "Formation ID", + "isdisplay": false, + "isnot": false, + "isrelfld": false, + "operstart": 1, + "sorttype": 0, + "startvalue": "16", + "stringid": "1,32,100.lithostrat.Formation ID", + "tablelist": "1,32,100", + }, + ], + "formatauditrecids": false, + "isfavorite": true, + "name": "Collection Object using \\"Cretaceous\\"", + "ordinal": 32767, + "selectdistinct": false, + "specifyuser": "/api/specify/specifyuser/2/", + }, +] +`; diff --git a/specifyweb/frontend/js_src/lib/components/InitialContext/__tests__/treeRanks.test.ts b/specifyweb/frontend/js_src/lib/components/InitialContext/__tests__/treeRanks.test.ts index 3d67c24c04c..0d778d27776 100644 --- a/specifyweb/frontend/js_src/lib/components/InitialContext/__tests__/treeRanks.test.ts +++ b/specifyweb/frontend/js_src/lib/components/InitialContext/__tests__/treeRanks.test.ts @@ -1,8 +1,8 @@ import { requireContext } from '../../../tests/helpers'; import { theories } from '../../../tests/utils'; import { tables } from '../../DataModel/tables'; +import { testingTrees } from '../../QueryBuilder/__tests__/fromTree.test'; import { - allTrees, exportsForTests, getDisciplineTrees, getTreeDefinitionItems, @@ -66,8 +66,9 @@ describe('strictGetTreeDefinitionItems', () => { }); test('getTreeScope', () => - expect(Object.fromEntries(allTrees.map((tree) => [tree, getTreeScope(tree)]))) - .toMatchInlineSnapshot(` + expect( + Object.fromEntries(testingTrees.map((tree) => [tree, getTreeScope(tree)])) + ).toMatchInlineSnapshot(` { "Geography": "discipline", "GeologicTimePeriod": "discipline", diff --git a/specifyweb/frontend/js_src/lib/components/InitialContext/remotePrefs.ts b/specifyweb/frontend/js_src/lib/components/InitialContext/remotePrefs.ts index c9fdd21a35d..d90d72ad737 100644 --- a/specifyweb/frontend/js_src/lib/components/InitialContext/remotePrefs.ts +++ b/specifyweb/frontend/js_src/lib/components/InitialContext/remotePrefs.ts @@ -156,6 +156,12 @@ export const remotePrefsDefinitions = f.store( formatters: [formatter.trim], isLegacy: true, }, + 'TectonicUnit.treeview_sort_field': { + description: 'Sort order for nodes in the tree viewer', + defaultValue: 'name', + formatters: [formatter.trim], + isLegacy: true, + }, 'TreeEditor.Rank.Threshold.GeologicTimePeriod': { description: 'Show Collection Object count only for nodes with RankID >= than this value', @@ -191,6 +197,13 @@ export const remotePrefsDefinitions = f.store( parser: 'java.lang.Long', isLegacy: true, }, + 'TreeEditor.Rank.Threshold.TectonicUnit': { + description: + 'Show Collection Object count only for nodes with RankID >= than this value', + defaultValue: 99_999, + parser: 'java.lang.Long', + isLegacy: true, + }, /* * This pref was implemented in Specify 7 in https://github.com/specify/specify7/pull/2818 @@ -266,6 +279,12 @@ export const remotePrefsDefinitions = f.store( parser: 'java.lang.Boolean', isLegacy: false, }, + 'sp7.allow_adding_child_to_synonymized_parent.TectonicUnit': { + description: 'Allowed to add children to synopsized TectonicUnit records', + defaultValue: false, + parser: 'java.lang.Boolean', + isLegacy: false, + }, // This is actually stored in Global Prefs: /* * 'AUDIT_LIFESPAN_MONTHS': { diff --git a/specifyweb/frontend/js_src/lib/components/InitialContext/treeRanks.ts b/specifyweb/frontend/js_src/lib/components/InitialContext/treeRanks.ts index 29c84c9da1c..3ded51fad8d 100644 --- a/specifyweb/frontend/js_src/lib/components/InitialContext/treeRanks.ts +++ b/specifyweb/frontend/js_src/lib/components/InitialContext/treeRanks.ts @@ -39,7 +39,8 @@ let treeDefinitions: TreeInformation = undefined!; */ const commonTrees = ['Geography', 'Storage', 'Taxon'] as const; const treesForPaleo = ['GeologicTimePeriod', 'LithoStrat'] as const; -export const allTrees = [...commonTrees, ...treesForPaleo] as const; +const treesForGeo = ['TectonicUnit'] as const; +export const allTrees = [...commonTrees, ...treesForPaleo, ...treesForGeo] as const; /* * Until discipline information is loaded, assume all trees are appropriate in * this discipline diff --git a/specifyweb/frontend/js_src/lib/components/Permissions/definitions.ts b/specifyweb/frontend/js_src/lib/components/Permissions/definitions.ts index 24db5e23b60..68bca10b572 100644 --- a/specifyweb/frontend/js_src/lib/components/Permissions/definitions.ts +++ b/specifyweb/frontend/js_src/lib/components/Permissions/definitions.ts @@ -66,6 +66,13 @@ export const operationPolicies = { 'repair', ], '/tree/edit/taxon': ['merge', 'move', 'synonymize', 'desynonymize', 'repair'], + '/tree/edit/tectonicunit': [ + 'merge', + 'move', + 'synonymize', + 'desynonymize', + 'repair', + ], '/workbench/dataset': [ 'create', 'update', diff --git a/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx b/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx index 973a772d447..328e786e3be 100644 --- a/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx +++ b/specifyweb/frontend/js_src/lib/components/Preferences/UserDefinitions.tsx @@ -1492,6 +1492,27 @@ export const userPreferenceDefinitions = { }), }, }, + tectonicUnit: { + title: '_TectonicUnit' as LocalizedString, + items: { + treeAccentColor: definePref({ + title: preferencesText.treeAccentColor(), + requiresReload: false, + visible: true, + defaultValue: '#f79245', + renderer: ColorPickerPreferenceItem, + container: 'label', + }), + synonymColor: definePref({ + title: preferencesText.synonymColor(), + requiresReload: false, + visible: true, + defaultValue: '#dc2626', + renderer: ColorPickerPreferenceItem, + container: 'label', + }), + }, + }, }, }, queryBuilder: { @@ -2006,6 +2027,11 @@ import('../DataModel/tables') 'title', getField(tables.LithoStrat, 'name').label ); + overwriteReadOnly( + trees.tectonicUnit, + 'title', + getField(tables.TectonicUnit, 'name').label + ); overwriteReadOnly( userPreferenceDefinitions.form.subCategories.recordSet, 'title', diff --git a/specifyweb/frontend/js_src/lib/components/QueryBuilder/__tests__/fromTree.test.ts b/specifyweb/frontend/js_src/lib/components/QueryBuilder/__tests__/fromTree.test.ts index 4f96cf30e7d..5728643ee5d 100644 --- a/specifyweb/frontend/js_src/lib/components/QueryBuilder/__tests__/fromTree.test.ts +++ b/specifyweb/frontend/js_src/lib/components/QueryBuilder/__tests__/fromTree.test.ts @@ -21,13 +21,17 @@ const fullNames = { GeologicTimePeriod: 'Paleocene', LithoStrat: 'Cretaceous', }; -allTrees.map((table, rankId) => { + +// TODO: Add static data for Tectonic Unit and replace ALL testingTrees usages with allTrees +export const testingTrees = allTrees.filter((t) => t !== 'TectonicUnit'); +testingTrees.map((table, rankId) => { const nodeId = rankId * 4; const rankUrl = getResourceApiUrl(`${table}TreeDefItem`, rankId); overrideAjax(getResourceApiUrl(table, nodeId), () => addMissingFields(table, { id: nodeId, definitionItem: rankUrl, + // @ts-expect-error Remove error suppress after adding static data for TectonicUnit fullName: fullNames[table], resource_uri: getResourceApiUrl(table, nodeId), }) @@ -35,6 +39,7 @@ allTrees.map((table, rankId) => { overrideAjax(rankUrl, () => addMissingFields(`${table}TreeDefItem`, { id: rankId, + // @ts-expect-error Remove error suppress after adding static data for TectonicUnit name: rankNames[table], resource_uri: rankUrl, }) @@ -44,6 +49,7 @@ allTrees.map((table, rankId) => { test('queryFromTree', async () => expect( Promise.all( - allTrees.map(async (tree, index) => queryFromTree(tree, index * 4)) + // TODO: Add static data for Tectonic Unit and replace testingTrees with allTrees + testingTrees.map(async (tree, index) => queryFromTree(tree, index * 4)) ) ).resolves.toMatchSnapshot()); diff --git a/specifyweb/frontend/js_src/lib/components/QueryBuilder/fromTree.ts b/specifyweb/frontend/js_src/lib/components/QueryBuilder/fromTree.ts index fe93ffb1147..5b04dea474b 100644 --- a/specifyweb/frontend/js_src/lib/components/QueryBuilder/fromTree.ts +++ b/specifyweb/frontend/js_src/lib/components/QueryBuilder/fromTree.ts @@ -152,6 +152,17 @@ const defaultFields: RR< : []), ]; }, + TectonicUnit: async (_nodeId, _rankName) => { + // TODO: Fields below are a placeholder. Remove once we determine the requirements for querying Tectonic trees + return [ + makeField('catalogNumber', {}), + makeField('determinations.taxon.fullName', {}), + makeField('determinations.isCurrent', { + isDisplay: false, + operStart: queryFieldFilters.trueOrNull.id, + }), + ]; + }, }; async function fetchPaleoPath(): Promise { diff --git a/specifyweb/frontend/js_src/lib/components/TreeView/Tree.tsx b/specifyweb/frontend/js_src/lib/components/TreeView/Tree.tsx index 3cefb2a34b5..bec182f9eca 100644 --- a/specifyweb/frontend/js_src/lib/components/TreeView/Tree.tsx +++ b/specifyweb/frontend/js_src/lib/components/TreeView/Tree.tsx @@ -31,6 +31,7 @@ const treeToPref = { Storage: 'storage', GeologicTimePeriod: 'geologicTimePeriod', LithoStrat: 'lithoStrat', + TectonicUnit: 'tectonicUnit' } as const; export function Tree< diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 5e368798475..4c5c2c0e02b 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -2992,6 +2992,7 @@ Relationship(name='taxonTreeDef', type='many-to-one',required=False, relatedModelName='TaxonTreeDef', column='TaxonTreeDefID', otherSideName='disciplines'), Relationship(name='geologicTimePeriodTreeDef', type='many-to-one',required=True, relatedModelName='GeologicTimePeriodTreeDef', column='GeologicTimePeriodTreeDefID', otherSideName='disciplines'), Relationship(name='lithoStratTreeDef', type='many-to-one',required=False, relatedModelName='LithoStratTreeDef', column='LithoStratTreeDefID', otherSideName='disciplines'), + Relationship(name='tectonicUnitTreeDef', type='many-to-one',required=False, relatedModelName='TectonicUnitTreeDef', column='TectonicUnitTreeDefID', otherSideName='disciplines'), Relationship(name='modifiedByAgent', type='many-to-one',required=False, relatedModelName='Agent', column='ModifiedByAgentID'), Relationship(name='numberingSchemes', type='many-to-many',required=False, relatedModelName='AutoNumberingScheme', otherSideName='disciplines'), Relationship(name='spExportSchemas', type='one-to-many',required=False, relatedModelName='SpExportSchema', otherSideName='discipline'), @@ -8608,7 +8609,9 @@ relationships=[ Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='discipline', type='many-to-one', column='DisciplineID',required=True, relatedModelName='Discipline', otherSideName='tectonicUnitTreeDefs'), - Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID') + Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), + Relationship(name='treeDefItems', type='one-to-many',required=False, relatedModelName='TectonicUnitTreeDefItem', otherSideName='treeDef', dependent=True), + Relationship(name='treeEntries', type='one-to-many',required=False, relatedModelName='TectonicUnit', otherSideName='definition') ], fieldAliases=[ @@ -8628,7 +8631,7 @@ Field(name='isEnforced', column='IsEnforced', indexed=False, unique=False, required=False, type='java.lang.Boolean'), Field(name='isInFullName', column='IsInFullName', indexed=False, unique=False, required=False, type='java.lang.Boolean'), Field(name='name', column='Name', indexed=False, unique=False, required=True, type='java.lang.String', length=255), - Field(name='rankId', column='RankID', indexed=False, unique=False, required=False, type='java.lang.Integer'), + Field(name='rankId', column='RankID', indexed=False, unique=False, required=True, type='java.lang.Integer'), Field(name='remarks', column='Remarks', indexed=False, unique=False, required=False, type='text'), Field(name='textAfter', column='TextAfter', indexed=False, unique=False, required=False, type='java.lang.String', length=255), Field(name='textBefore', column='TextBefore', indexed=False, unique=False, required=False, type='java.lang.String', length=255), @@ -8641,13 +8644,13 @@ ], relationships=[ - Relationship(name='children', type='one-to-many',required=False, relatedModelName='TectonicUnitTreeDefItem', otherSideName='parentitem'), + Relationship(name='children', type='one-to-many',required=False, relatedModelName='TectonicUnitTreeDefItem', otherSideName='parent'), Relationship(name='createdbyagent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), - Relationship(name='parentItem', type='many-to-one', required=False, relatedModelName='TectonicUnitTreeDefItem', column='ParentItemID', otherSideName='children'), - Relationship(name='tectonicUnitTreeDef', type='many-to-one', required=True, relatedModelName='TectonicUnitTreeDef', column='TectonicUnitTreeDefID', - otherSideName='tectonicUnitTreeDefItems'), - Relationship(name='tectonicUnits', type='one-to-many',required=False, relatedModelName='TectonicUnit', otherSideName='definitionItem') + Relationship(name='parent', type='many-to-one', required=False, relatedModelName='TectonicUnitTreeDefItem', column='ParentItemID', otherSideName='children'), + Relationship(name='treeDef', type='many-to-one', required=True, relatedModelName='TectonicUnitTreeDef', column='TectonicUnitTreeDefID', + otherSideName='treeDefItems'), + Relationship(name='treeEntries', type='one-to-many',required=False, relatedModelName='TectonicUnit', otherSideName='definitionItem') ], fieldAliases=[ @@ -8685,12 +8688,13 @@ ], relationships=[ - Relationship(name='acceptedTectonicUnit', type='many-to-one', required=False, relatedModelName='TectonicUnit', column='AcceptedID'), + Relationship(name='acceptedChildren', type='one-to-many',required=False, relatedModelName='TectonicUnit', otherSideName='acceptedTectonicUnit'), + Relationship(name='acceptedTectonicUnit', type='many-to-one', required=False, relatedModelName='TectonicUnit', column='AcceptedID', otherSideName='acceptedChildren'), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), - Relationship(name='parent', type='many-to-one', required=False, relatedModelName='TectonicUnit', column='ParentID'), - Relationship(name='tectonicUnitTreeDef', type='many-to-one', required=True, relatedModelName='TectonicUnitTreeDef', column='TectonicUnitTreeDefID', otherSideName='tectonicUnits'), - Relationship(name='tectonicUnitTreeDefItem', type='many-to-one', required=True, relatedModelName='TectonicUnitTreeDefItem', column='TectonicUnitTreeDefItemID', otherSideName='tectonicUnits'), + Relationship(name='parent', type='many-to-one', required=True, relatedModelName='TectonicUnit', column='ParentID'), + Relationship(name='definition', type='many-to-one', required=True, relatedModelName='TectonicUnitTreeDef', column='TectonicUnitTreeDefID', otherSideName='treeEntries'), + Relationship(name='definitionItem', type='many-to-one', required=True, relatedModelName='TectonicUnitTreeDefItem', column='TectonicUnitTreeDefItemID', otherSideName='treeEntries'), ], fieldAliases=[ diff --git a/specifyweb/specify/migrations/0002_geo.py b/specifyweb/specify/migrations/0002_geo.py index a6d2c9492ee..0d93570da0e 100644 --- a/specifyweb/specify/migrations/0002_geo.py +++ b/specifyweb/specify/migrations/0002_geo.py @@ -5,15 +5,7 @@ import django.utils.timezone from specifyweb.businessrules.exceptions import BusinessRuleException from specifyweb.specify.models import ( - protect_with_blockers, - Collectionobject, - Collectionobjecttype, - Collection, - Discipline, - Institution, - Picklist, - Picklistitem, - Taxontreedef + protect_with_blockers ) from specifyweb.specify.update_schema_config import ( update_table_schema_config_with_defaults, @@ -57,7 +49,10 @@ 'Drill Core', ] -def create_default_collection_types(): +def create_default_collection_types(apps): + Collection = apps.get_model('specify', 'Collection') + Collectionobject = apps.get_model('specify', 'Collectionobject') + Collectionobjecttype = apps.get_model('specify', 'Collectionobjecttype') # Create default collection types for each collection, named after the discipline for collection in Collection.objects.all(): discipline = collection.discipline @@ -84,15 +79,18 @@ def create_default_collection_types(): collection.save() continue -def revert_default_collection_types(): +def revert_default_collection_types(apps): # Reverse handeled by table deletion. pass -def revert_default_cog_types(): +def revert_default_cog_types(apps): # Reverse handeled by table deletion pass -def create_default_discipline_for_tree_defs(): +def create_default_discipline_for_tree_defs(apps): + Discipline = apps.get_model('specify', 'Discipline') + Institution = apps.get_model('specify', 'Institution') + for discipline in Discipline.objects.all(): geography_tree_def = discipline.geographytreedef geography_tree_def.discipline = discipline @@ -115,20 +113,25 @@ def create_default_discipline_for_tree_defs(): storage_tree_def.institution = institution storage_tree_def.save() -def revert_default_discipline_for_tree_defs(): +def revert_default_discipline_for_tree_defs(apps): # Reverse handeled by table deletion pass -def create_table_schema_config_with_defaults(): +def create_table_schema_config_with_defaults(apps): + Discipline = apps.get_model('specify', 'Discipline') for discipline in Discipline.objects.all(): for table, desc in SCHEMA_CONFIG_TABLES: update_table_schema_config_with_defaults(table, discipline.id, discipline, desc) -def revert_table_schema_config_with_defaults(): +def revert_table_schema_config_with_defaults(apps): for table, _ in SCHEMA_CONFIG_TABLES: revert_table_schema_config(table) -def create_default_collection_object_types(): +def create_default_collection_object_types(apps): + Collection = apps.get_model('specify', 'Collection') + Picklist = apps.get_model('specify', 'Picklist') + Picklistitem = apps.get_model('specify', 'Picklistitem') + for collection in Collection.objects.all(): cog_type_picklist = Picklist.objects.create( name='Default Collection Object Group Types', @@ -144,7 +147,11 @@ def create_default_collection_object_types(): picklist=cog_type_picklist ) -def revert_default_collection_object_types(): +def revert_default_collection_object_types(apps): + Collection = apps.get_model('specify', 'Collection') + Picklist = apps.get_model('specify', 'Picklist') + Picklistitem = apps.get_model('specify', 'Picklistitem') + for collection in Collection.objects.all(): cog_type_picklist_qs = Picklist.objects.filter( name='Default Collection Object Group Types', @@ -155,7 +162,10 @@ def revert_default_collection_object_types(): Picklistitem.objects.filter(picklist=cog_type_picklist).delete() cog_type_picklist.delete() -def set_discipline_for_taxon_treedefs(): +def set_discipline_for_taxon_treedefs(apps): + Collectionobjecttype = apps.get_model('specify', 'Collectionobjecttype') + Taxontreedef = apps.get_model('specify', 'Taxontreedef') + collection_object_types = Collectionobjecttype.objects.filter( taxontreedef__discipline__isnull=True ).annotate( @@ -174,17 +184,17 @@ class Migration(migrations.Migration): ] def consolidated_python_django_migration_operations(apps, schema_editor): - create_default_collection_types() - create_default_discipline_for_tree_defs() - create_table_schema_config_with_defaults() - create_default_collection_object_types() - set_discipline_for_taxon_treedefs() + create_default_collection_types(apps) + create_default_discipline_for_tree_defs(apps) + create_table_schema_config_with_defaults(apps) + create_default_collection_object_types(apps) + set_discipline_for_taxon_treedefs(apps) def revert_cosolidated_python_django_migration_operations(apps, schema_editor): - revert_default_collection_object_types() - revert_table_schema_config_with_defaults() - revert_default_discipline_for_tree_defs() - revert_default_collection_types() + revert_default_collection_object_types(apps) + revert_table_schema_config_with_defaults(apps) + revert_default_discipline_for_tree_defs(apps) + revert_default_collection_types(apps) operations = [ migrations.CreateModel( diff --git a/specifyweb/specify/migrations/0006_fix_tectonic_tree_fields.py b/specifyweb/specify/migrations/0006_fix_tectonic_tree_fields.py new file mode 100644 index 00000000000..40ceee06aa2 --- /dev/null +++ b/specifyweb/specify/migrations/0006_fix_tectonic_tree_fields.py @@ -0,0 +1,111 @@ +# Generated by Django 3.2.15 on 2024-10-09 14:58 + +from django.db import migrations, models +import specifyweb.specify.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('specify', '0005_collectionobjectgroup_parentcojo'), + ] + + operations = [ + migrations.RenameField( + model_name='tectonicunittreedefitem', + old_name='parentitem', + new_name='parent', + ), + migrations.RemoveField( + model_name='tectonicunit', + name='tectonicunittreedef', + ), + migrations.RemoveField( + model_name='tectonicunit', + name='tectonicunittreedefitem', + ), + migrations.RemoveField( + model_name='tectonicunittreedefitem', + name='tectonicunittreedef', + ), + migrations.AddField( + model_name='tectonicunit', + name='definition', + field=models.ForeignKey(db_column='TectonicUnitTreeDefID', null=True, on_delete=specifyweb.specify.models.protect_with_blockers, related_name='treeentries', to='specify.tectonicunittreedef'), + ), + migrations.AddField( + model_name='tectonicunit', + name='definitionitem', + field=models.ForeignKey(db_column='TectonicUnitTreeDefItemID', null=True, on_delete=specifyweb.specify.models.protect_with_blockers, related_name='treeentries', to='specify.tectonicunittreedefitem'), + ), + migrations.AddField( + model_name='tectonicunittreedefitem', + name='treedef', + field=models.ForeignKey(db_column='TectonicUnitTreeDefID', null=True, on_delete=specifyweb.specify.models.protect_with_blockers, related_name='treedefitems', to='specify.tectonicunittreedef'), + ), + migrations.AlterField( + model_name='absoluteageattachment', + name='id', + field=models.AutoField(db_column='absoluteageattachmentid', primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='absoluteagecitation', + name='id', + field=models.AutoField(db_column='absoluteagecitationid', primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='relativeage', + name='agename', + field=models.ForeignKey(db_column='AgeNameID', null=True, on_delete=specifyweb.specify.models.protect_with_blockers, related_name='agename', to='specify.geologictimeperiod'), + ), + migrations.AlterField( + model_name='relativeage', + name='agenameend', + field=models.ForeignKey(db_column='AgeNameEndID', null=True, on_delete=specifyweb.specify.models.protect_with_blockers, related_name='agenameend', to='specify.geologictimeperiod'), + ), + migrations.AlterField( + model_name='relativeage', + name='id', + field=models.AutoField(db_column='relativeageid', primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='relativeageattachment', + name='id', + field=models.AutoField(db_column='relativeageattachmentid', primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='relativeagecitation', + name='id', + field=models.AutoField(db_column='relativeagecitationid', primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='tectonicunit', + name='acceptedtectonicunit', + field=models.ForeignKey(db_column='AcceptedID', null=True, on_delete=specifyweb.specify.models.protect_with_blockers, related_name='acceptedchildren', to='specify.tectonicunit'), + ), + migrations.AlterField( + model_name='tectonicunit', + name='id', + field=models.AutoField(db_column='tectonicunitid', primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='tectonicunittreedef', + name='discipline', + field=models.ForeignKey(db_column='DisciplineID', null=True, on_delete=specifyweb.specify.models.protect_with_blockers, related_name='tectonicunittreedefs', to='specify.discipline'), + ), + migrations.AlterField( + model_name='tectonicunittreedef', + name='fullnamedirection', + field=models.IntegerField(blank=True, db_column='FullNameDirection', default=0, null=True), + ), + migrations.AlterField( + model_name='tectonicunittreedef', + name='id', + field=models.AutoField(db_column='tectonicunittreedefid', primary_key=True, serialize=False), + ), + migrations.AlterField( + model_name='tectonicunittreedefitem', + name='id', + field=models.AutoField(db_column='tectonicunittreedefitemid', primary_key=True, serialize=False), + ), + ] diff --git a/specifyweb/specify/model_extras.py b/specifyweb/specify/model_extras.py index 82c1492fa84..17e02b5219e 100644 --- a/specifyweb/specify/model_extras.py +++ b/specifyweb/specify/model_extras.py @@ -173,6 +173,10 @@ class Lithostrat(Tree): class Meta: abstract = True +class Tectonicunit(Tree): + class Meta: + abstract = True + class Geographytreedefitem(TreeRank): class Meta: abstract = True @@ -192,3 +196,7 @@ class Meta: class Taxontreedefitem(TreeRank): class Meta: abstract = True + +class Tectonicunittreedefitem(TreeRank): + class Meta: + abstract = True diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index 96a40ab312c..2372009f2ec 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -2825,6 +2825,7 @@ class Discipline(model_extras.Discipline): taxontreedef = models.ForeignKey('TaxonTreeDef', db_column='TaxonTreeDefID', related_name='disciplines', null=True, on_delete=protect_with_blockers) geologictimeperiodtreedef = models.ForeignKey('GeologicTimePeriodTreeDef', db_column='GeologicTimePeriodTreeDefID', related_name='disciplines', null=False, on_delete=protect_with_blockers) lithostrattreedef = models.ForeignKey('LithoStratTreeDef', db_column='LithoStratTreeDefID', related_name='disciplines', null=True, on_delete=protect_with_blockers) + tectonicunittreedef = models.ForeignKey('TectonicUnitTreeDef', db_column='TectonicUnitTreeDefID', related_name='disciplines', null=True, on_delete=protect_with_blockers) modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) class Meta: @@ -7620,7 +7621,7 @@ class AbsoluteAge(models.Model): specify_model = datamodel.get_table('absoluteage') # ID Field - id = models.AutoField(primary_key=True, db_column='absoluteageid') + id = models.AutoField(db_column='AbsoluteAgeID', primary_key=True, serialize=False) # Fields absoluteage = models.DecimalField(blank=True, max_digits=22, decimal_places=10, null=True, unique=False, db_column='AbsoluteAge', db_index=False) @@ -7644,6 +7645,9 @@ class AbsoluteAge(models.Model): # Relationships: Many-to-One agent1 = models.ForeignKey('Agent', db_column='Agent1ID', related_name='+', null=True, on_delete=protect_with_blockers) collectionobject = models.ForeignKey('CollectionObject', db_column='CollectionObjectID', related_name='absoluteages', null=False, on_delete=models.CASCADE) + absoluteageattachment = models.ForeignKey(db_column='AbsoluteAgeAttachmentID', null=True, on_delete=protect_with_blockers, related_name='absoluteages', to='specify.absoluteageattachment') + createdbyagent = models.ForeignKey(db_column='CreatedByAgentID', null=True, on_delete=protect_with_blockers, related_name='+', to='specify.agent') + modifiedbyagent = models.ForeignKey(db_column='ModifiedByAgentID', null=True, on_delete=protect_with_blockers, related_name='+', to='specify.agent') class Meta: db_table = 'absoluteage' @@ -7684,6 +7688,9 @@ class RelativeAge(models.Model): agent1 = models.ForeignKey('Agent', db_column='Agent1ID', related_name='+', null=True, on_delete=protect_with_blockers) agent2 = models.ForeignKey('Agent', db_column='Agent2ID', related_name='+', null=True, on_delete=protect_with_blockers) collectionobject = models.ForeignKey('CollectionObject', db_column='CollectionObjectID', related_name='relativeages', null=False, on_delete=models.CASCADE) + relativeageattachment = models.ForeignKey(db_column='RelativeAgeAttachmentID', null=True, on_delete=protect_with_blockers, related_name='relativeages', to='specify.relativeageattachment') + createdbyagent = models.ForeignKey(db_column='CreatedByAgentID', null=True, on_delete=protect_with_blockers, related_name='+', to='specify.agent') + modifiedbyagent = models.ForeignKey(db_column='ModifiedByAgentID', null=True, on_delete=protect_with_blockers, related_name='+', to='specify.agent') class Meta: db_table = 'relativeage' @@ -7801,7 +7808,7 @@ class Meta: save = partialmethod(custom_save) -class TectonicUnitTreeDef(models.Model): +class Tectonicunittreedef(models.Model): specify_model = datamodel.get_table('tectonicunittreedef') # ID Field @@ -7826,7 +7833,7 @@ class Meta: save = partialmethod(custom_save) -class TectonicUnitTreeDefItem(models.Model): +class Tectonicunittreedefitem(model_extras.Tectonicunittreedefitem): specify_model = datamodel.get_table('tectonicUnittreedefitem') # ID Field @@ -7849,8 +7856,8 @@ class TectonicUnitTreeDefItem(models.Model): # Relationships: Many-to-One createdbyagent = models.ForeignKey('Agent', db_column='CreatedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) - parentitem = models.ForeignKey('TectonicUnitTreeDefItem', db_column='ParentItemID', related_name='children', null=True, on_delete=protect_with_blockers) - tectonicunittreedef = models.ForeignKey('TectonicUnitTreeDef', db_column='TectonicUnitTreeDefID', related_name='tectonicunittreedefitems', null=False, on_delete=protect_with_blockers) + parent = models.ForeignKey('TectonicUnitTreeDefItem', db_column='ParentItemID', related_name='children', null=True, on_delete=protect_with_blockers) + treedef = models.ForeignKey('TectonicUnitTreeDef', db_column='TectonicUnitTreeDefID', related_name='treedefitems', null=True, on_delete=protect_with_blockers) class Meta: db_table = 'tectonicunittreedefitem' @@ -7858,7 +7865,7 @@ class Meta: save = partialmethod(custom_save) -class TectonicUnit(models.Model): +class Tectonicunit(model_extras.Tectonicunit): specify_model = datamodel.get_table('tectonicunit') # ID Field @@ -7885,9 +7892,9 @@ class TectonicUnit(models.Model): # Relationships: Many-to-One acceptedtectonicunit = models.ForeignKey('TectonicUnit', db_column='AcceptedID', related_name='acceptedchildren', null=True, on_delete=protect_with_blockers) - tectonicunittreedefitem = models.ForeignKey('TectonicUnitTreeDefItem', db_column='TectonicUnitTreeDefItemID', related_name='tectonicunits', null=False, on_delete=protect_with_blockers) + definitionitem = models.ForeignKey('TectonicUnitTreeDefItem', db_column='TectonicUnitTreeDefItemID', related_name='treeentries', null=True, on_delete=protect_with_blockers) parent = models.ForeignKey('TectonicUnit', db_column='ParentID', related_name='children', null=True, on_delete=protect_with_blockers) - tectonicunittreedef = models.ForeignKey('TectonicUnitTreeDef', db_column='TectonicUnitTreeDefID', related_name='tectonicunits', null=False, on_delete=protect_with_blockers) + definition = models.ForeignKey('TectonicUnitTreeDef', db_column='TectonicUnitTreeDefID', related_name='treeentries', null=True, on_delete=protect_with_blockers) createdbyagent = models.ForeignKey('Agent', db_column='CreatedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) diff --git a/specifyweb/specify/tree_views.py b/specifyweb/specify/tree_views.py index 41eca5b1c82..55c0436aaf9 100644 --- a/specifyweb/specify/tree_views.py +++ b/specifyweb/specify/tree_views.py @@ -28,8 +28,10 @@ TREE_TABLE = Literal['Taxon', 'Storage', 'Geography', 'Geologictimeperiod', 'Lithostrat'] +GEO_TREES: Tuple[TREE_TABLE, ...] = ['Tectonicunit'] + COMMON_TREES: Tuple[TREE_TABLE, ...] = ['Taxon', 'Storage', - 'Geography'] + 'Geography', *GEO_TREES] ALL_TRESS: Tuple[TREE_TABLE, ...] = [ *COMMON_TREES, 'Geologictimeperiod', 'Lithostrat'] @@ -522,6 +524,15 @@ class LithostratMutationPT(PermissionTarget): repair = PermissionTargetAction() +class TectonicUnitMutationPT(PermissionTarget): + resource = "/tree/edit/tectonicunit" + merge = PermissionTargetAction() + move = PermissionTargetAction() + synonymize = PermissionTargetAction() + desynonymize = PermissionTargetAction() + repair = PermissionTargetAction() + + def perm_target(tree): return { 'taxon': TaxonMutationPT, @@ -529,4 +540,5 @@ def perm_target(tree): 'storage': StorageMutationPT, 'geologictimeperiod': GeologictimeperiodMutationPT, 'lithostrat': LithostratMutationPT, + 'tectonicunit': TectonicUnitMutationPT }[tree] From b37b222a7bb7d4bed4d63ce3064c1ad4e15a9ce2 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Thu, 17 Oct 2024 10:25:03 -0400 Subject: [PATCH 29/47] Fix migration order --- .../js_src/lib/components/DataModel/types.ts | 152 +++++++------ .../migrations/0007_schema_config_update.py | 200 ++++++++++++++++++ 2 files changed, 275 insertions(+), 77 deletions(-) create mode 100644 specifyweb/specify/migrations/0007_schema_config_update.py diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 61997910389..d67895d3129 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -242,20 +242,20 @@ export type Tables = { export type Accession = { readonly tableName: 'Accession'; readonly fields: { - readonly accessionCondition: string | null; readonly accessionNumber: string; + readonly accessionCondition: string | null; + readonly dateAccessioned: string | null; readonly actualTotalCountAmt: number | null; readonly collectionObjectCount: number | null; - readonly dateAccessioned: string | null; readonly dateAcknowledged: string | null; - readonly dateReceived: string | null; + readonly remarks: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; readonly number1: number | null; readonly number2: number | null; readonly preparationCount: number | null; - readonly remarks: string | null; + readonly dateReceived: string | null; readonly status: string | null; readonly text1: string | null; readonly text2: string | null; @@ -461,10 +461,10 @@ export type Agent = { readonly initials: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly interests: string | null; readonly jobTitle: string | null; readonly lastName: string | null; readonly middleInitial: string | null; + readonly interests: string | null; readonly remarks: string | null; readonly suffix: string | null; readonly text1: string | null; @@ -497,8 +497,8 @@ export type Agent = { readonly agentAttachments: RA; readonly agentGeographies: RA; readonly agentSpecialties: RA; - readonly groups: RA; readonly identifiers: RA; + readonly groups: RA; readonly variants: RA; }; readonly toManyIndependent: { @@ -929,13 +929,13 @@ export type BorrowMaterial = { readonly tableName: 'BorrowMaterial'; readonly fields: { readonly collectionMemberId: number; - readonly description: string | null; readonly inComments: string | null; readonly materialNumber: string; readonly outComments: string | null; readonly quantity: number | null; readonly quantityResolved: number | null; readonly quantityReturned: number | null; + readonly description: string | null; readonly text1: string | null; readonly text2: string | null; readonly timestampCreated: string; @@ -977,24 +977,22 @@ export type BorrowReturnMaterial = { export type CollectingEvent = { readonly tableName: 'CollectingEvent'; readonly fields: { - readonly verbatimDate: string | null; - readonly remarks: string | null; + readonly startDate: string | null; readonly endDate: string | null; readonly endDatePrecision: number | null; readonly endDateVerbatim: string | null; readonly endTime: number | null; + readonly stationFieldNumber: string | null; + readonly method: string | null; readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly stationFieldNumber: string | null; - readonly verbatimLocality: string | null; - readonly method: string | null; + readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; readonly reservedText1: string | null; readonly reservedText2: string | null; readonly sgrStatus: number | null; - readonly startDate: string | null; readonly startDatePrecision: number | null; readonly startDateVerbatim: string | null; readonly startTime: number | null; @@ -1012,6 +1010,8 @@ export type CollectingEvent = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; + readonly verbatimDate: string | null; + readonly verbatimLocality: string | null; readonly version: number | null; readonly visibility: number | null; }; @@ -1079,6 +1079,10 @@ export type CollectingEventAttr = { export type CollectingEventAttribute = { readonly tableName: 'CollectingEventAttribute'; readonly fields: { + readonly text8: string | null; + readonly text5: string | null; + readonly text4: string | null; + readonly text9: string | null; readonly integer1: number | null; readonly integer10: number | null; readonly integer2: number | null; @@ -1089,11 +1093,11 @@ export type CollectingEventAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; - readonly number12: number | null; - readonly number13: number | null; readonly number2: number | null; readonly number3: number | null; readonly number4: number | null; @@ -1103,26 +1107,22 @@ export type CollectingEventAttribute = { readonly number8: number | null; readonly number9: number | null; readonly remarks: string | null; + readonly text6: string | null; readonly text1: string | null; readonly text10: string | null; readonly text11: string | null; - readonly text12: string | null; readonly text13: string | null; readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; readonly text2: string | null; - readonly text3: string | null; - readonly text4: string | null; - readonly text5: string | null; - readonly text6: string | null; readonly text7: string | null; - readonly text8: string | null; - readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; + readonly text12: string | null; readonly version: number | null; + readonly text3: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -1163,6 +1163,7 @@ export type CollectingTrip = { readonly tableName: 'CollectingTrip'; readonly fields: { readonly cruise: string | null; + readonly text2: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly date2: string | null; @@ -1180,8 +1181,6 @@ export type CollectingTrip = { readonly startDatePrecision: number | null; readonly startDateVerbatim: string | null; readonly startTime: number | null; - readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -1193,6 +1192,7 @@ export type CollectingTrip = { readonly timestampModified: string | null; readonly collectingTripName: string | null; readonly version: number | null; + readonly text1: string | null; readonly vessel: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -1368,19 +1368,16 @@ export type Collection = { export type CollectionObject = { readonly tableName: 'CollectionObject'; readonly fields: { - readonly yesNo1: boolean | null; readonly actualTotalCountAmt: number | null; readonly age: number | null; - readonly altCatalogNumber: string | null; readonly availability: string | null; + readonly catalogNumber: string | null; readonly catalogedDate: string | null; readonly catalogedDatePrecision: number | null; readonly catalogedDateVerbatim: string | null; - readonly catalogNumber: string | null; - readonly remarks: string | null; readonly collectionMemberId: number; readonly countAmt: number | null; - readonly timestampCreated: string; + readonly reservedText: string | null; readonly timestampModified: string | null; readonly date1: string | null; readonly date1Precision: number | null; @@ -1393,10 +1390,9 @@ export type CollectionObject = { readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; + readonly text2: string | null; readonly inventoryDate: string | null; readonly inventoryDatePrecision: number | null; - readonly text2: string | null; - readonly fieldNumber: string | null; readonly modifier: string | null; readonly name: string | null; readonly notifications: string | null; @@ -1405,15 +1401,16 @@ export type CollectionObject = { readonly number2: number | null; readonly objectCondition: string | null; readonly ocr: string | null; - readonly text1: string | null; + readonly altCatalogNumber: string | null; readonly projectNumber: string | null; + readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; - readonly reservedText: string | null; readonly reservedText2: string | null; readonly reservedText3: string | null; readonly restrictions: string | null; readonly sgrStatus: number | null; + readonly text1: string | null; readonly description: string | null; readonly text3: string | null; readonly text4: string | null; @@ -1421,11 +1418,14 @@ export type CollectionObject = { readonly text6: string | null; readonly text7: string | null; readonly text8: string | null; + readonly timestampCreated: string; readonly totalCountAmt: number | null; readonly totalValue: number | null; readonly uniqueIdentifier: string | null; readonly version: number | null; readonly visibility: number | null; + readonly fieldNumber: string | null; + readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; @@ -1440,17 +1440,17 @@ export type CollectionObject = { readonly agent1: Agent | null; readonly appraisal: Appraisal | null; readonly cataloger: Agent | null; - readonly collectingEvent: CollectingEvent | null; readonly collection: Collection; readonly collectionObjectType: CollectionObjectType; readonly container: Container | null; readonly containerOwner: Container | null; readonly createdByAgent: Agent | null; readonly currentDetermination: Determination | null; + readonly modifiedByAgent: Agent | null; readonly embargoAuthority: Agent | null; + readonly collectingEvent: CollectingEvent | null; readonly fieldNotebookPage: FieldNotebookPage | null; readonly inventorizedBy: Agent | null; - readonly modifiedByAgent: Agent | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -1533,11 +1533,11 @@ export type CollectionObjectAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; - readonly number12: number | null; - readonly number13: number | null; readonly number14: number | null; readonly number15: number | null; readonly number16: number | null; @@ -1575,20 +1575,19 @@ export type CollectionObjectAttribute = { readonly number7: number | null; readonly number8: number | null; readonly number9: number | null; - readonly positionState: string | null; - readonly remarks: string | null; + readonly text13: string | null; + readonly text14: string | null; readonly text1: string | null; + readonly positionState: string | null; readonly text10: string | null; + readonly remarks: string | null; + readonly text8: string | null; readonly text11: string | null; - readonly text12: string | null; - readonly text13: string | null; - readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; readonly text18: string | null; readonly text19: string | null; - readonly text2: string | null; readonly text20: string | null; readonly text21: string | null; readonly text22: string | null; @@ -1615,12 +1614,13 @@ export type CollectionObjectAttribute = { readonly text5: string | null; readonly text6: string | null; readonly text7: string | null; - readonly text8: string | null; readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; + readonly text12: string | null; readonly topDistance: number | null; readonly version: number | null; + readonly text2: string | null; readonly yesNo1: boolean | null; readonly yesNo10: boolean | null; readonly yesNo11: boolean | null; @@ -1658,10 +1658,10 @@ export type CollectionObjectCitation = { readonly fields: { readonly collectionMemberId: number; readonly figureNumber: string | null; - readonly remarks: string | null; readonly isFigured: boolean | null; readonly pageNumber: string | null; readonly plateNumber: string | null; + readonly remarks: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly version: number | null; @@ -2194,7 +2194,9 @@ export type DNASequence = { readonly compT: number | null; readonly extractionDate: string | null; readonly extractionDatePrecision: number | null; + readonly text2: string | null; readonly genbankAccessionNumber: string | null; + readonly text1: string | null; readonly geneSequence: string | null; readonly moleculeType: string | null; readonly number1: number | null; @@ -2204,8 +2206,6 @@ export type DNASequence = { readonly sequenceDate: string | null; readonly sequenceDatePrecision: number | null; readonly targetMarker: string | null; - readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; @@ -2298,8 +2298,8 @@ export type DNASequencingRun = { readonly runByAgent: Agent | null; }; readonly toManyDependent: { - readonly attachments: RA; readonly citations: RA; + readonly attachments: RA; }; readonly toManyIndependent: RR; }; @@ -2461,11 +2461,13 @@ export type Determination = { readonly addendum: string | null; readonly alternateName: string | null; readonly collectionMemberId: number; + readonly confidence: string | null; readonly isCurrent: boolean; readonly determinedDate: string | null; readonly determinedDatePrecision: number | null; readonly featureOrBasis: string | null; readonly guid: string | null; + readonly yesNo1: boolean | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -2478,11 +2480,10 @@ export type Determination = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; - readonly text1: string | null; readonly qualifier: string | null; - readonly confidence: string | null; readonly remarks: string | null; readonly subSpQualifier: string | null; + readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -2495,7 +2496,6 @@ export type Determination = { readonly typeStatusName: string | null; readonly varQualifier: string | null; readonly version: number | null; - readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; @@ -2522,9 +2522,9 @@ export type DeterminationCitation = { readonly collectionMemberId: number; readonly figureNumber: string | null; readonly isFigured: boolean | null; - readonly remarks: string | null; readonly pageNumber: string | null; readonly plateNumber: string | null; + readonly remarks: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly version: number | null; @@ -3092,13 +3092,12 @@ export type FundingAgent = { export type GeoCoordDetail = { readonly tableName: 'GeoCoordDetail'; readonly fields: { - readonly validation: string | null; - readonly source: string | null; readonly errorPolygon: string | null; readonly geoRefAccuracy: number | null; readonly geoRefAccuracyUnits: string | null; readonly geoRefCompiledDate: string | null; readonly geoRefDetDate: string | null; + readonly geoRefDetRef: string | null; readonly geoRefRemarks: string | null; readonly geoRefVerificationStatus: string | null; readonly integer1: number | null; @@ -3117,7 +3116,7 @@ export type GeoCoordDetail = { readonly number5: number | null; readonly originalCoordSystem: string | null; readonly protocol: string | null; - readonly geoRefDetRef: string | null; + readonly source: string | null; readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; @@ -3126,6 +3125,7 @@ export type GeoCoordDetail = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly uncertaintyPolygon: string | null; + readonly validation: string | null; readonly version: number | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -3347,8 +3347,8 @@ export type Gift = { readonly srcTaxonomy: string | null; readonly specialConditions: string | null; readonly status: string | null; - readonly text1: string | null; readonly text2: string | null; + readonly text1: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3717,6 +3717,7 @@ export type Loan = { readonly dateClosed: string | null; readonly dateReceived: string | null; readonly yesNo1: boolean | null; + readonly text2: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -3738,7 +3739,6 @@ export type Loan = { readonly specialConditions: string | null; readonly status: string | null; readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3864,26 +3864,22 @@ export type LoanReturnPreparation = { export type Locality = { readonly tableName: 'Locality'; readonly fields: { - readonly timestampCreated: string; - readonly timestampModified: string | null; readonly datum: string | null; readonly elevationAccuracy: number | null; - readonly elevationMethod: string | null; readonly gml: string | null; readonly guid: string | null; readonly latLongMethod: string | null; readonly lat1text: string | null; readonly lat2text: string | null; + readonly latLongAccuracy: number | null; readonly latLongType: string | null; readonly latitude1: number | null; readonly latitude2: number | null; - readonly latLongAccuracy: number | null; readonly localityName: string; readonly long1text: string | null; readonly long2text: string | null; readonly longitude1: number | null; readonly longitude2: number | null; - readonly text1: string | null; readonly maxElevation: number | null; readonly minElevation: number | null; readonly namedPlace: string | null; @@ -3894,16 +3890,20 @@ export type Locality = { readonly sgrStatus: number | null; readonly shortName: string | null; readonly srcLatLongUnit: number; + readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; readonly verbatimElevation: string | null; readonly verbatimLatitude: string | null; readonly verbatimLongitude: string | null; readonly version: number | null; readonly visibility: number | null; + readonly elevationMethod: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -3976,6 +3976,7 @@ export type LocalityCitation = { export type LocalityDetail = { readonly tableName: 'LocalityDetail'; readonly fields: { + readonly baseMeridian: string | null; readonly drainage: string | null; readonly endDepth: number | null; readonly endDepthUnit: string | null; @@ -3984,7 +3985,6 @@ export type LocalityDetail = { readonly hucCode: string | null; readonly island: string | null; readonly islandGroup: string | null; - readonly text1: string | null; readonly mgrsZone: string | null; readonly nationalParkName: string | null; readonly number1: number | null; @@ -4001,7 +4001,7 @@ export type LocalityDetail = { readonly startDepth: number | null; readonly startDepthUnit: string | null; readonly startDepthVerbatim: string | null; - readonly baseMeridian: string | null; + readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -4178,7 +4178,6 @@ export type PaleoContext = { readonly tableName: 'PaleoContext'; readonly fields: { readonly text1: string | null; - readonly text2: string | null; readonly paleoContextName: string | null; readonly number1: number | null; readonly number2: number | null; @@ -4186,6 +4185,7 @@ export type PaleoContext = { readonly number4: number | null; readonly number5: number | null; readonly remarks: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -4384,7 +4384,6 @@ export type Preparation = { readonly date4Precision: number | null; readonly description: string | null; readonly guid: string | null; - readonly text1: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly isOnLoan: boolean | null; @@ -4402,7 +4401,6 @@ export type Preparation = { readonly text11: string | null; readonly text12: string | null; readonly text13: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -4412,8 +4410,10 @@ export type Preparation = { readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly version: number | null; + readonly text1: string | null; readonly yesNo1: boolean | null; + readonly version: number | null; + readonly text2: string | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; }; @@ -4790,7 +4790,10 @@ export type RecordSetItem = { export type ReferenceWork = { readonly tableName: 'ReferenceWork'; readonly fields: { + readonly text1: string | null; + readonly workDate: string | null; readonly doi: string | null; + readonly text2: string | null; readonly guid: string | null; readonly isPublished: boolean | null; readonly isbn: string | null; @@ -4801,8 +4804,6 @@ export type ReferenceWork = { readonly placeOfPublication: string | null; readonly publisher: string | null; readonly remarks: string | null; - readonly text1: string | null; - readonly text2: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly title: string; @@ -4811,7 +4812,6 @@ export type ReferenceWork = { readonly url: string | null; readonly version: number | null; readonly volume: string | null; - readonly workDate: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; }; @@ -4909,9 +4909,9 @@ export type RepositoryAgreementAttachment = { export type Shipment = { readonly tableName: 'Shipment'; readonly fields: { + readonly numberOfPackages: number | null; readonly insuredForAmount: string | null; readonly shipmentMethod: string | null; - readonly numberOfPackages: number | null; readonly number1: number | null; readonly number2: number | null; readonly remarks: string | null; @@ -5625,7 +5625,6 @@ export type Taxon = { readonly colStatus: string | null; readonly commonName: string | null; readonly cultivarName: string | null; - readonly environmentalProtectionStatus: string | null; readonly esaStatus: string | null; readonly fullName: string | null; readonly groupNumber: string | null; @@ -5649,6 +5648,7 @@ export type Taxon = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; + readonly environmentalProtectionStatus: string | null; readonly rankId: number; readonly remarks: string | null; readonly source: string | null; @@ -6771,7 +6771,7 @@ export type TectonicUnitTreeDefItem = { readonly toManyDependent: RR; readonly toManyIndependent: { readonly children: RA; - readonly tectonicUnits: RA; + readonly treeEntries: RA; }; }; export type TectonicUnit = { @@ -6802,9 +6802,7 @@ export type TectonicUnit = { readonly definition: TectonicUnitTreeDef; readonly definitionItem: TectonicUnitTreeDefItem; readonly modifiedByAgent: Agent | null; - readonly parent: TectonicUnit | null; - readonly tectonicUnitTreeDef: TectonicUnitTreeDef; - readonly tectonicUnitTreeDefItem: TectonicUnitTreeDefItem; + readonly parent: TectonicUnit; }; readonly toManyDependent: RR; readonly toManyIndependent: { readonly acceptedChildren: RA }; diff --git a/specifyweb/specify/migrations/0007_schema_config_update.py b/specifyweb/specify/migrations/0007_schema_config_update.py new file mode 100644 index 00000000000..25c37049dcd --- /dev/null +++ b/specifyweb/specify/migrations/0007_schema_config_update.py @@ -0,0 +1,200 @@ +""" +This migration updates the Schema Config entries for pre-geo tables and creates picklists for COGTypes. + +Fields added: +Collection -> collectionObjectType +GeographyTreeDef -> discipline +GeologicTimePeriodTreeDef -> discipline +LithostratTreeDef -> discipline +StorageTreeDef -> institution +TaxonTreeDef -> discipline + +Creates a picklist for COGType -> type and updates an existing incorrect picklist for COG -> COGType +""" +from django.db import migrations + +FIELD_DATA = [ + { + "table": "Collection", + "field": "collectionObjectType", + "isrequired": False, + }, + { + "table": "GeographyTreeDef", + "field": "discipline", + "isrequired": False, + }, + { + "table": "GeologicTimePeriodTreeDef", + "field": "discipline", + "isrequired": False, + }, + { + "table": "LithostratTreeDef", + "field": "discipline", + "isrequired": True, + }, + { + "table": "StorageTreeDef", + "field": "institution", + "isrequired": True, + }, + { + "table": "TaxonTreeDef", + "field": "discipline", + "isrequired": True, + }, +] + +PICKLIST_NAME = 'COGTypes' +COGTYPE_FIELD_NAME = 'cogType' +PICKLIST_TEXT = 'Collection Object Group Type' +SYSTEM_COGTYPE_PICKLIST_NAME = "SystemCOGTypes" + +def add_fields(apps): + Splocalecontainer = apps.get_model('specify', 'Splocalecontainer') + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') + + for data in FIELD_DATA: + for container in Splocalecontainer.objects.filter(name=data['table'], schematype=0): + container_item, _ = Splocalecontaineritem.objects.get_or_create( + name=data["field"], + type='ManyToOne', + container=container, + isrequired=data["isrequired"] + ) + Splocaleitemstr.objects.get_or_create( + language='en', + text=data["field"], + itemname=container_item + ) + Splocaleitemstr.objects.get_or_create( + language='en', + text=data["field"], + itemdesc=container_item + ) + +def remove_fields(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') + + for data in FIELD_DATA: + Splocaleitemstr.objects.filter( + text=data["field"], + itemname__container__name=data["table"], + itemname__container__schematype=0 + ).delete() + Splocaleitemstr.objects.filter( + text=data["field"], + itemdesc__container__name=data["table"], + itemdesc__container__schematype=0 + ).delete() + Splocalecontaineritem.objects.filter( + name=data["field"], + container__name=data["table"], + container__schematype=0, + ).delete() + +def create_cogtype_picklist(apps): + Collection = apps.get_model('specify', 'Collection') + Picklist = apps.get_model('specify', 'Picklist') + + # Create a cogtype picklist for each collection + for collection in Collection.objects.all(): + Picklist.objects.get_or_create( + name=PICKLIST_NAME, + issystem=True, + readonly=True, + sizelimit=-1, + sorttype=1, + type=1, + tablename='collectionobjectgrouptype', + collection=collection, + formatter=PICKLIST_NAME + ) + +def revert_cogtype_picklist(apps): + Picklist = apps.get_model('specify', 'Picklist') + + Picklist.objects.filter(name=PICKLIST_NAME).delete() + +# Updates COG -> cogtype to use the type 1 picklist created above +def update_cogtype_splocalecontaineritem(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + + Splocalecontaineritem.objects.filter(container__name='collectionobjectgroup', container__schematype=0, name=COGTYPE_FIELD_NAME).update( + picklistname=PICKLIST_NAME, + type='ManyToOne', + isrequired=True + ) + +def revert_cogtype_splocalecontaineritem(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + + Splocalecontaineritem.objects.filter(container__name='collectionobjectgroup', container__schematype=0, name=COGTYPE_FIELD_NAME).update( + picklistname=None, + type=None, + isrequired=None + ) + +def update_systemcogtypes_picklist(apps): + Picklist = apps.get_model('specify', 'Picklist') + + Picklist.objects.filter(name='Default Collection Object Group Types').update( + name=SYSTEM_COGTYPE_PICKLIST_NAME, + type=0, + issystem=True, + readonly=True, + sizelimit=3, + tablename=None + ) + +def revert_systemcogtypes_picklist(apps): + Picklist = apps.get_model('specify', 'Picklist') + + # revert only changes the name and not the other attributes as those were incorrect + Picklist.objects.filter(name=SYSTEM_COGTYPE_PICKLIST_NAME).update( + name='Default Collection Object Group Types', + ) + + +# Updates cogtype -> type to use the Default COGType picklist (Drill Core, Discrete, Consolidated) +def update_cogtype_type_splocalecontaineritem(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + + Splocalecontaineritem.objects.filter(container__name='collectionobjectgrouptype', container__schematype=0, name='type').update( + picklistname=SYSTEM_COGTYPE_PICKLIST_NAME, + isrequired=True + ) + +def revert_cogtype_type_splocalecontaineritem(apps): + Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') + + Splocalecontaineritem.objects.filter(container__name='collectionobjectgrouptype', container__schematype=0, name='type').update( + picklistname=None, + isrequired=None + ) + +class Migration(migrations.Migration): + dependencies = [ + ('specify', '0005_collectionobjectgroup_parentcojo'), + ] + + def apply_migration(apps, schema_editor): + add_fields(apps) + create_cogtype_picklist(apps) + update_cogtype_splocalecontaineritem(apps) + update_systemcogtypes_picklist(apps) + update_cogtype_type_splocalecontaineritem(apps) + + def revert_migration(apps, schema_editor): + remove_fields(apps) + revert_cogtype_picklist(apps) + revert_cogtype_splocalecontaineritem(apps) + revert_systemcogtypes_picklist(apps) + revert_cogtype_type_splocalecontaineritem(apps) + + operations = [ + migrations.RunPython(apply_migration, revert_migration, atomic=True) + ] \ No newline at end of file From 7a3076e2988f145bc0f0beb0f9e52aa5e3b12272 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Thu, 17 Oct 2024 10:28:22 -0400 Subject: [PATCH 30/47] remove old migration --- .../migrations/0006_schema_config_update.py | 200 ------------------ 1 file changed, 200 deletions(-) delete mode 100644 specifyweb/specify/migrations/0006_schema_config_update.py diff --git a/specifyweb/specify/migrations/0006_schema_config_update.py b/specifyweb/specify/migrations/0006_schema_config_update.py deleted file mode 100644 index 25c37049dcd..00000000000 --- a/specifyweb/specify/migrations/0006_schema_config_update.py +++ /dev/null @@ -1,200 +0,0 @@ -""" -This migration updates the Schema Config entries for pre-geo tables and creates picklists for COGTypes. - -Fields added: -Collection -> collectionObjectType -GeographyTreeDef -> discipline -GeologicTimePeriodTreeDef -> discipline -LithostratTreeDef -> discipline -StorageTreeDef -> institution -TaxonTreeDef -> discipline - -Creates a picklist for COGType -> type and updates an existing incorrect picklist for COG -> COGType -""" -from django.db import migrations - -FIELD_DATA = [ - { - "table": "Collection", - "field": "collectionObjectType", - "isrequired": False, - }, - { - "table": "GeographyTreeDef", - "field": "discipline", - "isrequired": False, - }, - { - "table": "GeologicTimePeriodTreeDef", - "field": "discipline", - "isrequired": False, - }, - { - "table": "LithostratTreeDef", - "field": "discipline", - "isrequired": True, - }, - { - "table": "StorageTreeDef", - "field": "institution", - "isrequired": True, - }, - { - "table": "TaxonTreeDef", - "field": "discipline", - "isrequired": True, - }, -] - -PICKLIST_NAME = 'COGTypes' -COGTYPE_FIELD_NAME = 'cogType' -PICKLIST_TEXT = 'Collection Object Group Type' -SYSTEM_COGTYPE_PICKLIST_NAME = "SystemCOGTypes" - -def add_fields(apps): - Splocalecontainer = apps.get_model('specify', 'Splocalecontainer') - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') - - for data in FIELD_DATA: - for container in Splocalecontainer.objects.filter(name=data['table'], schematype=0): - container_item, _ = Splocalecontaineritem.objects.get_or_create( - name=data["field"], - type='ManyToOne', - container=container, - isrequired=data["isrequired"] - ) - Splocaleitemstr.objects.get_or_create( - language='en', - text=data["field"], - itemname=container_item - ) - Splocaleitemstr.objects.get_or_create( - language='en', - text=data["field"], - itemdesc=container_item - ) - -def remove_fields(apps): - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') - - for data in FIELD_DATA: - Splocaleitemstr.objects.filter( - text=data["field"], - itemname__container__name=data["table"], - itemname__container__schematype=0 - ).delete() - Splocaleitemstr.objects.filter( - text=data["field"], - itemdesc__container__name=data["table"], - itemdesc__container__schematype=0 - ).delete() - Splocalecontaineritem.objects.filter( - name=data["field"], - container__name=data["table"], - container__schematype=0, - ).delete() - -def create_cogtype_picklist(apps): - Collection = apps.get_model('specify', 'Collection') - Picklist = apps.get_model('specify', 'Picklist') - - # Create a cogtype picklist for each collection - for collection in Collection.objects.all(): - Picklist.objects.get_or_create( - name=PICKLIST_NAME, - issystem=True, - readonly=True, - sizelimit=-1, - sorttype=1, - type=1, - tablename='collectionobjectgrouptype', - collection=collection, - formatter=PICKLIST_NAME - ) - -def revert_cogtype_picklist(apps): - Picklist = apps.get_model('specify', 'Picklist') - - Picklist.objects.filter(name=PICKLIST_NAME).delete() - -# Updates COG -> cogtype to use the type 1 picklist created above -def update_cogtype_splocalecontaineritem(apps): - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - - Splocalecontaineritem.objects.filter(container__name='collectionobjectgroup', container__schematype=0, name=COGTYPE_FIELD_NAME).update( - picklistname=PICKLIST_NAME, - type='ManyToOne', - isrequired=True - ) - -def revert_cogtype_splocalecontaineritem(apps): - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - - Splocalecontaineritem.objects.filter(container__name='collectionobjectgroup', container__schematype=0, name=COGTYPE_FIELD_NAME).update( - picklistname=None, - type=None, - isrequired=None - ) - -def update_systemcogtypes_picklist(apps): - Picklist = apps.get_model('specify', 'Picklist') - - Picklist.objects.filter(name='Default Collection Object Group Types').update( - name=SYSTEM_COGTYPE_PICKLIST_NAME, - type=0, - issystem=True, - readonly=True, - sizelimit=3, - tablename=None - ) - -def revert_systemcogtypes_picklist(apps): - Picklist = apps.get_model('specify', 'Picklist') - - # revert only changes the name and not the other attributes as those were incorrect - Picklist.objects.filter(name=SYSTEM_COGTYPE_PICKLIST_NAME).update( - name='Default Collection Object Group Types', - ) - - -# Updates cogtype -> type to use the Default COGType picklist (Drill Core, Discrete, Consolidated) -def update_cogtype_type_splocalecontaineritem(apps): - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - - Splocalecontaineritem.objects.filter(container__name='collectionobjectgrouptype', container__schematype=0, name='type').update( - picklistname=SYSTEM_COGTYPE_PICKLIST_NAME, - isrequired=True - ) - -def revert_cogtype_type_splocalecontaineritem(apps): - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - - Splocalecontaineritem.objects.filter(container__name='collectionobjectgrouptype', container__schematype=0, name='type').update( - picklistname=None, - isrequired=None - ) - -class Migration(migrations.Migration): - dependencies = [ - ('specify', '0005_collectionobjectgroup_parentcojo'), - ] - - def apply_migration(apps, schema_editor): - add_fields(apps) - create_cogtype_picklist(apps) - update_cogtype_splocalecontaineritem(apps) - update_systemcogtypes_picklist(apps) - update_cogtype_type_splocalecontaineritem(apps) - - def revert_migration(apps, schema_editor): - remove_fields(apps) - revert_cogtype_picklist(apps) - revert_cogtype_splocalecontaineritem(apps) - revert_systemcogtypes_picklist(apps) - revert_cogtype_type_splocalecontaineritem(apps) - - operations = [ - migrations.RunPython(apply_migration, revert_migration, atomic=True) - ] \ No newline at end of file From 15a1b0d58feee9ae109fde437298404ae4ad5672 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Thu, 17 Oct 2024 10:41:48 -0400 Subject: [PATCH 31/47] fix frontend types --- .../js_src/lib/components/DataModel/types.ts | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index d6090dab995..9617ddc85c0 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -977,8 +977,7 @@ export type BorrowReturnMaterial = { export type CollectingEvent = { readonly tableName: 'CollectingEvent'; readonly fields: { - readonly verbatimDate: string | null; - readonly remarks: string | null; + readonly startDate: string | null; readonly endDate: string | null; readonly endDatePrecision: number | null; readonly endDateVerbatim: string | null; @@ -989,14 +988,11 @@ export type CollectingEvent = { readonly integer1: number | null; readonly integer2: number | null; readonly remarks: string | null; - readonly method: string | null; - readonly stationFieldNumber: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; readonly reservedText1: string | null; readonly reservedText2: string | null; readonly sgrStatus: number | null; - readonly startDate: string | null; readonly startDatePrecision: number | null; readonly startDateVerbatim: string | null; readonly startTime: number | null; @@ -1014,6 +1010,8 @@ export type CollectingEvent = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; + readonly verbatimDate: string | null; + readonly verbatimLocality: string | null; readonly version: number | null; readonly visibility: number | null; }; @@ -1370,19 +1368,17 @@ export type Collection = { export type CollectionObject = { readonly tableName: 'CollectionObject'; readonly fields: { - readonly modifier: string | null; - readonly catalogedDate: string | null; - readonly projectNumber: string | null; readonly actualTotalCountAmt: number | null; readonly age: number | null; - readonly altCatalogNumber: string | null; readonly availability: string | null; + readonly catalogNumber: string | null; + readonly catalogedDate: string | null; readonly catalogedDatePrecision: number | null; readonly catalogedDateVerbatim: string | null; - readonly catalogNumber: string | null; - readonly remarks: string | null; readonly collectionMemberId: number; readonly countAmt: number | null; + readonly reservedText: string | null; + readonly timestampModified: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly deaccessioned: boolean | null; @@ -1397,17 +1393,16 @@ export type CollectionObject = { readonly text2: string | null; readonly inventoryDate: string | null; readonly inventoryDatePrecision: number | null; - readonly description: string | null; + readonly modifier: string | null; + readonly name: string | null; readonly notifications: string | null; readonly numberOfDuplicates: number | null; readonly number1: number | null; readonly number2: number | null; readonly objectCondition: string | null; readonly ocr: string | null; - readonly name: string | null; readonly altCatalogNumber: string | null; - readonly text1: string | null; - readonly yesNo1: boolean | null; + readonly projectNumber: string | null; readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; @@ -1415,19 +1410,23 @@ export type CollectionObject = { readonly reservedText3: string | null; readonly restrictions: string | null; readonly sgrStatus: number | null; - readonly catalogNumber: string | null; + readonly text1: string | null; + readonly description: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; readonly text6: string | null; readonly text7: string | null; readonly text8: string | null; + readonly timestampCreated: string; readonly totalCountAmt: number | null; readonly totalValue: number | null; readonly uniqueIdentifier: string | null; readonly version: number | null; readonly visibility: number | null; - readonly number2: number | null; + readonly fieldNumber: string | null; + readonly yesNo1: boolean | null; + readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; readonly yesNo5: boolean | null; @@ -1440,20 +1439,18 @@ export type CollectionObject = { readonly accession: Accession | null; readonly agent1: Agent | null; readonly appraisal: Appraisal | null; - readonly collectingEvent: CollectingEvent | null; + readonly cataloger: Agent | null; readonly collection: Collection; readonly collectionObjectType: CollectionObjectType; readonly container: Container | null; readonly containerOwner: Container | null; readonly createdByAgent: Agent | null; readonly currentDetermination: Determination | null; - readonly cataloger: Agent | null; readonly modifiedByAgent: Agent | null; readonly embargoAuthority: Agent | null; readonly collectingEvent: CollectingEvent | null; readonly fieldNotebookPage: FieldNotebookPage | null; readonly inventorizedBy: Agent | null; - readonly modifiedByAgent: Agent | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -1536,10 +1533,6 @@ export type CollectionObjectAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly number38: number | null; - readonly text7: string | null; - readonly number10: number | null; - readonly number11: number | null; readonly number12: number | null; readonly number13: number | null; readonly number1: number | null; @@ -1582,16 +1575,19 @@ export type CollectionObjectAttribute = { readonly number7: number | null; readonly number8: number | null; readonly number9: number | null; - readonly positionState: string | null; - readonly text3: string | null; - readonly text5: string | null; readonly text13: string | null; readonly text14: string | null; + readonly text1: string | null; + readonly positionState: string | null; + readonly text10: string | null; + readonly remarks: string | null; + readonly text8: string | null; + readonly text11: string | null; + readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; readonly text18: string | null; readonly text19: string | null; - readonly text2: string | null; readonly text20: string | null; readonly text21: string | null; readonly text22: string | null; @@ -1615,14 +1611,16 @@ export type CollectionObjectAttribute = { readonly text39: string | null; readonly text4: string | null; readonly text40: string | null; + readonly text5: string | null; + readonly text6: string | null; + readonly text7: string | null; readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly text12: string | null; readonly topDistance: number | null; readonly version: number | null; - readonly text8: string | null; - readonly number41: number | null; + readonly text2: string | null; readonly yesNo1: boolean | null; readonly yesNo10: boolean | null; readonly yesNo11: boolean | null; @@ -1660,10 +1658,10 @@ export type CollectionObjectCitation = { readonly fields: { readonly collectionMemberId: number; readonly figureNumber: string | null; - readonly remarks: string | null; readonly isFigured: boolean | null; readonly pageNumber: string | null; readonly plateNumber: string | null; + readonly remarks: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly version: number | null; @@ -2463,6 +2461,7 @@ export type Determination = { readonly addendum: string | null; readonly alternateName: string | null; readonly collectionMemberId: number; + readonly confidence: string | null; readonly isCurrent: boolean; readonly determinedDate: string | null; readonly determinedDatePrecision: number | null; @@ -2481,11 +2480,11 @@ export type Determination = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; - readonly text1: string | null; readonly qualifier: string | null; - readonly confidence: string | null; readonly remarks: string | null; readonly subSpQualifier: string | null; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -2523,9 +2522,9 @@ export type DeterminationCitation = { readonly collectionMemberId: number; readonly figureNumber: string | null; readonly isFigured: boolean | null; - readonly remarks: string | null; readonly pageNumber: string | null; readonly plateNumber: string | null; + readonly remarks: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly version: number | null; @@ -3093,13 +3092,12 @@ export type FundingAgent = { export type GeoCoordDetail = { readonly tableName: 'GeoCoordDetail'; readonly fields: { - readonly validation: string | null; - readonly source: string | null; readonly errorPolygon: string | null; readonly geoRefAccuracy: number | null; readonly geoRefAccuracyUnits: string | null; readonly geoRefCompiledDate: string | null; readonly geoRefDetDate: string | null; + readonly geoRefDetRef: string | null; readonly geoRefRemarks: string | null; readonly geoRefVerificationStatus: string | null; readonly integer1: number | null; @@ -3118,7 +3116,7 @@ export type GeoCoordDetail = { readonly number5: number | null; readonly originalCoordSystem: string | null; readonly protocol: string | null; - readonly geoRefDetRef: string | null; + readonly source: string | null; readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; @@ -3127,6 +3125,7 @@ export type GeoCoordDetail = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly uncertaintyPolygon: string | null; + readonly validation: string | null; readonly version: number | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -3865,8 +3864,6 @@ export type LoanReturnPreparation = { export type Locality = { readonly tableName: 'Locality'; readonly fields: { - readonly text1: string | null; - readonly text2: string | null; readonly datum: string | null; readonly elevationAccuracy: number | null; readonly gml: string | null; @@ -3874,16 +3871,15 @@ export type Locality = { readonly latLongMethod: string | null; readonly lat1text: string | null; readonly lat2text: string | null; + readonly latLongAccuracy: number | null; readonly latLongType: string | null; readonly latitude1: number | null; readonly latitude2: number | null; - readonly latLongAccuracy: number | null; readonly localityName: string; readonly long1text: string | null; readonly long2text: string | null; readonly longitude1: number | null; readonly longitude2: number | null; - readonly text1: string | null; readonly maxElevation: number | null; readonly minElevation: number | null; readonly namedPlace: string | null; @@ -3894,9 +3890,13 @@ export type Locality = { readonly sgrStatus: number | null; readonly shortName: string | null; readonly srcLatLongUnit: number; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; readonly verbatimElevation: string | null; readonly verbatimLatitude: string | null; @@ -3976,6 +3976,7 @@ export type LocalityCitation = { export type LocalityDetail = { readonly tableName: 'LocalityDetail'; readonly fields: { + readonly baseMeridian: string | null; readonly drainage: string | null; readonly endDepth: number | null; readonly endDepthUnit: string | null; @@ -3984,7 +3985,6 @@ export type LocalityDetail = { readonly hucCode: string | null; readonly island: string | null; readonly islandGroup: string | null; - readonly text1: string | null; readonly mgrsZone: string | null; readonly nationalParkName: string | null; readonly number1: number | null; @@ -4001,7 +4001,7 @@ export type LocalityDetail = { readonly startDepth: number | null; readonly startDepthUnit: string | null; readonly startDepthVerbatim: string | null; - readonly baseMeridian: string | null; + readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -4178,7 +4178,6 @@ export type PaleoContext = { readonly tableName: 'PaleoContext'; readonly fields: { readonly text1: string | null; - readonly text2: string | null; readonly paleoContextName: string | null; readonly number1: number | null; readonly number2: number | null; @@ -4186,6 +4185,7 @@ export type PaleoContext = { readonly number4: number | null; readonly number5: number | null; readonly remarks: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -4207,6 +4207,7 @@ export type PaleoContext = { readonly discipline: Discipline; readonly lithoStrat: LithoStrat | null; readonly modifiedByAgent: Agent | null; + readonly tectonicUnit: TectonicUnit | null; }; readonly toManyDependent: RR; readonly toManyIndependent: { @@ -4384,7 +4385,6 @@ export type Preparation = { readonly date4Precision: number | null; readonly description: string | null; readonly guid: string | null; - readonly text1: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly isOnLoan: boolean | null; From 84431d71f6528a0391d4941a413dd6ba1a681eaa Mon Sep 17 00:00:00 2001 From: Sharad S Date: Thu, 17 Oct 2024 10:42:38 -0400 Subject: [PATCH 32/47] fix incorrect merge --- specifyweb/specify/tree_views.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/specifyweb/specify/tree_views.py b/specifyweb/specify/tree_views.py index 54645de860c..36c780aae2b 100644 --- a/specifyweb/specify/tree_views.py +++ b/specifyweb/specify/tree_views.py @@ -30,8 +30,6 @@ GEO_TREES: Tuple[TREE_TABLE, ...] = ['Tectonicunit'] -GEO_TREES: Tuple[TREE_TABLE, ...] = ['Tectonicunit'] - COMMON_TREES: Tuple[TREE_TABLE, ...] = ['Taxon', 'Storage', 'Geography', *GEO_TREES] From 50e516605c693d9970b2e9df1f848ad0d5f891a3 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Thu, 17 Oct 2024 10:47:32 -0400 Subject: [PATCH 33/47] fix migration dependency --- specifyweb/specify/migrations/0007_schema_config_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/migrations/0007_schema_config_update.py b/specifyweb/specify/migrations/0007_schema_config_update.py index 25c37049dcd..d85aea1e0b1 100644 --- a/specifyweb/specify/migrations/0007_schema_config_update.py +++ b/specifyweb/specify/migrations/0007_schema_config_update.py @@ -178,7 +178,7 @@ def revert_cogtype_type_splocalecontaineritem(apps): class Migration(migrations.Migration): dependencies = [ - ('specify', '0005_collectionobjectgroup_parentcojo'), + ('specify', '0006_fix_tectonic_tree_fields'), ] def apply_migration(apps, schema_editor): From 3c555879a018c7f3189e98a204f45281b5a7f051 Mon Sep 17 00:00:00 2001 From: Max Patiiuk Date: Wed, 29 Nov 2023 19:13:07 -0800 Subject: [PATCH 34/47] fix env --- .env | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 65425c8632c..67551abb13c 100644 --- a/.env +++ b/.env @@ -3,11 +3,11 @@ DATABASE_PORT=3306 MYSQL_ROOT_PASSWORD=password DATABASE_NAME=specify -# When running Specify 7 for the first time or during updates that -# require migrations, ensure that the MASTER_NAME and MASTER_PASSWORD -# are set to the root username and password. This will ensure proper -# execution of Django migrations during the ixnitial setup. -# After launching Specify and verifying the update is complete, you can +# When running Specify 7 for the first time or during updates that +# require migrations, ensure that the MASTER_NAME and MASTER_PASSWORD +# are set to the root username and password. This will ensure proper +# execution of Django migrations during the initial setup. +# After launching Specify and verifying the update is complete, you can # safely replace these credentials with the master SQL user name and password. MASTER_NAME=root MASTER_PASSWORD=password @@ -36,7 +36,7 @@ CELERY_RESULT_BACKEND=redis://redis/1 LOG_LEVEL=WARNING # Set this variable to `true` to run Specify 7 in debug mode. This -# should only be used during development and troubleshooting and not -# during general use. Django applications leak memory when operated +# should only be used during development and troubleshooting and not +# during general use. Django applications leak memory when operated # continuously in debug mode. -SP7_DEBUG=true +SP7_DEBUG=true \ No newline at end of file From 0416d21283104634afa8584b667bf8051a86a3ab Mon Sep 17 00:00:00 2001 From: Sharad S Date: Thu, 17 Oct 2024 15:47:06 -0400 Subject: [PATCH 35/47] Improve reverting locale strings --- specifyweb/specify/migrations/0007_schema_config_update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specifyweb/specify/migrations/0007_schema_config_update.py b/specifyweb/specify/migrations/0007_schema_config_update.py index d85aea1e0b1..af5837be4a8 100644 --- a/specifyweb/specify/migrations/0007_schema_config_update.py +++ b/specifyweb/specify/migrations/0007_schema_config_update.py @@ -81,12 +81,12 @@ def remove_fields(apps): for data in FIELD_DATA: Splocaleitemstr.objects.filter( - text=data["field"], + itemname__name=data["field"], itemname__container__name=data["table"], itemname__container__schematype=0 ).delete() Splocaleitemstr.objects.filter( - text=data["field"], + itemdesc__name=data["field"], itemdesc__container__name=data["table"], itemdesc__container__schematype=0 ).delete() From dac4da4a28a0be23c43de980bddd7edd7f1c95c8 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Fri, 18 Oct 2024 11:33:59 -0400 Subject: [PATCH 36/47] Fix duplicate schema config entries --- specifyweb/specify/migrations/0004_stratigraphy_age.py | 3 ++- specifyweb/specify/migrations/0007_schema_config_update.py | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/specifyweb/specify/migrations/0004_stratigraphy_age.py b/specifyweb/specify/migrations/0004_stratigraphy_age.py index dec5ae488cd..4f0105baadc 100644 --- a/specifyweb/specify/migrations/0004_stratigraphy_age.py +++ b/specifyweb/specify/migrations/0004_stratigraphy_age.py @@ -19,11 +19,12 @@ ('AbsoluteAgeAttachment', None), ] SCHEMA_CONFIG_MOD_TABLE_FIELDS = { # TODO: make schema config corrections in new migration - 'Collectionobject': ['relativeAges', 'absoluteAges', 'collectionObjectType'], + 'Collectionobject': ['relativeAges', 'absoluteAges'], 'Collection': ['collectionObjectType'], 'Geographytreedef': ['discipline'], 'Geologictimeperiodtreedef': ['discipline'], 'Lithostrattreedef': ['discipline'], + 'StorageTreeDef': ['institution'], } PICKLIST_NAME = 'AgeType' DEFAULT_AGE_TYPES = [ diff --git a/specifyweb/specify/migrations/0007_schema_config_update.py b/specifyweb/specify/migrations/0007_schema_config_update.py index af5837be4a8..3e75d2048f2 100644 --- a/specifyweb/specify/migrations/0007_schema_config_update.py +++ b/specifyweb/specify/migrations/0007_schema_config_update.py @@ -48,7 +48,6 @@ PICKLIST_NAME = 'COGTypes' COGTYPE_FIELD_NAME = 'cogType' -PICKLIST_TEXT = 'Collection Object Group Type' SYSTEM_COGTYPE_PICKLIST_NAME = "SystemCOGTypes" def add_fields(apps): @@ -182,14 +181,14 @@ class Migration(migrations.Migration): ] def apply_migration(apps, schema_editor): - add_fields(apps) + # add_fields(apps) create_cogtype_picklist(apps) update_cogtype_splocalecontaineritem(apps) update_systemcogtypes_picklist(apps) update_cogtype_type_splocalecontaineritem(apps) def revert_migration(apps, schema_editor): - remove_fields(apps) + # remove_fields(apps) revert_cogtype_picklist(apps) revert_cogtype_splocalecontaineritem(apps) revert_systemcogtypes_picklist(apps) From 1fcefb543b456501f064fcfb106d9f9d065f51b8 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Fri, 18 Oct 2024 12:55:54 -0400 Subject: [PATCH 37/47] temp change revert --- .../specify/migrations/0007_schema_config_update.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/specifyweb/specify/migrations/0007_schema_config_update.py b/specifyweb/specify/migrations/0007_schema_config_update.py index 3e75d2048f2..c0e3687323a 100644 --- a/specifyweb/specify/migrations/0007_schema_config_update.py +++ b/specifyweb/specify/migrations/0007_schema_config_update.py @@ -81,16 +81,22 @@ def remove_fields(apps): for data in FIELD_DATA: Splocaleitemstr.objects.filter( itemname__name=data["field"], + itemname__type='ManyToOne', + itemname__isrequired=data["isrequired"], itemname__container__name=data["table"], itemname__container__schematype=0 ).delete() Splocaleitemstr.objects.filter( itemdesc__name=data["field"], + itemdesc__type='ManyToOne', + itemdesc__isrequired=data["isrequired"], itemdesc__container__name=data["table"], itemdesc__container__schematype=0 ).delete() Splocalecontaineritem.objects.filter( name=data["field"], + type='ManyToOne', + isrequired=data["isrequired"], container__name=data["table"], container__schematype=0, ).delete() @@ -188,7 +194,7 @@ def apply_migration(apps, schema_editor): update_cogtype_type_splocalecontaineritem(apps) def revert_migration(apps, schema_editor): - # remove_fields(apps) + remove_fields(apps) revert_cogtype_picklist(apps) revert_cogtype_splocalecontaineritem(apps) revert_systemcogtypes_picklist(apps) From b1323743ff5d048bb1dd1d13bb2de5af3a271357 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Mon, 21 Oct 2024 10:45:44 -0400 Subject: [PATCH 38/47] Revert age migration --- specifyweb/specify/migrations/0004_stratigraphy_age.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/specifyweb/specify/migrations/0004_stratigraphy_age.py b/specifyweb/specify/migrations/0004_stratigraphy_age.py index 4f0105baadc..dec5ae488cd 100644 --- a/specifyweb/specify/migrations/0004_stratigraphy_age.py +++ b/specifyweb/specify/migrations/0004_stratigraphy_age.py @@ -19,12 +19,11 @@ ('AbsoluteAgeAttachment', None), ] SCHEMA_CONFIG_MOD_TABLE_FIELDS = { # TODO: make schema config corrections in new migration - 'Collectionobject': ['relativeAges', 'absoluteAges'], + 'Collectionobject': ['relativeAges', 'absoluteAges', 'collectionObjectType'], 'Collection': ['collectionObjectType'], 'Geographytreedef': ['discipline'], 'Geologictimeperiodtreedef': ['discipline'], 'Lithostrattreedef': ['discipline'], - 'StorageTreeDef': ['institution'], } PICKLIST_NAME = 'AgeType' DEFAULT_AGE_TYPES = [ From 723e53615431d9fface5114b55c9a672902910a3 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Mon, 21 Oct 2024 15:10:38 -0400 Subject: [PATCH 39/47] Fix duplicate fields being added in migration --- .../migrations/0007_schema_config_update.py | 113 ++++-------------- 1 file changed, 24 insertions(+), 89 deletions(-) diff --git a/specifyweb/specify/migrations/0007_schema_config_update.py b/specifyweb/specify/migrations/0007_schema_config_update.py index c0e3687323a..ed2ff699d12 100644 --- a/specifyweb/specify/migrations/0007_schema_config_update.py +++ b/specifyweb/specify/migrations/0007_schema_config_update.py @@ -2,104 +2,40 @@ This migration updates the Schema Config entries for pre-geo tables and creates picklists for COGTypes. Fields added: -Collection -> collectionObjectType -GeographyTreeDef -> discipline -GeologicTimePeriodTreeDef -> discipline -LithostratTreeDef -> discipline StorageTreeDef -> institution -TaxonTreeDef -> discipline + +Fields removed: +CollectionObject -> collectionObjectType (duplicate) Creates a picklist for COGType -> type and updates an existing incorrect picklist for COG -> COGType """ from django.db import migrations - -FIELD_DATA = [ - { - "table": "Collection", - "field": "collectionObjectType", - "isrequired": False, - }, - { - "table": "GeographyTreeDef", - "field": "discipline", - "isrequired": False, - }, - { - "table": "GeologicTimePeriodTreeDef", - "field": "discipline", - "isrequired": False, - }, - { - "table": "LithostratTreeDef", - "field": "discipline", - "isrequired": True, - }, - { - "table": "StorageTreeDef", - "field": "institution", - "isrequired": True, - }, - { - "table": "TaxonTreeDef", - "field": "discipline", - "isrequired": True, - }, -] +from specifyweb.specify.update_schema_config import revert_table_field_schema_config, update_table_field_schema_config_with_defaults PICKLIST_NAME = 'COGTypes' COGTYPE_FIELD_NAME = 'cogType' SYSTEM_COGTYPE_PICKLIST_NAME = "SystemCOGTypes" -def add_fields(apps): - Splocalecontainer = apps.get_model('specify', 'Splocalecontainer') - Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') - Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') - - for data in FIELD_DATA: - for container in Splocalecontainer.objects.filter(name=data['table'], schematype=0): - container_item, _ = Splocalecontaineritem.objects.get_or_create( - name=data["field"], - type='ManyToOne', - container=container, - isrequired=data["isrequired"] - ) - Splocaleitemstr.objects.get_or_create( - language='en', - text=data["field"], - itemname=container_item - ) - Splocaleitemstr.objects.get_or_create( - language='en', - text=data["field"], - itemdesc=container_item - ) - -def remove_fields(apps): +def update_fields(apps): + Discipline = apps.get_model('specify', 'Discipline') Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') - - for data in FIELD_DATA: - Splocaleitemstr.objects.filter( - itemname__name=data["field"], - itemname__type='ManyToOne', - itemname__isrequired=data["isrequired"], - itemname__container__name=data["table"], - itemname__container__schematype=0 - ).delete() - Splocaleitemstr.objects.filter( - itemdesc__name=data["field"], - itemdesc__type='ManyToOne', - itemdesc__isrequired=data["isrequired"], - itemdesc__container__name=data["table"], - itemdesc__container__schematype=0 - ).delete() - Splocalecontaineritem.objects.filter( - name=data["field"], - type='ManyToOne', - isrequired=data["isrequired"], - container__name=data["table"], - container__schematype=0, - ).delete() + + # Add StorageTreeDef -> institution + for discipline in Discipline.objects.all(): + update_table_field_schema_config_with_defaults('StorageTreeDef', discipline.id, 'institution', apps) + + # Remove duplicate CollectionObject -> collectionObjectType + container_items = Splocalecontaineritem.objects.filter(name='collectionObjectType', picklistname=None, container__name='CollectionObject') + for container_item in container_items: + Splocaleitemstr.objects.filter(itemname=container_item).delete() + Splocaleitemstr.objects.filter(itemdesc=container_item).delete() + container_items.delete() + +# NOTE: The reverse function will not re-add the duplicate CO -> coType as its unnecessary +def revert_update_fields(apps): + # Remove StorageTreeDef -> institution + revert_table_field_schema_config('StorageTreeDef', 'institution', apps) def create_cogtype_picklist(apps): Collection = apps.get_model('specify', 'Collection') @@ -163,7 +99,6 @@ def revert_systemcogtypes_picklist(apps): name='Default Collection Object Group Types', ) - # Updates cogtype -> type to use the Default COGType picklist (Drill Core, Discrete, Consolidated) def update_cogtype_type_splocalecontaineritem(apps): Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') @@ -187,14 +122,14 @@ class Migration(migrations.Migration): ] def apply_migration(apps, schema_editor): - # add_fields(apps) + update_fields(apps) create_cogtype_picklist(apps) update_cogtype_splocalecontaineritem(apps) update_systemcogtypes_picklist(apps) update_cogtype_type_splocalecontaineritem(apps) def revert_migration(apps, schema_editor): - remove_fields(apps) + revert_update_fields(apps) revert_cogtype_picklist(apps) revert_cogtype_splocalecontaineritem(apps) revert_systemcogtypes_picklist(apps) From 58ef9deaa906f1252f7830e2ea4a31880183fb8f Mon Sep 17 00:00:00 2001 From: Sharad S Date: Tue, 22 Oct 2024 11:51:16 -0400 Subject: [PATCH 40/47] Add changes for COG -> children --- .../js_src/lib/components/DataModel/types.ts | 168 +++++++++--------- specifyweb/specify/datamodel.py | 4 +- .../migrations/0007_schema_config_update.py | 35 ++-- specifyweb/specify/models.py | 2 +- 4 files changed, 113 insertions(+), 96 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 9617ddc85c0..bd48e39f985 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -242,20 +242,20 @@ export type Tables = { export type Accession = { readonly tableName: 'Accession'; readonly fields: { - readonly accessionNumber: string; readonly accessionCondition: string | null; - readonly dateAccessioned: string | null; + readonly accessionNumber: string; readonly actualTotalCountAmt: number | null; readonly collectionObjectCount: number | null; + readonly dateAccessioned: string | null; readonly dateAcknowledged: string | null; - readonly remarks: string | null; + readonly dateReceived: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; readonly number1: number | null; readonly number2: number | null; readonly preparationCount: number | null; - readonly dateReceived: string | null; + readonly remarks: string | null; readonly status: string | null; readonly text1: string | null; readonly text2: string | null; @@ -461,10 +461,10 @@ export type Agent = { readonly initials: string | null; readonly integer1: number | null; readonly integer2: number | null; + readonly interests: string | null; readonly jobTitle: string | null; readonly lastName: string | null; readonly middleInitial: string | null; - readonly interests: string | null; readonly remarks: string | null; readonly suffix: string | null; readonly text1: string | null; @@ -497,8 +497,8 @@ export type Agent = { readonly agentAttachments: RA; readonly agentGeographies: RA; readonly agentSpecialties: RA; - readonly identifiers: RA; readonly groups: RA; + readonly identifiers: RA; readonly variants: RA; }; readonly toManyIndependent: { @@ -646,7 +646,6 @@ export type Attachment = { readonly fields: { readonly attachmentLocation: string | null; readonly attachmentStorageConfig: string | null; - readonly captureDevice: string | null; readonly copyrightDate: string | null; readonly copyrightHolder: string | null; readonly credit: string | null; @@ -663,6 +662,7 @@ export type Attachment = { readonly scopeID: number | null; readonly scopeType: number | null; readonly subjectOrientation: string | null; + readonly captureDevice: string | null; readonly subtype: string | null; readonly tableID: number | null; readonly timestampCreated: string; @@ -929,13 +929,13 @@ export type BorrowMaterial = { readonly tableName: 'BorrowMaterial'; readonly fields: { readonly collectionMemberId: number; + readonly description: string | null; readonly inComments: string | null; readonly materialNumber: string; readonly outComments: string | null; readonly quantity: number | null; readonly quantityResolved: number | null; readonly quantityReturned: number | null; - readonly description: string | null; readonly text1: string | null; readonly text2: string | null; readonly timestampCreated: string; @@ -977,24 +977,26 @@ export type BorrowReturnMaterial = { export type CollectingEvent = { readonly tableName: 'CollectingEvent'; readonly fields: { - readonly startDate: string | null; + readonly stationFieldNumber: string | null; + readonly timestampCreated: string; + readonly remarks: string | null; readonly endDate: string | null; readonly endDatePrecision: number | null; readonly endDateVerbatim: string | null; readonly endTime: number | null; - readonly stationFieldNumber: string | null; - readonly method: string | null; readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly remarks: string | null; + readonly verbatimDate: string | null; + readonly method: string | null; + readonly timestampModified: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; readonly reservedText1: string | null; readonly reservedText2: string | null; readonly sgrStatus: number | null; + readonly startDate: string | null; readonly startDatePrecision: number | null; - readonly startDateVerbatim: string | null; readonly startTime: number | null; readonly stationFieldNumberModifier1: string | null; readonly stationFieldNumberModifier2: string | null; @@ -1007,10 +1009,8 @@ export type CollectingEvent = { readonly text6: string | null; readonly text7: string | null; readonly text8: string | null; - readonly timestampCreated: string; - readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; - readonly verbatimDate: string | null; + readonly startDateVerbatim: string | null; readonly verbatimLocality: string | null; readonly version: number | null; readonly visibility: number | null; @@ -1022,8 +1022,8 @@ export type CollectingEvent = { readonly collectingTrip: CollectingTrip | null; readonly createdByAgent: Agent | null; readonly discipline: Discipline; - readonly locality: Locality | null; readonly modifiedByAgent: Agent | null; + readonly locality: Locality | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -1079,10 +1079,14 @@ export type CollectingEventAttr = { export type CollectingEventAttribute = { readonly tableName: 'CollectingEventAttribute'; readonly fields: { - readonly text8: string | null; - readonly text5: string | null; + readonly number6: number | null; + readonly text6: string | null; + readonly number4: number | null; readonly text4: string | null; + readonly number8: number | null; + readonly text8: string | null; readonly text9: string | null; + readonly text17: string | null; readonly integer1: number | null; readonly integer10: number | null; readonly integer2: number | null; @@ -1093,36 +1097,32 @@ export type CollectingEventAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly number12: number | null; - readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; - readonly number2: number | null; - readonly number3: number | null; - readonly number4: number | null; - readonly number5: number | null; - readonly number6: number | null; - readonly number7: number | null; - readonly number8: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number9: number | null; + readonly number3: number | null; + readonly text3: string | null; readonly remarks: string | null; - readonly text6: string | null; - readonly text1: string | null; + readonly number5: number | null; + readonly text5: string | null; readonly text10: string | null; readonly text11: string | null; - readonly text13: string | null; + readonly text12: string | null; readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; - readonly text17: string | null; - readonly text2: string | null; - readonly text7: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text12: string | null; + readonly number7: number | null; + readonly text7: string | null; + readonly text13: string | null; + readonly text1: string | null; readonly version: number | null; - readonly text3: string | null; + readonly number2: number | null; + readonly text2: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -1133,8 +1133,8 @@ export type CollectingEventAttribute = { readonly toOneIndependent: { readonly createdByAgent: Agent | null; readonly discipline: Discipline; - readonly hostTaxon: Taxon | null; readonly modifiedByAgent: Agent | null; + readonly hostTaxon: Taxon | null; }; readonly toManyDependent: RR; readonly toManyIndependent: { @@ -1163,7 +1163,6 @@ export type CollectingTrip = { readonly tableName: 'CollectingTrip'; readonly fields: { readonly cruise: string | null; - readonly text2: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly date2: string | null; @@ -1181,6 +1180,8 @@ export type CollectingTrip = { readonly startDatePrecision: number | null; readonly startDateVerbatim: string | null; readonly startTime: number | null; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -1192,7 +1193,6 @@ export type CollectingTrip = { readonly timestampModified: string | null; readonly collectingTripName: string | null; readonly version: number | null; - readonly text1: string | null; readonly vessel: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -1370,15 +1370,15 @@ export type CollectionObject = { readonly fields: { readonly actualTotalCountAmt: number | null; readonly age: number | null; + readonly altCatalogNumber: string | null; readonly availability: string | null; - readonly catalogNumber: string | null; readonly catalogedDate: string | null; readonly catalogedDatePrecision: number | null; readonly catalogedDateVerbatim: string | null; + readonly text1: string | null; readonly collectionMemberId: number; readonly countAmt: number | null; - readonly reservedText: string | null; - readonly timestampModified: string | null; + readonly timestampCreated: string; readonly date1: string | null; readonly date1Precision: number | null; readonly deaccessioned: boolean | null; @@ -1387,12 +1387,13 @@ export type CollectionObject = { readonly embargoReleaseDatePrecision: number | null; readonly embargoStartDate: string | null; readonly embargoStartDatePrecision: number | null; + readonly fieldNumber: string | null; readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly text2: string | null; readonly inventoryDate: string | null; readonly inventoryDatePrecision: number | null; + readonly timestampModified: string | null; readonly modifier: string | null; readonly name: string | null; readonly notifications: string | null; @@ -1401,30 +1402,29 @@ export type CollectionObject = { readonly number2: number | null; readonly objectCondition: string | null; readonly ocr: string | null; - readonly altCatalogNumber: string | null; readonly projectNumber: string | null; readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; + readonly reservedText: string | null; readonly reservedText2: string | null; readonly reservedText3: string | null; readonly restrictions: string | null; readonly sgrStatus: number | null; - readonly text1: string | null; readonly description: string | null; + readonly catalogNumber: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; readonly text6: string | null; readonly text7: string | null; readonly text8: string | null; - readonly timestampCreated: string; readonly totalCountAmt: number | null; readonly totalValue: number | null; readonly uniqueIdentifier: string | null; readonly version: number | null; readonly visibility: number | null; - readonly fieldNumber: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -1440,17 +1440,17 @@ export type CollectionObject = { readonly agent1: Agent | null; readonly appraisal: Appraisal | null; readonly cataloger: Agent | null; + readonly collectingEvent: CollectingEvent | null; readonly collection: Collection; readonly collectionObjectType: CollectionObjectType; readonly container: Container | null; readonly containerOwner: Container | null; readonly createdByAgent: Agent | null; readonly currentDetermination: Determination | null; - readonly modifiedByAgent: Agent | null; readonly embargoAuthority: Agent | null; - readonly collectingEvent: CollectingEvent | null; readonly fieldNotebookPage: FieldNotebookPage | null; readonly inventorizedBy: Agent | null; + readonly modifiedByAgent: Agent | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -1533,11 +1533,12 @@ export type CollectionObjectAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly number12: number | null; - readonly number13: number | null; + readonly text3: string | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number14: number | null; readonly number15: number | null; readonly number16: number | null; @@ -1575,14 +1576,15 @@ export type CollectionObjectAttribute = { readonly number7: number | null; readonly number8: number | null; readonly number9: number | null; - readonly text13: string | null; - readonly text14: string | null; readonly text1: string | null; readonly positionState: string | null; - readonly text10: string | null; readonly remarks: string | null; - readonly text8: string | null; + readonly text10: string | null; + readonly text12: string | null; + readonly text4: string | null; readonly text11: string | null; + readonly text13: string | null; + readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; @@ -1598,7 +1600,6 @@ export type CollectionObjectAttribute = { readonly text27: string | null; readonly text28: string | null; readonly text29: string | null; - readonly text3: string | null; readonly text30: string | null; readonly text31: string | null; readonly text32: string | null; @@ -1609,15 +1610,14 @@ export type CollectionObjectAttribute = { readonly text37: string | null; readonly text38: string | null; readonly text39: string | null; - readonly text4: string | null; readonly text40: string | null; readonly text5: string | null; readonly text6: string | null; readonly text7: string | null; + readonly text8: string | null; readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text12: string | null; readonly topDistance: number | null; readonly version: number | null; readonly text2: string | null; @@ -2194,9 +2194,7 @@ export type DNASequence = { readonly compT: number | null; readonly extractionDate: string | null; readonly extractionDatePrecision: number | null; - readonly text2: string | null; readonly genbankAccessionNumber: string | null; - readonly text1: string | null; readonly geneSequence: string | null; readonly moleculeType: string | null; readonly number1: number | null; @@ -2206,6 +2204,8 @@ export type DNASequence = { readonly sequenceDate: string | null; readonly sequenceDatePrecision: number | null; readonly targetMarker: string | null; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; @@ -2298,8 +2298,8 @@ export type DNASequencingRun = { readonly runByAgent: Agent | null; }; readonly toManyDependent: { - readonly citations: RA; readonly attachments: RA; + readonly citations: RA; }; readonly toManyIndependent: RR; }; @@ -2467,7 +2467,6 @@ export type Determination = { readonly determinedDatePrecision: number | null; readonly featureOrBasis: string | null; readonly guid: string | null; - readonly yesNo1: boolean | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -2480,11 +2479,10 @@ export type Determination = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; + readonly text2: string | null; readonly qualifier: string | null; readonly remarks: string | null; readonly subSpQualifier: string | null; - readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -2494,8 +2492,10 @@ export type Determination = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly typeStatusName: string | null; + readonly text1: string | null; readonly varQualifier: string | null; readonly version: number | null; + readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; @@ -3105,8 +3105,6 @@ export type GeoCoordDetail = { readonly integer3: number | null; readonly integer4: number | null; readonly integer5: number | null; - readonly maxUncertaintyEst: number | null; - readonly maxUncertaintyEstUnit: string | null; readonly namedPlaceExtent: number | null; readonly noGeoRefBecause: string | null; readonly number1: number | null; @@ -3125,6 +3123,8 @@ export type GeoCoordDetail = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly uncertaintyPolygon: string | null; + readonly maxUncertaintyEst: number | null; + readonly maxUncertaintyEstUnit: string | null; readonly validation: string | null; readonly version: number | null; readonly yesNo1: boolean | null; @@ -3347,8 +3347,8 @@ export type Gift = { readonly srcTaxonomy: string | null; readonly specialConditions: string | null; readonly status: string | null; - readonly text2: string | null; readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3717,7 +3717,6 @@ export type Loan = { readonly dateClosed: string | null; readonly dateReceived: string | null; readonly yesNo1: boolean | null; - readonly text2: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -3739,6 +3738,7 @@ export type Loan = { readonly specialConditions: string | null; readonly status: string | null; readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3864,8 +3864,10 @@ export type LoanReturnPreparation = { export type Locality = { readonly tableName: 'Locality'; readonly fields: { + readonly timestampCreated: string; readonly datum: string | null; readonly elevationAccuracy: number | null; + readonly elevationMethod: string | null; readonly gml: string | null; readonly guid: string | null; readonly latLongMethod: string | null; @@ -3882,8 +3884,8 @@ export type Locality = { readonly longitude2: number | null; readonly maxElevation: number | null; readonly minElevation: number | null; + readonly timestampModified: string | null; readonly namedPlace: string | null; - readonly originalElevationUnit: string | null; readonly originalLatLongUnit: number | null; readonly relationToNamedPlace: string | null; readonly remarks: string | null; @@ -3895,15 +3897,13 @@ export type Locality = { readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; - readonly timestampCreated: string; - readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; + readonly originalElevationUnit: string | null; readonly verbatimElevation: string | null; readonly verbatimLatitude: string | null; readonly verbatimLongitude: string | null; readonly version: number | null; readonly visibility: number | null; - readonly elevationMethod: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -3917,8 +3917,8 @@ export type Locality = { readonly toOneIndependent: { readonly createdByAgent: Agent | null; readonly discipline: Discipline; - readonly geography: Geography | null; readonly modifiedByAgent: Agent | null; + readonly geography: Geography | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -4177,7 +4177,6 @@ export type OtherIdentifier = { export type PaleoContext = { readonly tableName: 'PaleoContext'; readonly fields: { - readonly text1: string | null; readonly paleoContextName: string | null; readonly number1: number | null; readonly number2: number | null; @@ -4185,6 +4184,7 @@ export type PaleoContext = { readonly number4: number | null; readonly number5: number | null; readonly remarks: string | null; + readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -4398,10 +4398,12 @@ export type Preparation = { readonly sampleNumber: string | null; readonly status: string | null; readonly storageLocation: string | null; + readonly text1: string | null; readonly text10: string | null; readonly text11: string | null; readonly text12: string | null; readonly text13: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -4411,10 +4413,8 @@ export type Preparation = { readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text1: string | null; - readonly yesNo1: boolean | null; readonly version: number | null; - readonly text2: string | null; + readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; }; @@ -4791,10 +4791,7 @@ export type RecordSetItem = { export type ReferenceWork = { readonly tableName: 'ReferenceWork'; readonly fields: { - readonly text1: string | null; - readonly workDate: string | null; readonly doi: string | null; - readonly text2: string | null; readonly guid: string | null; readonly isPublished: boolean | null; readonly isbn: string | null; @@ -4805,6 +4802,8 @@ export type ReferenceWork = { readonly placeOfPublication: string | null; readonly publisher: string | null; readonly remarks: string | null; + readonly text1: string | null; + readonly text2: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly title: string; @@ -4813,6 +4812,7 @@ export type ReferenceWork = { readonly url: string | null; readonly version: number | null; readonly volume: string | null; + readonly workDate: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; }; @@ -4910,9 +4910,9 @@ export type RepositoryAgreementAttachment = { export type Shipment = { readonly tableName: 'Shipment'; readonly fields: { - readonly numberOfPackages: number | null; readonly insuredForAmount: string | null; readonly shipmentMethod: string | null; + readonly numberOfPackages: number | null; readonly number1: number | null; readonly number2: number | null; readonly remarks: string | null; @@ -5626,6 +5626,7 @@ export type Taxon = { readonly colStatus: string | null; readonly commonName: string | null; readonly cultivarName: string | null; + readonly environmentalProtectionStatus: string | null; readonly esaStatus: string | null; readonly fullName: string | null; readonly groupNumber: string | null; @@ -5649,7 +5650,6 @@ export type Taxon = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; - readonly environmentalProtectionStatus: string | null; readonly rankId: number; readonly remarks: string | null; readonly source: string | null; @@ -6519,7 +6519,9 @@ export type CollectionObjectGroup = { readonly modifiedByAgent: Agent | null; readonly parentCojo: CollectionObjectGroupJoin | null; }; - readonly toManyDependent: { readonly cojo: RA }; + readonly toManyDependent: { + readonly children: RA; + }; readonly toManyIndependent: RR; }; export type CollectionObjectGroupJoin = { diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 0c1f47690e0..b445e89b28a 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8297,7 +8297,7 @@ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='collectionobjectgroup'), - Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), + Relationship(name='children', type='one-to-many', required=False, dependent=True, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog'), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), ], @@ -8335,7 +8335,7 @@ ], relationships=[ - Relationship(name='parentCog', type='many-to-one', required=True, relatedModelName='CollectionObjectGroup', column='ParentCOGID', otherSideName='parentcojos'), + Relationship(name='parentCog', type='many-to-one', required=True, relatedModelName='CollectionObjectGroup', column='ParentCOGID', otherSideName='children'), Relationship(name='childCog', type='one-to-one', required=False, relatedModelName='CollectionObjectGroup', column='ChildCOGID', otherSideName='cojo'), Relationship(name='childCo', type='one-to-one', required=False, relatedModelName='CollectionObject', column='ChildCOID', otherSideName='cojo'), Relationship(name='collectionobjectgroup', type='one-to-many',required=False, relatedModelName='CollectionObjectGroup', otherSideName='parentCojo'), diff --git a/specifyweb/specify/migrations/0007_schema_config_update.py b/specifyweb/specify/migrations/0007_schema_config_update.py index ed2ff699d12..5d84cdff976 100644 --- a/specifyweb/specify/migrations/0007_schema_config_update.py +++ b/specifyweb/specify/migrations/0007_schema_config_update.py @@ -1,15 +1,20 @@ """ -This migration updates the Schema Config entries for pre-geo tables and creates picklists for COGTypes. +This migration updates the data model for COG and Schema Config entries for pre-geo tables and creates picklists for COGTypes. -Fields added: -StorageTreeDef -> institution +Data model changes: +Removed COG -> cojo +Added COG -> children -Fields removed: -CollectionObject -> collectionObjectType (duplicate) +Schema Config changes: +Added StorageTreeDef -> institution +Added COG -> children +Removed CollectionObject -> collectionObjectType (duplicate) +Removed COG -> cojo Creates a picklist for COGType -> type and updates an existing incorrect picklist for COG -> COGType """ -from django.db import migrations +from django.db import migrations, models +import django.db.models.deletion from specifyweb.specify.update_schema_config import revert_table_field_schema_config, update_table_field_schema_config_with_defaults PICKLIST_NAME = 'COGTypes' @@ -20,10 +25,14 @@ def update_fields(apps): Discipline = apps.get_model('specify', 'Discipline') Splocalecontaineritem = apps.get_model('specify', 'Splocalecontaineritem') Splocaleitemstr = apps.get_model('specify', 'Splocaleitemstr') - - # Add StorageTreeDef -> institution + + # Add StorageTreeDef -> institution and COG -> children for discipline in Discipline.objects.all(): update_table_field_schema_config_with_defaults('StorageTreeDef', discipline.id, 'institution', apps) + update_table_field_schema_config_with_defaults('CollectionObjectGroup', discipline.id, 'children', apps) + + # Remove COG -> cojo + revert_table_field_schema_config('CollectionObjectGroup', 'cojo', apps) # Remove duplicate CollectionObject -> collectionObjectType container_items = Splocalecontaineritem.objects.filter(name='collectionObjectType', picklistname=None, container__name='CollectionObject') @@ -32,10 +41,11 @@ def update_fields(apps): Splocaleitemstr.objects.filter(itemdesc=container_item).delete() container_items.delete() -# NOTE: The reverse function will not re-add the duplicate CO -> coType as its unnecessary +# NOTE: The reverse function will not re-add the duplicate CO -> coType or COG -> cojo as its unnecessary def revert_update_fields(apps): - # Remove StorageTreeDef -> institution + # Remove StorageTreeDef -> institution and COG -> children revert_table_field_schema_config('StorageTreeDef', 'institution', apps) + revert_table_field_schema_config('CollectionObjectGroup', 'children', apps) def create_cogtype_picklist(apps): Collection = apps.get_model('specify', 'Collection') @@ -136,5 +146,10 @@ def revert_migration(apps, schema_editor): revert_cogtype_type_splocalecontaineritem(apps) operations = [ + migrations.AlterField( + model_name='collectionobjectgroupjoin', + name='parentcog', + field=models.ForeignKey(db_column='ParentCOGID', on_delete=django.db.models.deletion.CASCADE, related_name='children', to='specify.collectionobjectgroup'), + ), migrations.RunPython(apply_migration, revert_migration, atomic=True) ] \ No newline at end of file diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index d4830a119a2..cd219404848 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7605,7 +7605,7 @@ class Collectionobjectgroupjoin(models.Model): # aka. CoJo or CogJoin yesno3 = models.BooleanField(blank=True, null=True, unique=False, db_column='YesNo3', db_index=False) # Relationships: Many-to-One - parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojos', null=False, on_delete=models.CASCADE) + parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='children', null=False, on_delete=models.CASCADE) # Relationships: One-to-One childcog = models.OneToOneField('CollectionObjectGroup', db_column='ChildCOGID', related_name='cojo', null=True, on_delete=models.CASCADE) From 9aeb7d3a1cf4ef02fad356ac93ff3109c96904bf Mon Sep 17 00:00:00 2001 From: Sharad S Date: Tue, 22 Oct 2024 12:33:07 -0400 Subject: [PATCH 41/47] Change formatter name to table name --- specifyweb/specify/migrations/0007_schema_config_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/migrations/0007_schema_config_update.py b/specifyweb/specify/migrations/0007_schema_config_update.py index 5d84cdff976..0db00f68cfa 100644 --- a/specifyweb/specify/migrations/0007_schema_config_update.py +++ b/specifyweb/specify/migrations/0007_schema_config_update.py @@ -62,7 +62,7 @@ def create_cogtype_picklist(apps): type=1, tablename='collectionobjectgrouptype', collection=collection, - formatter=PICKLIST_NAME + formatter='CollectionObjectGroupType' ) def revert_cogtype_picklist(apps): From 22e7493cd6b4bb36a4cc2103685b3d98dcc40372 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 23 Oct 2024 06:39:11 -0700 Subject: [PATCH 42/47] Fix revert migration --- .../specify/migrations/0007_tectonic_ranks.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/specifyweb/specify/migrations/0007_tectonic_ranks.py b/specifyweb/specify/migrations/0007_tectonic_ranks.py index c861cb5f6b2..73c93fc98e5 100644 --- a/specifyweb/specify/migrations/0007_tectonic_ranks.py +++ b/specifyweb/specify/migrations/0007_tectonic_ranks.py @@ -55,12 +55,21 @@ def create_default_tectonic_ranks(apps): def revert_default_tectonic_ranks(apps, schema_editor): TectonicUnit = apps.get_model('specify', 'TectonicUnit') + TectonicUnitTreeDefItem = apps.get_model('specify', 'TectonicUnitTreeDefItem') TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') Discipline = apps.get_model('specify', 'Discipline') for discipline in Discipline.objects.all(): - tectonic_tree_def = TectonicTreeDef.objects.filter(name="Tectonic Unit", discipline=discipline) - if tectonic_tree_def: + tectonic_tree_defs = TectonicTreeDef.objects.filter(name="Tectonic Unit", discipline=discipline) + + for tectonic_tree_def in tectonic_tree_defs: + tectonic_unit_tree_def_items = TectonicUnitTreeDefItem.objects.filter(treedef=tectonic_tree_def).order_by('-id') + + for item in tectonic_unit_tree_def_items: + TectonicUnit.objects.filter(definitionitem=item).delete() + + item.delete() + tectonic_tree_def.delete() def create_root_tectonic_node(apps): @@ -93,6 +102,7 @@ def create_root_tectonic_node(apps): def revert_create_root_tectonic_node(apps, schema_editor): TectonicUnit = apps.get_model('specify', 'TectonicUnit') + TectonicUnitTreeDefItem = apps.get_model('specify', 'TectonicUnitTreeDefItem') TectonicTreeDef = apps.get_model('specify', 'TectonicUnitTreeDef') Discipline = apps.get_model('specify', 'Discipline') @@ -100,6 +110,7 @@ def revert_create_root_tectonic_node(apps, schema_editor): tectonic_tree_def = TectonicTreeDef.objects.filter(name="Tectonic Unit", discipline=discipline).first() if tectonic_tree_def: + TectonicUnitTreeDefItem.objects.filter(treedef=tectonic_tree_def).delete() TectonicUnit.objects.filter( name="Root" ).delete() @@ -116,7 +127,7 @@ def consolidated_python_django_migration_operations(apps, schema_editor): def revert_cosolidated_python_django_migration_operations(apps, schema_editor): revert_default_tectonic_ranks(apps, schema_editor) - revert_create_root_tectonic_node(apps) + revert_create_root_tectonic_node(apps, schema_editor) operations = [ migrations.RunPython(consolidated_python_django_migration_operations, revert_cosolidated_python_django_migration_operations, atomic=True), From 69034e86e31f17a800dcc78a56d85cd8830e93a1 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 23 Oct 2024 08:03:31 -0700 Subject: [PATCH 43/47] Hide tectonic tree for non paleo or geo disciplines Fixes #5334 --- specifyweb/specify/model_extras.py | 7 +++++++ specifyweb/specify/tree_views.py | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/specifyweb/specify/model_extras.py b/specifyweb/specify/model_extras.py index 17e02b5219e..afbc92e2a06 100644 --- a/specifyweb/specify/model_extras.py +++ b/specifyweb/specify/model_extras.py @@ -145,11 +145,18 @@ class Meta: abstract = True PALEO_DISCIPLINES = {'paleobotany', 'invertpaleo', 'vertpaleo'} +GEOLOGY_DISCIPLINES = {'geology'} class Discipline(models.Model): def is_paleo(self): return self.type.lower() in PALEO_DISCIPLINES + def is_geo(self): + return self.type.lower() in GEOLOGY_DISCIPLINES + + def is_paleo_geo(self): + return self.is_paleo() or self.is_geo() + class Meta: abstract = True diff --git a/specifyweb/specify/tree_views.py b/specifyweb/specify/tree_views.py index 36c780aae2b..5dda3f2153d 100644 --- a/specifyweb/specify/tree_views.py +++ b/specifyweb/specify/tree_views.py @@ -31,10 +31,10 @@ GEO_TREES: Tuple[TREE_TABLE, ...] = ['Tectonicunit'] COMMON_TREES: Tuple[TREE_TABLE, ...] = ['Taxon', 'Storage', - 'Geography', *GEO_TREES] + 'Geography'] ALL_TRESS: Tuple[TREE_TABLE, ...] = [ - *COMMON_TREES, 'Geologictimeperiod', 'Lithostrat'] + *COMMON_TREES, 'Geologictimeperiod', 'Lithostrat', *GEO_TREES] def tree_mutation(mutation): @@ -456,10 +456,10 @@ def has_tree_read_permission(tree: TREE_TABLE) -> bool: return has_table_permission( request.specify_collection.id, request.specify_user.id, tree, 'read') - is_paleo_discipline = request.specify_collection.discipline.is_paleo() + is_paleo_or_geo_discipline = request.specify_collection.discipline.is_paleo_geo() accessible_trees = tuple(filter( - has_tree_read_permission, ALL_TRESS if is_paleo_discipline else COMMON_TREES)) + has_tree_read_permission, ALL_TRESS if is_paleo_or_geo_discipline else COMMON_TREES)) result = {} From ed4dbac2be9463a7a4dd6506ab5ee17f3813f497 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 23 Oct 2024 08:28:04 -0700 Subject: [PATCH 44/47] Simplify tree ranks name --- specifyweb/specify/tree_ranks.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/specifyweb/specify/tree_ranks.py b/specifyweb/specify/tree_ranks.py index c992443c0b0..a0609402db1 100644 --- a/specifyweb/specify/tree_ranks.py +++ b/specifyweb/specify/tree_ranks.py @@ -80,14 +80,10 @@ TECTONIC_UNIT_RANKS = { 'root': 0, 'superstructure': 10, - 'tectonic_domain': 20, - 'tectonic_subdomain': 30, - 'tectonic_unit': 40, - 'tectonic_subunit': 50, - 'tectonic domain': 20, - 'tectonic subdomain': 30, - 'tectonic unit': 40, - 'tectonic subunit': 50 + 'domain': 20, + 'subdomain': 30, + 'unit': 40, + 'subunit': 50, } DEFAULT_RANK_INCREMENT = 100 From 08fff68988353586d160809a0a473c0b139caeeb Mon Sep 17 00:00:00 2001 From: Sharad S <16229739+sharadsw@users.noreply.github.com> Date: Wed, 23 Oct 2024 19:45:55 +0000 Subject: [PATCH 45/47] Lint code with ESLint and Prettier Triggered by d437dcb18e073facd434d41dc26a35641745c3e1 on branch refs/heads/production --- .../lib/components/SchemaConfig/README.md | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/SchemaConfig/README.md b/specifyweb/frontend/js_src/lib/components/SchemaConfig/README.md index bb1c97adc8a..eeccb2a8f39 100644 --- a/specifyweb/frontend/js_src/lib/components/SchemaConfig/README.md +++ b/specifyweb/frontend/js_src/lib/components/SchemaConfig/README.md @@ -5,14 +5,22 @@ fields and formatters/aggregators. Tables used: -- SpLocaleContainer: Refers to each table in Schema Config. Each Specify table has one `SpLocaleContainer` record for each discipline. -- SpLocaleContainerItem: Contains the entries (fields/relations) for tables in Schema Config. -- SpLocaleItemStr: Contains the name and description strings for each `SpLocaleContainerItem`. +- SpLocaleContainer: Refers to each table in Schema Config. Each Specify table + has one `SpLocaleContainer` record for each discipline. +- SpLocaleContainerItem: Contains the entries (fields/relations) for tables in + Schema Config. +- SpLocaleItemStr: Contains the name and description strings for each + `SpLocaleContainerItem`. Also, the PickList tables: - PickList: Defines a picklist in the database. Picklists can be one of 3 types: - - `type=0`: Refers to user-defined picklists. i.e: picklists containing explicitly specified values. - - `type=1`: Picklists that are related to a table. The values of the picklist are based on a specified formatter. e.g: CollectionObject > CollectionObjectType. - - `type=2`: Picklists that generates its values from a field in a given table. Essentially works as a user-defined picklist, but with autogenerated values. -- PickListItem: Contains the values for user-defined picklists. Only used for `type 1` picklists. + - `type=0`: Refers to user-defined picklists. i.e: picklists containing + explicitly specified values. + - `type=1`: Picklists that are related to a table. The values of the picklist + are based on a specified formatter. e.g: CollectionObject > + CollectionObjectType. + - `type=2`: Picklists that generates its values from a field in a given table. + Essentially works as a user-defined picklist, but with autogenerated values. +- PickListItem: Contains the values for user-defined picklists. Only used for + `type 1` picklists. From 7647b5dcdf0ce0a1779663403fb488e29e869e78 Mon Sep 17 00:00:00 2001 From: Grant Fitzsimmons <37256050+grantfitzsimmons@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:00:42 -0500 Subject: [PATCH 46/47] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8b7cc1ec823..eadaf801b68 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -18,6 +18,8 @@ Steps to reproduce the behavior: 3. Scroll down to '....' 4. See error +*When reporting an issue on the `production` branch or any development version of Specify, please try to recreate the issue on the latest tagged release (`v7`) and indicate if it does not occur there, indicating a regression.* + **Expected behavior** A clear and concise description of what you expected to happen. @@ -26,17 +28,16 @@ If applicable, add screenshots to help explain your problem. **Crash Report** -If the bug resulted in an error message, please click on "Download Error -Message" and attach it here - -Please, also fill out the following information manually: +If the bug resulted in an error message, please click on "Download Error Message" and attach it here. If there is no error, please follow [these instructions](https://discourse.specifysoftware.org/t/download-specify-7-system-information/1614) to download your System Information. +Please fill out the following information manually: - OS: [e.g. Windows 10] - Browser: [e.g. Chrome, Safari] - Specify 7 Version: [e.g. 7.6.1] - Database Name: [e.g. kufish] (you can see this in the "About Specify 7" dialog) - Collection name: [e.g. KU Fish Tissue] - User Name: [e.g. SpAdmin] +- URL: [e.g. https://ku_fish-v7.test.specifysystems.org/specify/workbench/215/] **Reported By** Name of your institution From 47d59f71a7f0f401a4d67fda9ff5ea383c3590e0 Mon Sep 17 00:00:00 2001 From: Sharad S Date: Fri, 25 Oct 2024 16:05:54 -0400 Subject: [PATCH 47/47] Fix migration order --- .../js_src/lib/components/DataModel/types.ts | 167 +++++++++--------- ...ctonic_ranks.py => 0008_tectonic_ranks.py} | 5 +- 2 files changed, 86 insertions(+), 86 deletions(-) rename specifyweb/specify/migrations/{0007_tectonic_ranks.py => 0008_tectonic_ranks.py} (97%) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 29f051f8fcb..66f323c4a77 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -242,20 +242,20 @@ export type Tables = { export type Accession = { readonly tableName: 'Accession'; readonly fields: { - readonly accessionCondition: string | null; readonly accessionNumber: string; + readonly accessionCondition: string | null; + readonly dateAccessioned: string | null; readonly actualTotalCountAmt: number | null; readonly collectionObjectCount: number | null; - readonly dateAccessioned: string | null; readonly dateAcknowledged: string | null; - readonly dateReceived: string | null; + readonly remarks: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; readonly number1: number | null; readonly number2: number | null; readonly preparationCount: number | null; - readonly remarks: string | null; + readonly dateReceived: string | null; readonly status: string | null; readonly text1: string | null; readonly text2: string | null; @@ -461,10 +461,10 @@ export type Agent = { readonly initials: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly interests: string | null; readonly jobTitle: string | null; readonly lastName: string | null; readonly middleInitial: string | null; + readonly interests: string | null; readonly remarks: string | null; readonly suffix: string | null; readonly text1: string | null; @@ -497,8 +497,8 @@ export type Agent = { readonly agentAttachments: RA; readonly agentGeographies: RA; readonly agentSpecialties: RA; - readonly groups: RA; readonly identifiers: RA; + readonly groups: RA; readonly variants: RA; }; readonly toManyIndependent: { @@ -646,6 +646,7 @@ export type Attachment = { readonly fields: { readonly attachmentLocation: string | null; readonly attachmentStorageConfig: string | null; + readonly captureDevice: string | null; readonly copyrightDate: string | null; readonly copyrightHolder: string | null; readonly credit: string | null; @@ -662,7 +663,6 @@ export type Attachment = { readonly scopeID: number | null; readonly scopeType: number | null; readonly subjectOrientation: string | null; - readonly captureDevice: string | null; readonly subtype: string | null; readonly tableID: number | null; readonly timestampCreated: string; @@ -929,13 +929,13 @@ export type BorrowMaterial = { readonly tableName: 'BorrowMaterial'; readonly fields: { readonly collectionMemberId: number; - readonly description: string | null; readonly inComments: string | null; readonly materialNumber: string; readonly outComments: string | null; readonly quantity: number | null; readonly quantityResolved: number | null; readonly quantityReturned: number | null; + readonly description: string | null; readonly text1: string | null; readonly text2: string | null; readonly timestampCreated: string; @@ -977,26 +977,24 @@ export type BorrowReturnMaterial = { export type CollectingEvent = { readonly tableName: 'CollectingEvent'; readonly fields: { - readonly stationFieldNumber: string | null; - readonly timestampCreated: string; - readonly remarks: string | null; + readonly startDate: string | null; readonly endDate: string | null; readonly endDatePrecision: number | null; readonly endDateVerbatim: string | null; readonly endTime: number | null; + readonly stationFieldNumber: string | null; + readonly method: string | null; readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly verbatimDate: string | null; - readonly method: string | null; - readonly timestampModified: string | null; + readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; readonly reservedText1: string | null; readonly reservedText2: string | null; readonly sgrStatus: number | null; - readonly startDate: string | null; readonly startDatePrecision: number | null; + readonly startDateVerbatim: string | null; readonly startTime: number | null; readonly stationFieldNumberModifier1: string | null; readonly stationFieldNumberModifier2: string | null; @@ -1009,8 +1007,10 @@ export type CollectingEvent = { readonly text6: string | null; readonly text7: string | null; readonly text8: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; - readonly startDateVerbatim: string | null; + readonly verbatimDate: string | null; readonly verbatimLocality: string | null; readonly version: number | null; readonly visibility: number | null; @@ -1022,8 +1022,8 @@ export type CollectingEvent = { readonly collectingTrip: CollectingTrip | null; readonly createdByAgent: Agent | null; readonly discipline: Discipline; - readonly modifiedByAgent: Agent | null; readonly locality: Locality | null; + readonly modifiedByAgent: Agent | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -1079,14 +1079,10 @@ export type CollectingEventAttr = { export type CollectingEventAttribute = { readonly tableName: 'CollectingEventAttribute'; readonly fields: { - readonly number6: number | null; - readonly text6: string | null; - readonly number4: number | null; - readonly text4: string | null; - readonly number8: number | null; readonly text8: string | null; + readonly text5: string | null; + readonly text4: string | null; readonly text9: string | null; - readonly text17: string | null; readonly integer1: number | null; readonly integer10: number | null; readonly integer2: number | null; @@ -1097,32 +1093,36 @@ export type CollectingEventAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; - readonly number12: number | null; - readonly number13: number | null; - readonly number9: number | null; + readonly number2: number | null; readonly number3: number | null; - readonly text3: string | null; - readonly remarks: string | null; + readonly number4: number | null; readonly number5: number | null; - readonly text5: string | null; + readonly number6: number | null; + readonly number7: number | null; + readonly number8: number | null; + readonly number9: number | null; + readonly remarks: string | null; + readonly text6: string | null; + readonly text1: string | null; readonly text10: string | null; readonly text11: string | null; - readonly text12: string | null; + readonly text13: string | null; readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; + readonly text17: string | null; + readonly text2: string | null; + readonly text7: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly number7: number | null; - readonly text7: string | null; - readonly text13: string | null; - readonly text1: string | null; + readonly text12: string | null; readonly version: number | null; - readonly number2: number | null; - readonly text2: string | null; + readonly text3: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -1133,8 +1133,8 @@ export type CollectingEventAttribute = { readonly toOneIndependent: { readonly createdByAgent: Agent | null; readonly discipline: Discipline; - readonly modifiedByAgent: Agent | null; readonly hostTaxon: Taxon | null; + readonly modifiedByAgent: Agent | null; }; readonly toManyDependent: RR; readonly toManyIndependent: { @@ -1163,6 +1163,7 @@ export type CollectingTrip = { readonly tableName: 'CollectingTrip'; readonly fields: { readonly cruise: string | null; + readonly text2: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly date2: string | null; @@ -1180,8 +1181,6 @@ export type CollectingTrip = { readonly startDatePrecision: number | null; readonly startDateVerbatim: string | null; readonly startTime: number | null; - readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -1193,6 +1192,7 @@ export type CollectingTrip = { readonly timestampModified: string | null; readonly collectingTripName: string | null; readonly version: number | null; + readonly text1: string | null; readonly vessel: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -1370,15 +1370,15 @@ export type CollectionObject = { readonly fields: { readonly actualTotalCountAmt: number | null; readonly age: number | null; - readonly altCatalogNumber: string | null; readonly availability: string | null; + readonly catalogNumber: string | null; readonly catalogedDate: string | null; readonly catalogedDatePrecision: number | null; readonly catalogedDateVerbatim: string | null; - readonly text1: string | null; readonly collectionMemberId: number; readonly countAmt: number | null; - readonly timestampCreated: string; + readonly reservedText: string | null; + readonly timestampModified: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly deaccessioned: boolean | null; @@ -1387,13 +1387,12 @@ export type CollectionObject = { readonly embargoReleaseDatePrecision: number | null; readonly embargoStartDate: string | null; readonly embargoStartDatePrecision: number | null; - readonly fieldNumber: string | null; readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; + readonly text2: string | null; readonly inventoryDate: string | null; readonly inventoryDatePrecision: number | null; - readonly timestampModified: string | null; readonly modifier: string | null; readonly name: string | null; readonly notifications: string | null; @@ -1402,29 +1401,30 @@ export type CollectionObject = { readonly number2: number | null; readonly objectCondition: string | null; readonly ocr: string | null; + readonly altCatalogNumber: string | null; readonly projectNumber: string | null; readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; - readonly reservedText: string | null; readonly reservedText2: string | null; readonly reservedText3: string | null; readonly restrictions: string | null; readonly sgrStatus: number | null; + readonly text1: string | null; readonly description: string | null; - readonly catalogNumber: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; readonly text6: string | null; readonly text7: string | null; readonly text8: string | null; + readonly timestampCreated: string; readonly totalCountAmt: number | null; readonly totalValue: number | null; readonly uniqueIdentifier: string | null; readonly version: number | null; readonly visibility: number | null; + readonly fieldNumber: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -1440,17 +1440,17 @@ export type CollectionObject = { readonly agent1: Agent | null; readonly appraisal: Appraisal | null; readonly cataloger: Agent | null; - readonly collectingEvent: CollectingEvent | null; readonly collection: Collection; readonly collectionObjectType: CollectionObjectType; readonly container: Container | null; readonly containerOwner: Container | null; readonly createdByAgent: Agent | null; readonly currentDetermination: Determination | null; + readonly modifiedByAgent: Agent | null; readonly embargoAuthority: Agent | null; + readonly collectingEvent: CollectingEvent | null; readonly fieldNotebookPage: FieldNotebookPage | null; readonly inventorizedBy: Agent | null; - readonly modifiedByAgent: Agent | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -1533,12 +1533,11 @@ export type CollectionObjectAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly text3: string | null; + readonly number12: number | null; + readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; - readonly number12: number | null; - readonly number13: number | null; readonly number14: number | null; readonly number15: number | null; readonly number16: number | null; @@ -1576,15 +1575,14 @@ export type CollectionObjectAttribute = { readonly number7: number | null; readonly number8: number | null; readonly number9: number | null; + readonly text13: string | null; + readonly text14: string | null; readonly text1: string | null; readonly positionState: string | null; - readonly remarks: string | null; - readonly text1: string | null; readonly text10: string | null; + readonly remarks: string | null; + readonly text8: string | null; readonly text11: string | null; - readonly text12: string | null; - readonly text13: string | null; - readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; @@ -1600,6 +1598,7 @@ export type CollectionObjectAttribute = { readonly text27: string | null; readonly text28: string | null; readonly text29: string | null; + readonly text3: string | null; readonly text30: string | null; readonly text31: string | null; readonly text32: string | null; @@ -1610,13 +1609,15 @@ export type CollectionObjectAttribute = { readonly text37: string | null; readonly text38: string | null; readonly text39: string | null; + readonly text4: string | null; readonly text40: string | null; readonly text5: string | null; + readonly text6: string | null; readonly text7: string | null; - readonly text8: string | null; readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; + readonly text12: string | null; readonly topDistance: number | null; readonly version: number | null; readonly text2: string | null; @@ -2193,7 +2194,9 @@ export type DNASequence = { readonly compT: number | null; readonly extractionDate: string | null; readonly extractionDatePrecision: number | null; + readonly text2: string | null; readonly genbankAccessionNumber: string | null; + readonly text1: string | null; readonly geneSequence: string | null; readonly moleculeType: string | null; readonly number1: number | null; @@ -2203,8 +2206,6 @@ export type DNASequence = { readonly sequenceDate: string | null; readonly sequenceDatePrecision: number | null; readonly targetMarker: string | null; - readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; @@ -2297,8 +2298,8 @@ export type DNASequencingRun = { readonly runByAgent: Agent | null; }; readonly toManyDependent: { - readonly attachments: RA; readonly citations: RA; + readonly attachments: RA; }; readonly toManyIndependent: RR; }; @@ -2466,6 +2467,7 @@ export type Determination = { readonly determinedDatePrecision: number | null; readonly featureOrBasis: string | null; readonly guid: string | null; + readonly yesNo1: boolean | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -2478,10 +2480,11 @@ export type Determination = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; - readonly text1: string | null; readonly qualifier: string | null; readonly remarks: string | null; readonly subSpQualifier: string | null; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -2491,10 +2494,8 @@ export type Determination = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly typeStatusName: string | null; - readonly text1: string | null; readonly varQualifier: string | null; readonly version: number | null; - readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; @@ -2582,9 +2583,9 @@ export type Discipline = { readonly division: Division; readonly geographyTreeDef: GeographyTreeDef; readonly lithoStratTreeDef: LithoStratTreeDef | null; - readonly tectonicUnitTreeDef: TectonicUnitTreeDef | null; readonly modifiedByAgent: Agent | null; readonly taxonTreeDef: TaxonTreeDef | null; + readonly tectonicUnitTreeDef: TectonicUnitTreeDef | null; }; readonly toManyDependent: RR; readonly toManyIndependent: { @@ -3104,6 +3105,8 @@ export type GeoCoordDetail = { readonly integer3: number | null; readonly integer4: number | null; readonly integer5: number | null; + readonly maxUncertaintyEst: number | null; + readonly maxUncertaintyEstUnit: string | null; readonly namedPlaceExtent: number | null; readonly noGeoRefBecause: string | null; readonly number1: number | null; @@ -3122,8 +3125,6 @@ export type GeoCoordDetail = { readonly timestampCreated: string; readonly timestampModified: string | null; readonly uncertaintyPolygon: string | null; - readonly maxUncertaintyEst: number | null; - readonly maxUncertaintyEstUnit: string | null; readonly validation: string | null; readonly version: number | null; readonly yesNo1: boolean | null; @@ -3346,8 +3347,8 @@ export type Gift = { readonly srcTaxonomy: string | null; readonly specialConditions: string | null; readonly status: string | null; - readonly text1: string | null; readonly text2: string | null; + readonly text1: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3716,6 +3717,7 @@ export type Loan = { readonly dateClosed: string | null; readonly dateReceived: string | null; readonly yesNo1: boolean | null; + readonly text2: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -3737,7 +3739,6 @@ export type Loan = { readonly specialConditions: string | null; readonly status: string | null; readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3863,10 +3864,8 @@ export type LoanReturnPreparation = { export type Locality = { readonly tableName: 'Locality'; readonly fields: { - readonly timestampCreated: string; readonly datum: string | null; readonly elevationAccuracy: number | null; - readonly elevationMethod: string | null; readonly gml: string | null; readonly guid: string | null; readonly latLongMethod: string | null; @@ -3883,8 +3882,8 @@ export type Locality = { readonly longitude2: number | null; readonly maxElevation: number | null; readonly minElevation: number | null; - readonly timestampModified: string | null; readonly namedPlace: string | null; + readonly originalElevationUnit: string | null; readonly originalLatLongUnit: number | null; readonly relationToNamedPlace: string | null; readonly remarks: string | null; @@ -3896,13 +3895,15 @@ export type Locality = { readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly uniqueIdentifier: string | null; - readonly originalElevationUnit: string | null; readonly verbatimElevation: string | null; readonly verbatimLatitude: string | null; readonly verbatimLongitude: string | null; readonly version: number | null; readonly visibility: number | null; + readonly elevationMethod: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -3916,8 +3917,8 @@ export type Locality = { readonly toOneIndependent: { readonly createdByAgent: Agent | null; readonly discipline: Discipline; - readonly modifiedByAgent: Agent | null; readonly geography: Geography | null; + readonly modifiedByAgent: Agent | null; readonly paleoContext: PaleoContext | null; readonly visibilitySetBy: SpecifyUser | null; }; @@ -4176,6 +4177,7 @@ export type OtherIdentifier = { export type PaleoContext = { readonly tableName: 'PaleoContext'; readonly fields: { + readonly text1: string | null; readonly paleoContextName: string | null; readonly number1: number | null; readonly number2: number | null; @@ -4183,7 +4185,6 @@ export type PaleoContext = { readonly number4: number | null; readonly number5: number | null; readonly remarks: string | null; - readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; @@ -4397,12 +4398,10 @@ export type Preparation = { readonly sampleNumber: string | null; readonly status: string | null; readonly storageLocation: string | null; - readonly text1: string | null; readonly text10: string | null; readonly text11: string | null; readonly text12: string | null; readonly text13: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -4412,8 +4411,10 @@ export type Preparation = { readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly version: number | null; + readonly text1: string | null; readonly yesNo1: boolean | null; + readonly version: number | null; + readonly text2: string | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; }; @@ -4790,7 +4791,10 @@ export type RecordSetItem = { export type ReferenceWork = { readonly tableName: 'ReferenceWork'; readonly fields: { + readonly text1: string | null; + readonly workDate: string | null; readonly doi: string | null; + readonly text2: string | null; readonly guid: string | null; readonly isPublished: boolean | null; readonly isbn: string | null; @@ -4801,8 +4805,6 @@ export type ReferenceWork = { readonly placeOfPublication: string | null; readonly publisher: string | null; readonly remarks: string | null; - readonly text1: string | null; - readonly text2: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly title: string; @@ -4811,7 +4813,6 @@ export type ReferenceWork = { readonly url: string | null; readonly version: number | null; readonly volume: string | null; - readonly workDate: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; }; @@ -4909,9 +4910,9 @@ export type RepositoryAgreementAttachment = { export type Shipment = { readonly tableName: 'Shipment'; readonly fields: { + readonly numberOfPackages: number | null; readonly insuredForAmount: string | null; readonly shipmentMethod: string | null; - readonly numberOfPackages: number | null; readonly number1: number | null; readonly number2: number | null; readonly remarks: string | null; @@ -5625,7 +5626,6 @@ export type Taxon = { readonly colStatus: string | null; readonly commonName: string | null; readonly cultivarName: string | null; - readonly environmentalProtectionStatus: string | null; readonly esaStatus: string | null; readonly fullName: string | null; readonly groupNumber: string | null; @@ -5649,6 +5649,7 @@ export type Taxon = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; + readonly environmentalProtectionStatus: string | null; readonly rankId: number; readonly remarks: string | null; readonly source: string | null; diff --git a/specifyweb/specify/migrations/0007_tectonic_ranks.py b/specifyweb/specify/migrations/0008_tectonic_ranks.py similarity index 97% rename from specifyweb/specify/migrations/0007_tectonic_ranks.py rename to specifyweb/specify/migrations/0008_tectonic_ranks.py index 73c93fc98e5..4485ef4a66a 100644 --- a/specifyweb/specify/migrations/0007_tectonic_ranks.py +++ b/specifyweb/specify/migrations/0008_tectonic_ranks.py @@ -1,5 +1,4 @@ -from django.apps import apps as specify_apps -from django.db import migrations, models +from django.db import migrations from specifyweb.specify.models import protect_with_blockers @@ -118,7 +117,7 @@ def revert_create_root_tectonic_node(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('specify', '0006_fix_tectonic_tree_fields'), + ('specify', '0007_schema_config_update'), ] def consolidated_python_django_migration_operations(apps, schema_editor):