diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 3a89be3..b98cb7f 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.1.0 +current_version = 1.2.7 commit = True tag = True diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 824dd3a..52256bb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,6 +11,9 @@ jobs: # if: ${{ github.event.workflow_run.conclusion == 'success' }} name: Build and publish Python 🐍 distributions 📦 to PyPI runs-on: ubuntu-latest + permissions: + id-token: write + environment: hormiai76 steps: - uses: actions/checkout@master - name: Set up Python 3.10 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml.old similarity index 100% rename from .github/workflows/test.yml rename to .github/workflows/test.yml.old diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 31da589..36bb0ff 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -21,7 +21,7 @@ jobs: name: Get latest release uses: pozetroninc/github-action-get-latest-release@master with: - repository: ispyb/ispyb-database + repository: hormiai76/ispyb-database - uses: actions/checkout@v3 - name: Check if update required run: | @@ -50,7 +50,7 @@ jobs: password=password database=ispyb_build EOF - wget https://github.com/ispyb/ispyb-database/archive/refs/tags/v${SCHEMA_VERSION}.tar.gz + wget https://github.com/hormiai76/ispyb-database/archive/refs/tags/v${SCHEMA_VERSION}.tar.gz tar xfz v${SCHEMA_VERSION}.tar.gz ls cd ispyb-database-${SCHEMA_VERSION} diff --git a/HISTORY.md b/HISTORY.md index 4759434..c6304d1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,38 @@ ## Unreleased / main +## v1.2.7 (03/06/2026) + +Update `type` Enum values in the `Dewar` table. + + +## v1.2.6 (26/11/2024) + +Update `fyleType` Enum values in the `SSXProcessingResultAttachment` table. + + +## v1.2.5 (26/11/2024) + +Make `dataCollectionId` mandatory in the `SSXProcessingResult` table. +Create a new entry in the `Permission` table to be used by beamine service accounts. + +## v1.2.4 (13/11/2024) + +Add `nbCrystals` to `SSXProcessingResult` table. + +## v1.2.3 (11/11/2024) + +Add `LineScan` and `GphNative` to `DataCollectionGroup.experimentType`. + + +## v1.2.2 (13/09/2024) + +Create new tables + +- SSXProcessingResult +- SSXProcessingResultAttachment + + ## v1.1.0 (17/01/2023) Create new tables: @@ -14,7 +46,7 @@ Create new tables: - EventType - Event -Add SSX-Chip and SSX-Jet to DataCollectionGroup.experimentType. +Add `SSX-Chip` and `SSX-Jet` to `DataCollectionGroup.experimentType`. ## v1.0.0 (20/07/2022) diff --git a/generate_models.sh b/generate_models.sh old mode 100644 new mode 100755 diff --git a/requirements.txt b/requirements.txt index a680c96..cc0f06f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ sqlalchemy mysql-connector-python==8.0.29 pytest +black +sqlacodegen diff --git a/setup.cfg b/setup.cfg index e602c3e..8eff894 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] -name = ispyb-models -version = 1.1.0 +name = ispyb-models-pyispyb +version = 1.2.7 description = SQLAlchemy ORM models for the ISPyB database long_description = file: README.md long_description_content_type = text/markdown @@ -22,7 +22,7 @@ keywords = ISPyB database SQLAlchemy -url = https://github.com/ispyb/ispyb-models +url = https://github.com/hormiai76/ispyb-models [options] include_package_data = True diff --git a/src/ispyb/models/__init__.py b/src/ispyb/models/__init__.py index 32e5efe..2dd8c35 100644 --- a/src/ispyb/models/__init__.py +++ b/src/ispyb/models/__init__.py @@ -30,7 +30,7 @@ EventChain, ) -__version__ = "1.1.0" +__version__ = "1.2.6" DataCollection.GridInfo = relationship( "GridInfo", secondary="DataCollectionGroup", back_populates="DataCollection" diff --git a/src/ispyb/models/_auto_db_schema.py b/src/ispyb/models/_auto_db_schema.py index 3ffaae2..a18ea24 100644 --- a/src/ispyb/models/_auto_db_schema.py +++ b/src/ispyb/models/_auto_db_schema.py @@ -31,7 +31,6 @@ from .base import CustomBase - Base = declarative_base(cls=CustomBase) metadata = Base.metadata @@ -1348,6 +1347,8 @@ class XRFFluorescenceMappingROI(Base): "Still", "SSX-Chip", "SSX-Jet", + "LineScan", + "GphNative", ), ), Column("DataCollectionGroup_startTime", DateTime), @@ -1693,6 +1694,8 @@ class XRFFluorescenceMappingROI(Base): "Still", "SSX-Chip", "SSX-Jet", + "LineScan", + "GphNative", ), ), Column("DataCollectionGroup_startTime", DateTime), @@ -2002,7 +2005,7 @@ class XRFFluorescenceMappingROI(Base): Column("transportValue", INTEGER(10)), Column("trackingNumberToSynchrotron", String(30)), Column("trackingNumberFromSynchrotron", String(30)), - Column("type", Enum("Dewar", "Toolbox"), server_default=text("'Dewar'")), + Column("type", Enum("Dewar", "Toolbox", "Other"), server_default=text("'Dewar'")), Column("isReimbursed", TINYINT(1), server_default=text("'0'")), Column("sessionId", INTEGER(10), server_default=text("'0'")), Column("beamlineName", String(45)), @@ -2735,7 +2738,9 @@ class XRFFluorescenceMappingROI(Base): Column("Dewar_firstExperimentId", INTEGER(10)), Column("Dewar_trackingNumberToSynchrotron", String(30)), Column("Dewar_trackingNumberFromSynchrotron", String(30)), - Column("Dewar_type", Enum("Dewar", "Toolbox"), server_default=text("'Dewar'")), + Column( + "Dewar_type", Enum("Dewar", "Toolbox", "Other"), server_default=text("'Dewar'") + ), Column("Shipping_shippingId", INTEGER(10), server_default=text("'0'")), Column("Shipping_proposalId", INTEGER(10), server_default=text("'0'")), Column("Shipping_shippingName", String(45)), @@ -4683,7 +4688,9 @@ class Dewar(Base): trackingNumberFromSynchrotron = Column(String(30)) facilityCode = Column(String(20), comment="Unique barcode assigned to each dewar") type = Column( - Enum("Dewar", "Toolbox"), nullable=False, server_default=text("'Dewar'") + Enum("Dewar", "Toolbox", "Other"), + nullable=False, + server_default=text("'Dewar'"), ) isReimbursed = Column( TINYINT(1), @@ -5319,6 +5326,8 @@ class DataCollectionGroup(Base): "Still", "SSX-Chip", "SSX-Jet", + "LineScan", + "GphNative", ) ) startTime = Column(DateTime, comment="Start time of the dataCollectionGroup") @@ -6361,6 +6370,37 @@ class SSXDataCollection(Base): DataCollection = relationship("DataCollection", uselist=False) +class SSXProcessingResult(Base): + __tablename__ = "SSXProcessingResult" + __table_args__ = {"comment": "Processing Results table for SSX experiments."} + + ssxProcessingResultId = Column(INTEGER(11), primary_key=True, comment="Primary key") + dataCollectionId = Column( + ForeignKey( + "DataCollection.dataCollectionId", ondelete="CASCADE", onupdate="CASCADE" + ), + nullable=False, + index=True, + ) + hitRate = Column(Float) + indexingRate = Column(Float) + indexingType = Column(Enum("Preliminary", "Final")) + status = Column(Enum("Running", "Failed", "Success")) + createdTimeStamp = Column( + TIMESTAMP, nullable=False, server_default=text("current_timestamp()") + ) + lastUpdate = Column( + TIMESTAMP, + nullable=False, + server_default=text("current_timestamp()"), + comment="last update timestamp", + ) + comments = Column(String(100)) + nbCrystals = Column(INTEGER(11), comment="Number of crystals") + + DataCollection = relationship("DataCollection") + + class XRFFluorescenceMapping(Base): __tablename__ = "XRFFluorescenceMapping" @@ -6587,6 +6627,41 @@ class PDBEntry(Base): AutoProcProgram = relationship("AutoProcProgram") +class SSXProcessingResultAttachment(Base): + __tablename__ = "SSXProcessingResultAttachment" + __table_args__ = { + "comment": "Processing Results attachments table for SSX experiments." + } + + ssxProcessingResultAttachmentId = Column( + INTEGER(11), primary_key=True, comment="Primary key" + ) + ssxProcessingResultId = Column( + ForeignKey( + "SSXProcessingResult.ssxProcessingResultId", + ondelete="CASCADE", + onupdate="CASCADE", + ), + index=True, + ) + fileName = Column(String(255), nullable=False) + filePath = Column(String(255), nullable=False) + fileType = Column( + Enum("Real-time processing results", "Processing results"), nullable=False + ) + createdTimeStamp = Column( + TIMESTAMP, nullable=False, server_default=text("current_timestamp()") + ) + lastUpdate = Column( + TIMESTAMP, + nullable=False, + server_default=text("current_timestamp()"), + comment="last update timestamp", + ) + + SSXProcessingResult = relationship("SSXProcessingResult") + + class WorkflowMesh(Base): __tablename__ = "WorkflowMesh" diff --git a/tests/conftest.py b/tests/conftest.py index ae46a07..8754102 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,7 +6,6 @@ import sqlalchemy.orm import sqlalchemy.schema - engine = sqlalchemy.create_engine( url=os.environ["SQLALCHEMY_DATABASE_URI"], connect_args={"use_pure": True},