Skip to content

mihcsme_py.models#

mihcsme_py.models #

Pydantic models for MIHCSME metadata structure.

Assay pydantic-model #

Bases: BaseModel

Assay information.

Show JSON schema:
{
  "description": "Assay information.",
  "properties": {
    "Assay Title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Screen name",
      "title": "Assay Title"
    },
    "Assay internal ID": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Experimental ID, e.g. aMV-010, linked to ELN or labjournal",
      "title": "Assay Internal Id"
    },
    "Assay Description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Description of screen plus additional unstructured information",
      "title": "Assay Description"
    },
    "Assay number of biological replicates": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Total number of biol. Repl.",
      "title": "Assay Number Of Biological Replicates"
    },
    "Number of plates": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Total number of plates, n-plates",
      "title": "Number Of Plates"
    },
    "Assay Technology Type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Imaging method, Fbbi terms",
      "title": "Assay Technology Type"
    },
    "Assay Type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "List of options: sub types of HCS e.g. Gene Knock down, RNAi, compound, EFO terms",
      "title": "Assay Type"
    },
    "Assay External URL": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ELN or any other external url link to this screen",
      "title": "Assay External Url"
    },
    "Assay data URL": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "OMERO url link to this screen",
      "title": "Assay Data Url"
    }
  },
  "title": "Assay",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

assay_data_url: Optional[str] = None pydantic-field #

OMERO url link to this screen

assay_description: Optional[str] = None pydantic-field #

Description of screen plus additional unstructured information

assay_external_url: Optional[str] = None pydantic-field #

ELN or any other external url link to this screen

assay_internal_id: StringCoerced = None pydantic-field #

Experimental ID, e.g. aMV-010, linked to ELN or labjournal

assay_number_of_biological_replicates: StringCoerced = None pydantic-field #

Total number of biol. Repl.

assay_technology_type: Optional[str] = None pydantic-field #

Imaging method, Fbbi terms

assay_title: Optional[str] = None pydantic-field #

Screen name

assay_type: Optional[str] = None pydantic-field #

List of options: sub types of HCS e.g. Gene Knock down, RNAi, compound, EFO terms

number_of_plates: StringCoerced = None pydantic-field #

Total number of plates, n-plates

AssayComponent pydantic-model #

Bases: BaseModel

Assay component information.

Show JSON schema:
{
  "description": "Assay component information.",
  "properties": {
    "Imaging protocol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Url to protocols.io or protocols in ELN, at least protocol file name",
      "title": "Imaging Protocol"
    },
    "Sample preparation protocol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Sample preparation method (Formaldahyde (PFA) fixed tissue, Live cells, unfixed tissue)",
      "title": "Sample Preparation Protocol"
    }
  },
  "title": "AssayComponent",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

imaging_protocol: Optional[str] = None pydantic-field #

Url to protocols.io or protocols in ELN, at least protocol file name

sample_preparation_protocol: Optional[str] = None pydantic-field #

Sample preparation method (Formaldahyde (PFA) fixed tissue, Live cells, unfixed tissue)

AssayCondition pydantic-model #

Bases: BaseModel

Single well condition from AssayConditions sheet.

All metadata fields (Treatment, Dose, CellLine, etc.) are stored in the conditions dictionary for maximum flexibility.

Attributes:

Name Type Description
plate str

Plate identifier/name

well str

Well identifier (e.g., A01, B12) - auto-normalized

conditions Dict[str, Any]

Dictionary of all metadata key-value pairs for this well

Show JSON schema:
{
  "description": "Single well condition from AssayConditions sheet.\n\nAll metadata fields (Treatment, Dose, CellLine, etc.) are stored in the\nconditions dictionary for maximum flexibility.\n\nAttributes:\n    plate: Plate identifier/name\n    well: Well identifier (e.g., A01, B12) - auto-normalized\n    conditions: Dictionary of all metadata key-value pairs for this well",
  "example": {
    "conditions": {
      "CellLine": "HeLa",
      "Dose": "0.1",
      "DoseUnit": "\u00b5M",
      "Treatment": "DMSO"
    },
    "plate": "Plate1",
    "well": "A01"
  },
  "properties": {
    "plate": {
      "description": "Plate identifier/name",
      "title": "Plate",
      "type": "string"
    },
    "well": {
      "description": "Well identifier (e.g., A01, B12)",
      "title": "Well",
      "type": "string"
    },
    "conditions": {
      "additionalProperties": true,
      "description": "All metadata fields for this well (Treatment, Dose, etc.)",
      "title": "Conditions",
      "type": "object"
    }
  },
  "required": [
    "plate",
    "well"
  ],
  "title": "AssayCondition",
  "type": "object"
}

Config:

  • populate_by_name: True
  • json_schema_extra: {'example': {'plate': 'Plate1', 'well': 'A01', 'conditions': {'Treatment': 'DMSO', 'Dose': '0.1', 'DoseUnit': 'µM', 'CellLine': 'HeLa'}}}

Fields:

Validators:

conditions: Dict[str, Any] pydantic-field #

All metadata fields for this well (Treatment, Dose, etc.)

plate: str pydantic-field #

Plate identifier/name

well: str pydantic-field #

Well identifier (e.g., A01, B12)

normalize_well_name(v: str) -> str pydantic-validator #

Normalize well names to zero-padded format (A01).

Source code in src/mihcsme_py/models.py
@field_validator("well")
@classmethod
def normalize_well_name(cls, v: str) -> str:
    """Normalize well names to zero-padded format (A01)."""
    v = v.strip().upper()
    if len(v) < 2:
        raise ValueError(f"Invalid well format: {v}")

    row_letter = v[0]
    col_part = v[1:]

    if not ("A" <= row_letter <= "P"):
        raise ValueError(f"Invalid row letter (must be A-P): {row_letter}")

    try:
        col_num = int(col_part)
        if not (1 <= col_num <= 48):
            raise ValueError(f"Invalid column number (must be 1-48): {col_num}")
        return f"{row_letter}{col_num:02d}"
    except ValueError:
        raise ValueError(f"Invalid well format: {v}")

to_dict() -> Dict[str, Any] #

Convert AssayCondition to a flat dictionary for upload/export.

Returns:

Type Description
Dict[str, Any]

Dictionary with Plate, Well, and all condition fields

Source code in src/mihcsme_py/models.py
def to_dict(self) -> Dict[str, Any]:
    """Convert AssayCondition to a flat dictionary for upload/export.

    Returns:
        Dictionary with Plate, Well, and all condition fields
    """
    return {"Plate": self.plate, "Well": self.well, **self.conditions}

AssayInformation pydantic-model #

Bases: BaseModel

Assay-level metadata with structured fields.

Show JSON schema:
{
  "$defs": {
    "Assay": {
      "description": "Assay information.",
      "properties": {
        "Assay Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Screen name",
          "title": "Assay Title"
        },
        "Assay internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Experimental ID, e.g. aMV-010, linked to ELN or labjournal",
          "title": "Assay Internal Id"
        },
        "Assay Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of screen plus additional unstructured information",
          "title": "Assay Description"
        },
        "Assay number of biological replicates": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Total number of biol. Repl.",
          "title": "Assay Number Of Biological Replicates"
        },
        "Number of plates": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Total number of plates, n-plates",
          "title": "Number Of Plates"
        },
        "Assay Technology Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Imaging method, Fbbi terms",
          "title": "Assay Technology Type"
        },
        "Assay Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of options: sub types of HCS e.g. Gene Knock down, RNAi, compound, EFO terms",
          "title": "Assay Type"
        },
        "Assay External URL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ELN or any other external url link to this screen",
          "title": "Assay External Url"
        },
        "Assay data URL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "OMERO url link to this screen",
          "title": "Assay Data Url"
        }
      },
      "title": "Assay",
      "type": "object"
    },
    "AssayComponent": {
      "description": "Assay component information.",
      "properties": {
        "Imaging protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url to protocols.io or protocols in ELN, at least protocol file name",
          "title": "Imaging Protocol"
        },
        "Sample preparation protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sample preparation method (Formaldahyde (PFA) fixed tissue, Live cells, unfixed tissue)",
          "title": "Sample Preparation Protocol"
        }
      },
      "title": "AssayComponent",
      "type": "object"
    },
    "BiosampleAssay": {
      "description": "Biosample information specific to assay.",
      "properties": {
        "Cell lines storage location": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Storage location according to Database used or at least location",
          "title": "Cell Lines Storage Location"
        },
        "Cell lines clone number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Storage location DB info",
          "title": "Cell Lines Clone Number"
        },
        "Cell lines Passage number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Passage number of your cells",
          "title": "Cell Lines Passage Number"
        }
      },
      "title": "BiosampleAssay",
      "type": "object"
    },
    "Channel": {
      "description": "Single channel information for specimen imaging.",
      "properties": {
        "visualization_method": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Visualization method (e.g., Hoechst staining, GFP)",
          "title": "Visualization Method"
        },
        "entity": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Entity visualized (e.g., DNA, MAP1LC3B)",
          "title": "Entity"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Label used for entity (e.g., Nuclei, GFP-LC3)",
          "title": "Label"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sequential id of channel order in your image",
          "title": "Id"
        }
      },
      "title": "Channel",
      "type": "object"
    },
    "ImageAcquisition": {
      "description": "Image acquisition information.",
      "properties": {
        "Microscope id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url to micrometa app file link or other url describing your microscope",
          "title": "Microscope Id"
        }
      },
      "title": "ImageAcquisition",
      "type": "object"
    },
    "ImageData": {
      "description": "Image data information.",
      "properties": {
        "Image number of pixelsX": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of pixels in x in images",
          "title": "Image Number Of Pixelsx"
        },
        "Image number of pixelsY": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of pixels in y in images",
          "title": "Image Number Of Pixelsy"
        },
        "Image number of  z-stacks": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number z stacks in image, single image is z=1",
          "title": "Image Number Of  Z-Stacks"
        },
        "Image number of channels": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of channels in your image",
          "title": "Image Number Of Channels"
        },
        "Image number of timepoints": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of time point(s) in your image",
          "title": "Image Number Of Timepoints"
        },
        "Image sites per well": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Number of fields, numeric value",
          "title": "Image Sites Per Well"
        }
      },
      "title": "ImageData",
      "type": "object"
    },
    "Specimen": {
      "description": "Specimen/channel information with dynamic channel support.\n\nChannels are stored as a list internally but can be converted to/from\nthe flat Excel format (Channel 1 visualization method, etc.).",
      "properties": {
        "Channel Transmission id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Channel id is dependent on different machines, first or last. If No transmission is acquired state NA",
          "title": "Channel Transmission Id"
        },
        "channels": {
          "description": "List of channel information (supports up to 8 channels)",
          "items": {
            "$ref": "#/$defs/Channel"
          },
          "title": "Channels",
          "type": "array"
        }
      },
      "title": "Specimen",
      "type": "object"
    }
  },
  "additionalProperties": true,
  "description": "Assay-level metadata with structured fields.",
  "example": {
    "assay": {
      "assay_internal_id": "ASY-001",
      "assay_title": "Example Screen"
    },
    "image_data": {
      "image_number_of_channels": "3"
    }
  },
  "properties": {
    "assay": {
      "anyOf": [
        {
          "$ref": "#/$defs/Assay"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Assay information"
    },
    "assay_component": {
      "anyOf": [
        {
          "$ref": "#/$defs/AssayComponent"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Assay component information"
    },
    "biosample": {
      "anyOf": [
        {
          "$ref": "#/$defs/BiosampleAssay"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Biosample information"
    },
    "image_data": {
      "anyOf": [
        {
          "$ref": "#/$defs/ImageData"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Image data information"
    },
    "image_acquisition": {
      "anyOf": [
        {
          "$ref": "#/$defs/ImageAcquisition"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Image acquisition information"
    },
    "specimen": {
      "anyOf": [
        {
          "$ref": "#/$defs/Specimen"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Specimen/channel information"
    }
  },
  "title": "AssayInformation",
  "type": "object"
}

Config:

  • extra: allow
  • json_schema_extra: {'example': {'assay': {'assay_title': 'Example Screen', 'assay_internal_id': 'ASY-001'}, 'image_data': {'image_number_of_channels': '3'}}}

Fields:

assay: Optional[Assay] = None pydantic-field #

Assay information

assay_component: Optional[AssayComponent] = None pydantic-field #

Assay component information

biosample: Optional[BiosampleAssay] = None pydantic-field #

Biosample information

groups: Dict[str, Dict[str, Any]] property #

Convert to groups dictionary format for OMERO upload.

image_acquisition: Optional[ImageAcquisition] = None pydantic-field #

Image acquisition information

image_data: Optional[ImageData] = None pydantic-field #

Image data information

specimen: Optional[Specimen] = None pydantic-field #

Specimen/channel information

from_groups_dict(groups: Dict[str, Dict[str, Any]]) -> 'AssayInformation' classmethod #

Create from groups dictionary format.

Source code in src/mihcsme_py/models.py
@classmethod
def from_groups_dict(cls, groups: Dict[str, Dict[str, Any]]) -> "AssayInformation":
    """Create from groups dictionary format."""
    # Parse Assay
    assay = None
    if "Assay" in groups:
        assay = Assay(**groups["Assay"])

    # Parse AssayComponent
    assay_component = None
    if "AssayComponent" in groups:
        assay_component = AssayComponent(**groups["AssayComponent"])

    # Parse Biosample
    biosample = None
    if "Biosample" in groups:
        biosample = BiosampleAssay(**groups["Biosample"])

    # Parse ImageData
    image_data = None
    if "ImageData" in groups:
        image_data = ImageData(**groups["ImageData"])

    # Parse ImageAcquisition
    image_acquisition = None
    if "ImageAcquisition" in groups:
        image_acquisition = ImageAcquisition(**groups["ImageAcquisition"])

    # Parse Specimen - use from_flat_dict() for Excel/OMERO compatibility
    specimen = None
    if "Specimen" in groups:
        specimen = Specimen.from_flat_dict(groups["Specimen"])

    return cls(
        assay=assay,
        assay_component=assay_component,
        biosample=biosample,
        image_data=image_data,
        image_acquisition=image_acquisition,
        specimen=specimen,
    )

to_groups_dict() -> Dict[str, Dict[str, Any]] #

Convert to groups dictionary format.

Source code in src/mihcsme_py/models.py
def to_groups_dict(self) -> Dict[str, Dict[str, Any]]:
    """Convert to groups dictionary format."""
    groups = {}

    # Assay group - automatically include all fields
    if self.assay:
        data = _model_to_dict_with_aliases(self.assay)
        if data:
            groups["Assay"] = data

    # AssayComponent group - automatically include all fields
    if self.assay_component:
        data = _model_to_dict_with_aliases(self.assay_component)
        if data:
            groups["AssayComponent"] = data

    # Biosample group - automatically include all fields
    if self.biosample:
        data = _model_to_dict_with_aliases(self.biosample)
        if data:
            groups["Biosample"] = data

    # ImageData group - automatically include all fields
    if self.image_data:
        data = _model_to_dict_with_aliases(self.image_data)
        if data:
            groups["ImageData"] = data

    # ImageAcquisition group - automatically include all fields
    if self.image_acquisition:
        data = _model_to_dict_with_aliases(self.image_acquisition)
        if data:
            groups["ImageAcquisition"] = data

    # Specimen group - use to_flat_dict() for Excel/OMERO compatibility
    if self.specimen:
        data = self.specimen.to_flat_dict()
        if data:
            groups["Specimen"] = data

    return groups

Biosample pydantic-model #

Bases: BaseModel

Biosample information.

Show JSON schema:
{
  "description": "Biosample information.",
  "properties": {
    "Biosample Taxon": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "NCBI-taxon id, human = NCBITAXON:9606",
      "title": "Biosample Taxon"
    },
    "Biosample description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Description of biosample genotype",
      "title": "Biosample Description"
    },
    "Biosample Organism": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Which organism is your cell lines or tissue from. Examples: Human or mouse",
      "title": "Biosample Organism"
    },
    "Number of cell lines used": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "In case multiple cell lines are used indicate here",
      "title": "Number Of Cell Lines Used"
    }
  },
  "title": "Biosample",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

biosample_description: Optional[str] = None pydantic-field #

Description of biosample genotype

biosample_organism: Optional[str] = None pydantic-field #

Which organism is your cell lines or tissue from. Examples: Human or mouse

biosample_taxon: Optional[str] = None pydantic-field #

NCBI-taxon id, human = NCBITAXON:9606

number_of_cell_lines_used: StringCoerced = None pydantic-field #

In case multiple cell lines are used indicate here

BiosampleAssay pydantic-model #

Bases: BaseModel

Biosample information specific to assay.

Show JSON schema:
{
  "description": "Biosample information specific to assay.",
  "properties": {
    "Cell lines storage location": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Storage location according to Database used or at least location",
      "title": "Cell Lines Storage Location"
    },
    "Cell lines clone number": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Storage location DB info",
      "title": "Cell Lines Clone Number"
    },
    "Cell lines Passage number": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Passage number of your cells",
      "title": "Cell Lines Passage Number"
    }
  },
  "title": "BiosampleAssay",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

cell_lines_clone_number: StringCoerced = None pydantic-field #

Storage location DB info

cell_lines_passage_number: StringCoerced = None pydantic-field #

Passage number of your cells

cell_lines_storage_location: Optional[str] = None pydantic-field #

Storage location according to Database used or at least location

Channel pydantic-model #

Bases: BaseModel

Single channel information for specimen imaging.

Show JSON schema:
{
  "description": "Single channel information for specimen imaging.",
  "properties": {
    "visualization_method": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Visualization method (e.g., Hoechst staining, GFP)",
      "title": "Visualization Method"
    },
    "entity": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Entity visualized (e.g., DNA, MAP1LC3B)",
      "title": "Entity"
    },
    "label": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Label used for entity (e.g., Nuclei, GFP-LC3)",
      "title": "Label"
    },
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Sequential id of channel order in your image",
      "title": "Id"
    }
  },
  "title": "Channel",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

entity: Optional[str] = None pydantic-field #

Entity visualized (e.g., DNA, MAP1LC3B)

id: StringCoerced = None pydantic-field #

Sequential id of channel order in your image

label: Optional[str] = None pydantic-field #

Label used for entity (e.g., Nuclei, GFP-LC3)

visualization_method: Optional[str] = None pydantic-field #

Visualization method (e.g., Hoechst staining, GFP)

DataCollaborator pydantic-model #

Bases: BaseModel

Data collaborator information.

Show JSON schema:
{
  "description": "Data collaborator information.",
  "properties": {
    "ORCID  Data Collaborator": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ORCID ID of collaborator with experimental, collection or analysis part of this investigation",
      "title": "Orcid  Data Collaborator"
    }
  },
  "title": "DataCollaborator",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

orcid: OrcidUrl = None pydantic-field #

ORCID ID of collaborator with experimental, collection or analysis part of this investigation

DataOwner pydantic-model #

Bases: BaseModel

Data owner information.

Show JSON schema:
{
  "description": "Data owner information.",
  "properties": {
    "First Name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "First Name",
      "title": "First Name"
    },
    "Middle Name(s)": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Middle Name(s) if any",
      "title": "Middle Name(S)"
    },
    "Last Name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Last Name",
      "title": "Last Name"
    },
    "User name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Institutional user name",
      "title": "User Name"
    },
    "Institute": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Institute level, e.g. Universiteit Leiden, Faculty of Science, Institute of Biology",
      "title": "Institute"
    },
    "E-Mail Address": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Institution email address",
      "title": "E-Mail Address"
    },
    "ORCID investigator": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "ORCID ID as URL, e.g. https://orcid.org/0000-0002-3704-3675",
      "title": "Orcid Investigator"
    }
  },
  "title": "DataOwner",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

email: Optional[str] = None pydantic-field #

Institution email address

first_name: Optional[str] = None pydantic-field #

First Name

institute: Optional[str] = None pydantic-field #

Institute level, e.g. Universiteit Leiden, Faculty of Science, Institute of Biology

last_name: Optional[str] = None pydantic-field #

Last Name

middle_names: Optional[str] = None pydantic-field #

Middle Name(s) if any

orcid: OrcidUrl = None pydantic-field #

ORCID ID as URL, e.g. https://orcid.org/0000-0002-3704-3675

user_name: Optional[str] = None pydantic-field #

Institutional user name

ImageAcquisition pydantic-model #

Bases: BaseModel

Image acquisition information.

Show JSON schema:
{
  "description": "Image acquisition information.",
  "properties": {
    "Microscope id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Url to micrometa app file link or other url describing your microscope",
      "title": "Microscope Id"
    }
  },
  "title": "ImageAcquisition",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

microscope_id: StringCoerced = None pydantic-field #

Url to micrometa app file link or other url describing your microscope

ImageData pydantic-model #

Bases: BaseModel

Image data information.

Show JSON schema:
{
  "description": "Image data information.",
  "properties": {
    "Image number of pixelsX": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Indicate number of pixels in x in images",
      "title": "Image Number Of Pixelsx"
    },
    "Image number of pixelsY": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Indicate number of pixels in y in images",
      "title": "Image Number Of Pixelsy"
    },
    "Image number of  z-stacks": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Indicate number z stacks in image, single image is z=1",
      "title": "Image Number Of  Z-Stacks"
    },
    "Image number of channels": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Indicate number of channels in your image",
      "title": "Image Number Of Channels"
    },
    "Image number of timepoints": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Indicate number of time point(s) in your image",
      "title": "Image Number Of Timepoints"
    },
    "Image sites per well": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Number of fields, numeric value",
      "title": "Image Sites Per Well"
    }
  },
  "title": "ImageData",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

image_number_of_channels: StringCoerced = None pydantic-field #

Indicate number of channels in your image

image_number_of_pixelsx: StringCoerced = None pydantic-field #

Indicate number of pixels in x in images

image_number_of_pixelsy: StringCoerced = None pydantic-field #

Indicate number of pixels in y in images

image_number_of_timepoints: StringCoerced = None pydantic-field #

Indicate number of time point(s) in your image

image_number_of_z_stacks: StringCoerced = None pydantic-field #

Indicate number z stacks in image, single image is z=1

image_sites_per_well: StringCoerced = None pydantic-field #

Number of fields, numeric value

InvestigationInfo pydantic-model #

Bases: BaseModel

Core investigation information.

Show JSON schema:
{
  "description": "Core investigation information.",
  "properties": {
    "Project ID": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "EU/NWO/consortium ID \u2013 Examples: EuTOX",
      "title": "Project Id"
    },
    "Investigation Title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "High level concept to link related studies",
      "title": "Investigation Title"
    },
    "Investigation internal ID": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Corresponding internal ID for your investigation",
      "title": "Investigation Internal Id"
    },
    "Investigation description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Short description for your investigation",
      "title": "Investigation Description"
    }
  },
  "title": "InvestigationInfo",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

investigation_description: Optional[str] = None pydantic-field #

Short description for your investigation

investigation_internal_id: StringCoerced = None pydantic-field #

Corresponding internal ID for your investigation

investigation_title: Optional[str] = None pydantic-field #

High level concept to link related studies

project_id: StringCoerced = None pydantic-field #

EU/NWO/consortium ID – Examples: EuTOX

InvestigationInformation pydantic-model #

Bases: BaseModel

Investigation-level metadata with structured fields.

Show JSON schema:
{
  "$defs": {
    "DataCollaborator": {
      "description": "Data collaborator information.",
      "properties": {
        "ORCID  Data Collaborator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ORCID ID of collaborator with experimental, collection or analysis part of this investigation",
          "title": "Orcid  Data Collaborator"
        }
      },
      "title": "DataCollaborator",
      "type": "object"
    },
    "DataOwner": {
      "description": "Data owner information.",
      "properties": {
        "First Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "First Name",
          "title": "First Name"
        },
        "Middle Name(s)": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Middle Name(s) if any",
          "title": "Middle Name(S)"
        },
        "Last Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Last Name",
          "title": "Last Name"
        },
        "User name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institutional user name",
          "title": "User Name"
        },
        "Institute": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institute level, e.g. Universiteit Leiden, Faculty of Science, Institute of Biology",
          "title": "Institute"
        },
        "E-Mail Address": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institution email address",
          "title": "E-Mail Address"
        },
        "ORCID investigator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ORCID ID as URL, e.g. https://orcid.org/0000-0002-3704-3675",
          "title": "Orcid Investigator"
        }
      },
      "title": "DataOwner",
      "type": "object"
    },
    "InvestigationInfo": {
      "description": "Core investigation information.",
      "properties": {
        "Project ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "EU/NWO/consortium ID \u2013 Examples: EuTOX",
          "title": "Project Id"
        },
        "Investigation Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "High level concept to link related studies",
          "title": "Investigation Title"
        },
        "Investigation internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Corresponding internal ID for your investigation",
          "title": "Investigation Internal Id"
        },
        "Investigation description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Short description for your investigation",
          "title": "Investigation Description"
        }
      },
      "title": "InvestigationInfo",
      "type": "object"
    }
  },
  "additionalProperties": true,
  "description": "Investigation-level metadata with structured fields.",
  "example": {
    "data_owner": {
      "email": "j.doe@example.com",
      "first_name": "Jane",
      "last_name": "Doe",
      "orcid": "https://orcid.org/0000-0002-3704-3675"
    },
    "investigation_info": {
      "investigation_title": "Example Investigation",
      "project_id": "EuTOX"
    }
  },
  "properties": {
    "data_owner": {
      "anyOf": [
        {
          "$ref": "#/$defs/DataOwner"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Data owner information"
    },
    "data_collaborators": {
      "description": "List of data collaborators",
      "items": {
        "$ref": "#/$defs/DataCollaborator"
      },
      "title": "Data Collaborators",
      "type": "array"
    },
    "investigation_info": {
      "anyOf": [
        {
          "$ref": "#/$defs/InvestigationInfo"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Core investigation information"
    }
  },
  "title": "InvestigationInformation",
  "type": "object"
}

Config:

  • extra: allow
  • json_schema_extra: {'example': {'data_owner': {'first_name': 'Jane', 'last_name': 'Doe', 'email': 'j.doe@example.com', 'orcid': 'https://orcid.org/0000-0002-3704-3675'}, 'investigation_info': {'investigation_title': 'Example Investigation', 'project_id': 'EuTOX'}}}

Fields:

data_collaborators: List[DataCollaborator] pydantic-field #

List of data collaborators

data_owner: Optional[DataOwner] = None pydantic-field #

Data owner information

groups: Dict[str, Dict[str, Any]] property #

Convert to groups dictionary format for OMERO upload.

investigation_info: Optional[InvestigationInfo] = None pydantic-field #

Core investigation information

from_groups_dict(groups: Dict[str, Dict[str, Any]]) -> 'InvestigationInformation' classmethod #

Create from groups dictionary format.

Source code in src/mihcsme_py/models.py
@classmethod
def from_groups_dict(cls, groups: Dict[str, Dict[str, Any]]) -> "InvestigationInformation":
    """Create from groups dictionary format."""
    # Parse DataOwner
    data_owner = None
    if "DataOwner" in groups:
        data_owner = DataOwner(**groups["DataOwner"])

    # Parse DataCollaborators
    data_collaborators = []
    if "DataCollaborator" in groups:
        for key, value in groups["DataCollaborator"].items():
            if "ORCID" in key and value:
                data_collaborators.append(DataCollaborator(orcid=value))

    # Parse InvestigationInfo (note: group name is "InvestigationInfo", not "InvestigationInformation")
    investigation_info = None
    if "InvestigationInfo" in groups:
        investigation_info = InvestigationInfo(**groups["InvestigationInfo"])

    return cls(
        data_owner=data_owner,
        data_collaborators=data_collaborators,
        investigation_info=investigation_info,
    )

to_groups_dict() -> Dict[str, Dict[str, Any]] #

Convert to groups dictionary format.

Source code in src/mihcsme_py/models.py
def to_groups_dict(self) -> Dict[str, Dict[str, Any]]:
    """Convert to groups dictionary format."""
    groups = {}

    # DataOwner group - automatically include all fields
    if self.data_owner:
        data = _model_to_dict_with_aliases(self.data_owner)
        if data:
            groups["DataOwner"] = data

    # DataCollaborator group
    if self.data_collaborators:
        groups["DataCollaborator"] = {}
        for i, collab in enumerate(self.data_collaborators):
            if collab.orcid:
                # All use same key name per template
                groups["DataCollaborator"][f"ORCID  Data Collaborator_{i}"] = collab.orcid

    # InvestigationInfo group - automatically include all fields
    if self.investigation_info:
        data = _model_to_dict_with_aliases(self.investigation_info)
        if data:
            groups["InvestigationInfo"] = data

    return groups

Library pydantic-model #

Bases: BaseModel

Library information.

Show JSON schema:
{
  "description": "Library information.",
  "properties": {
    "Library File Name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Library file info",
      "title": "Library File Name"
    },
    "Library File Format": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Library file info",
      "title": "Library File Format"
    },
    "Library Type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Library file info",
      "title": "Library Type"
    },
    "Library Manufacturer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Library file info",
      "title": "Library Manufacturer"
    },
    "Library Version": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Library file info",
      "title": "Library Version"
    },
    "Library Experimental Conditions": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Any experimental conditions some cells were grown under as part of the study",
      "title": "Library Experimental Conditions"
    },
    "Quality Control Description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A brief description of the kind of quality control measures that were taken",
      "title": "Quality Control Description"
    }
  },
  "title": "Library",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

library_experimental_conditions: Optional[str] = None pydantic-field #

Any experimental conditions some cells were grown under as part of the study

library_file_format: Optional[str] = None pydantic-field #

Library file info

library_file_name: Optional[str] = None pydantic-field #

Library file info

library_manufacturer: Optional[str] = None pydantic-field #

Library file info

library_type: Optional[str] = None pydantic-field #

Library file info

library_version: StringCoerced = None pydantic-field #

Library file info

quality_control_description: Optional[str] = None pydantic-field #

A brief description of the kind of quality control measures that were taken

MIHCSMEMetadata pydantic-model #

Bases: BaseModel

Complete MIHCSME metadata structure.

Show JSON schema:
{
  "$defs": {
    "Assay": {
      "description": "Assay information.",
      "properties": {
        "Assay Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Screen name",
          "title": "Assay Title"
        },
        "Assay internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Experimental ID, e.g. aMV-010, linked to ELN or labjournal",
          "title": "Assay Internal Id"
        },
        "Assay Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of screen plus additional unstructured information",
          "title": "Assay Description"
        },
        "Assay number of biological replicates": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Total number of biol. Repl.",
          "title": "Assay Number Of Biological Replicates"
        },
        "Number of plates": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Total number of plates, n-plates",
          "title": "Number Of Plates"
        },
        "Assay Technology Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Imaging method, Fbbi terms",
          "title": "Assay Technology Type"
        },
        "Assay Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of options: sub types of HCS e.g. Gene Knock down, RNAi, compound, EFO terms",
          "title": "Assay Type"
        },
        "Assay External URL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ELN or any other external url link to this screen",
          "title": "Assay External Url"
        },
        "Assay data URL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "OMERO url link to this screen",
          "title": "Assay Data Url"
        }
      },
      "title": "Assay",
      "type": "object"
    },
    "AssayComponent": {
      "description": "Assay component information.",
      "properties": {
        "Imaging protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url to protocols.io or protocols in ELN, at least protocol file name",
          "title": "Imaging Protocol"
        },
        "Sample preparation protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sample preparation method (Formaldahyde (PFA) fixed tissue, Live cells, unfixed tissue)",
          "title": "Sample Preparation Protocol"
        }
      },
      "title": "AssayComponent",
      "type": "object"
    },
    "AssayCondition": {
      "description": "Single well condition from AssayConditions sheet.\n\nAll metadata fields (Treatment, Dose, CellLine, etc.) are stored in the\nconditions dictionary for maximum flexibility.\n\nAttributes:\n    plate: Plate identifier/name\n    well: Well identifier (e.g., A01, B12) - auto-normalized\n    conditions: Dictionary of all metadata key-value pairs for this well",
      "example": {
        "conditions": {
          "CellLine": "HeLa",
          "Dose": "0.1",
          "DoseUnit": "\u00b5M",
          "Treatment": "DMSO"
        },
        "plate": "Plate1",
        "well": "A01"
      },
      "properties": {
        "plate": {
          "description": "Plate identifier/name",
          "title": "Plate",
          "type": "string"
        },
        "well": {
          "description": "Well identifier (e.g., A01, B12)",
          "title": "Well",
          "type": "string"
        },
        "conditions": {
          "additionalProperties": true,
          "description": "All metadata fields for this well (Treatment, Dose, etc.)",
          "title": "Conditions",
          "type": "object"
        }
      },
      "required": [
        "plate",
        "well"
      ],
      "title": "AssayCondition",
      "type": "object"
    },
    "AssayInformation": {
      "additionalProperties": true,
      "description": "Assay-level metadata with structured fields.",
      "example": {
        "assay": {
          "assay_internal_id": "ASY-001",
          "assay_title": "Example Screen"
        },
        "image_data": {
          "image_number_of_channels": "3"
        }
      },
      "properties": {
        "assay": {
          "anyOf": [
            {
              "$ref": "#/$defs/Assay"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Assay information"
        },
        "assay_component": {
          "anyOf": [
            {
              "$ref": "#/$defs/AssayComponent"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Assay component information"
        },
        "biosample": {
          "anyOf": [
            {
              "$ref": "#/$defs/BiosampleAssay"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Biosample information"
        },
        "image_data": {
          "anyOf": [
            {
              "$ref": "#/$defs/ImageData"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Image data information"
        },
        "image_acquisition": {
          "anyOf": [
            {
              "$ref": "#/$defs/ImageAcquisition"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Image acquisition information"
        },
        "specimen": {
          "anyOf": [
            {
              "$ref": "#/$defs/Specimen"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Specimen/channel information"
        }
      },
      "title": "AssayInformation",
      "type": "object"
    },
    "Biosample": {
      "description": "Biosample information.",
      "properties": {
        "Biosample Taxon": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "NCBI-taxon id, human = NCBITAXON:9606",
          "title": "Biosample Taxon"
        },
        "Biosample description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of biosample genotype",
          "title": "Biosample Description"
        },
        "Biosample Organism": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Which organism is your cell lines or tissue from. Examples: Human or mouse",
          "title": "Biosample Organism"
        },
        "Number of cell lines used": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "In case multiple cell lines are used indicate here",
          "title": "Number Of Cell Lines Used"
        }
      },
      "title": "Biosample",
      "type": "object"
    },
    "BiosampleAssay": {
      "description": "Biosample information specific to assay.",
      "properties": {
        "Cell lines storage location": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Storage location according to Database used or at least location",
          "title": "Cell Lines Storage Location"
        },
        "Cell lines clone number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Storage location DB info",
          "title": "Cell Lines Clone Number"
        },
        "Cell lines Passage number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Passage number of your cells",
          "title": "Cell Lines Passage Number"
        }
      },
      "title": "BiosampleAssay",
      "type": "object"
    },
    "Channel": {
      "description": "Single channel information for specimen imaging.",
      "properties": {
        "visualization_method": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Visualization method (e.g., Hoechst staining, GFP)",
          "title": "Visualization Method"
        },
        "entity": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Entity visualized (e.g., DNA, MAP1LC3B)",
          "title": "Entity"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Label used for entity (e.g., Nuclei, GFP-LC3)",
          "title": "Label"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sequential id of channel order in your image",
          "title": "Id"
        }
      },
      "title": "Channel",
      "type": "object"
    },
    "DataCollaborator": {
      "description": "Data collaborator information.",
      "properties": {
        "ORCID  Data Collaborator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ORCID ID of collaborator with experimental, collection or analysis part of this investigation",
          "title": "Orcid  Data Collaborator"
        }
      },
      "title": "DataCollaborator",
      "type": "object"
    },
    "DataOwner": {
      "description": "Data owner information.",
      "properties": {
        "First Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "First Name",
          "title": "First Name"
        },
        "Middle Name(s)": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Middle Name(s) if any",
          "title": "Middle Name(S)"
        },
        "Last Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Last Name",
          "title": "Last Name"
        },
        "User name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institutional user name",
          "title": "User Name"
        },
        "Institute": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institute level, e.g. Universiteit Leiden, Faculty of Science, Institute of Biology",
          "title": "Institute"
        },
        "E-Mail Address": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institution email address",
          "title": "E-Mail Address"
        },
        "ORCID investigator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ORCID ID as URL, e.g. https://orcid.org/0000-0002-3704-3675",
          "title": "Orcid Investigator"
        }
      },
      "title": "DataOwner",
      "type": "object"
    },
    "ImageAcquisition": {
      "description": "Image acquisition information.",
      "properties": {
        "Microscope id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url to micrometa app file link or other url describing your microscope",
          "title": "Microscope Id"
        }
      },
      "title": "ImageAcquisition",
      "type": "object"
    },
    "ImageData": {
      "description": "Image data information.",
      "properties": {
        "Image number of pixelsX": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of pixels in x in images",
          "title": "Image Number Of Pixelsx"
        },
        "Image number of pixelsY": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of pixels in y in images",
          "title": "Image Number Of Pixelsy"
        },
        "Image number of  z-stacks": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number z stacks in image, single image is z=1",
          "title": "Image Number Of  Z-Stacks"
        },
        "Image number of channels": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of channels in your image",
          "title": "Image Number Of Channels"
        },
        "Image number of timepoints": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of time point(s) in your image",
          "title": "Image Number Of Timepoints"
        },
        "Image sites per well": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Number of fields, numeric value",
          "title": "Image Sites Per Well"
        }
      },
      "title": "ImageData",
      "type": "object"
    },
    "InvestigationInfo": {
      "description": "Core investigation information.",
      "properties": {
        "Project ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "EU/NWO/consortium ID \u2013 Examples: EuTOX",
          "title": "Project Id"
        },
        "Investigation Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "High level concept to link related studies",
          "title": "Investigation Title"
        },
        "Investigation internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Corresponding internal ID for your investigation",
          "title": "Investigation Internal Id"
        },
        "Investigation description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Short description for your investigation",
          "title": "Investigation Description"
        }
      },
      "title": "InvestigationInfo",
      "type": "object"
    },
    "InvestigationInformation": {
      "additionalProperties": true,
      "description": "Investigation-level metadata with structured fields.",
      "example": {
        "data_owner": {
          "email": "j.doe@example.com",
          "first_name": "Jane",
          "last_name": "Doe",
          "orcid": "https://orcid.org/0000-0002-3704-3675"
        },
        "investigation_info": {
          "investigation_title": "Example Investigation",
          "project_id": "EuTOX"
        }
      },
      "properties": {
        "data_owner": {
          "anyOf": [
            {
              "$ref": "#/$defs/DataOwner"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Data owner information"
        },
        "data_collaborators": {
          "description": "List of data collaborators",
          "items": {
            "$ref": "#/$defs/DataCollaborator"
          },
          "title": "Data Collaborators",
          "type": "array"
        },
        "investigation_info": {
          "anyOf": [
            {
              "$ref": "#/$defs/InvestigationInfo"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Core investigation information"
        }
      },
      "title": "InvestigationInformation",
      "type": "object"
    },
    "Library": {
      "description": "Library information.",
      "properties": {
        "Library File Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library File Name"
        },
        "Library File Format": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library File Format"
        },
        "Library Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Type"
        },
        "Library Manufacturer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Manufacturer"
        },
        "Library Version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Version"
        },
        "Library Experimental Conditions": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Any experimental conditions some cells were grown under as part of the study",
          "title": "Library Experimental Conditions"
        },
        "Quality Control Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A brief description of the kind of quality control measures that were taken",
          "title": "Quality Control Description"
        }
      },
      "title": "Library",
      "type": "object"
    },
    "Plate": {
      "description": "Plate information.",
      "properties": {
        "Plate type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: uclear",
          "title": "Plate Type"
        },
        "Plate type Manufacturer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: Greiner Bio-One",
          "title": "Plate Type Manufacturer"
        },
        "Plate type Catalog number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: 781081",
          "title": "Plate Type Catalog Number"
        }
      },
      "title": "Plate",
      "type": "object"
    },
    "Protocols": {
      "description": "Protocol information.",
      "properties": {
        "HCS library protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Hcs Library Protocol"
        },
        "growth protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Growth Protocol"
        },
        "treatment protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Treatment Protocol"
        },
        "HCS data analysis protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Hcs Data Analysis Protocol"
        }
      },
      "title": "Protocols",
      "type": "object"
    },
    "ReferenceSheet": {
      "description": "Reference sheet data (sheets starting with '_').",
      "example": {
        "data": {
          "Human": "Homo sapiens",
          "Mouse": "Mus musculus"
        },
        "name": "_Organisms"
      },
      "properties": {
        "name": {
          "description": "Sheet name (including '_' prefix)",
          "title": "Name",
          "type": "string"
        },
        "data": {
          "additionalProperties": true,
          "description": "Key-value pairs from reference sheet",
          "title": "Data",
          "type": "object"
        }
      },
      "required": [
        "name"
      ],
      "title": "ReferenceSheet",
      "type": "object"
    },
    "Specimen": {
      "description": "Specimen/channel information with dynamic channel support.\n\nChannels are stored as a list internally but can be converted to/from\nthe flat Excel format (Channel 1 visualization method, etc.).",
      "properties": {
        "Channel Transmission id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Channel id is dependent on different machines, first or last. If No transmission is acquired state NA",
          "title": "Channel Transmission Id"
        },
        "channels": {
          "description": "List of channel information (supports up to 8 channels)",
          "items": {
            "$ref": "#/$defs/Channel"
          },
          "title": "Channels",
          "type": "array"
        }
      },
      "title": "Specimen",
      "type": "object"
    },
    "Study": {
      "description": "Study information.",
      "properties": {
        "Study Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Manuscript/chapter/publication/paragraph title describing purpose or intention for one or multiple assays",
          "title": "Study Title"
        },
        "Study internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Study ID, linked to ELN or lab journal",
          "title": "Study Internal Id"
        },
        "Study Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of study with additional unstructured information",
          "title": "Study Description"
        },
        "Study Key Words": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of key words associated with your study (EFO-terms)",
          "title": "Study Key Words"
        }
      },
      "title": "Study",
      "type": "object"
    },
    "StudyInformation": {
      "additionalProperties": true,
      "description": "Study-level metadata with structured fields.",
      "example": {
        "biosample": {
          "biosample_organism": "Human"
        },
        "study": {
          "study_internal_id": "STD-001",
          "study_title": "Example Study"
        }
      },
      "properties": {
        "study": {
          "anyOf": [
            {
              "$ref": "#/$defs/Study"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Study information"
        },
        "biosample": {
          "anyOf": [
            {
              "$ref": "#/$defs/Biosample"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Biosample information"
        },
        "library": {
          "anyOf": [
            {
              "$ref": "#/$defs/Library"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library information"
        },
        "protocols": {
          "anyOf": [
            {
              "$ref": "#/$defs/Protocols"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Protocol information"
        },
        "plate": {
          "anyOf": [
            {
              "$ref": "#/$defs/Plate"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Plate information"
        }
      },
      "title": "StudyInformation",
      "type": "object"
    }
  },
  "description": "Complete MIHCSME metadata structure.",
  "example": {
    "assay_conditions": [
      {
        "conditions": {
          "Compound": "DMSO"
        },
        "plate": "Plate1",
        "well": "A01"
      }
    ],
    "investigation_information": {
      "groups": {
        "Investigation": {
          "Investigation Identifier": "INV-001"
        }
      }
    }
  },
  "properties": {
    "investigation_information": {
      "anyOf": [
        {
          "$ref": "#/$defs/InvestigationInformation"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "study_information": {
      "anyOf": [
        {
          "$ref": "#/$defs/StudyInformation"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "assay_information": {
      "anyOf": [
        {
          "$ref": "#/$defs/AssayInformation"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "assay_conditions": {
      "items": {
        "$ref": "#/$defs/AssayCondition"
      },
      "title": "Assay Conditions",
      "type": "array"
    },
    "reference_sheets": {
      "items": {
        "$ref": "#/$defs/ReferenceSheet"
      },
      "title": "Reference Sheets",
      "type": "array"
    }
  },
  "title": "MIHCSMEMetadata",
  "type": "object"
}

Config:

  • json_schema_extra: {'example': {'investigation_information': {'groups': {'Investigation': {'Investigation Identifier': 'INV-001'}}}, 'assay_conditions': [{'plate': 'Plate1', 'well': 'A01', 'conditions': {'Compound': 'DMSO'}}]}}

Fields:

from_dataframe(df: 'pd.DataFrame', **kwargs: Any) -> 'MIHCSMEMetadata' classmethod #

Create MIHCSMEMetadata from a pandas DataFrame of assay conditions.

Parameters:

Name Type Description Default
df 'pd.DataFrame'

DataFrame with at minimum 'Plate' and 'Well' columns. All other columns become condition fields in the conditions dict.

required
**kwargs Any

Additional fields for MIHCSMEMetadata (investigation_information, etc.)

{}

Returns:

Type Description
'MIHCSMEMetadata'

MIHCSMEMetadata instance with assay conditions from DataFrame

Example

import pandas as pd df = pd.DataFrame({ ... "Plate": ["Plate1", "Plate1"], ... "Well": ["A01", "A02"], ... "Treatment": ["DMSO", "Drug"], ... "Dose": ["0.1", "10"], ... "DoseUnit": ["µM", "µM"], ... }) metadata = MIHCSMEMetadata.from_dataframe(df)

Source code in src/mihcsme_py/models.py
@classmethod
def from_dataframe(cls, df: "pd.DataFrame", **kwargs: Any) -> "MIHCSMEMetadata":
    """
    Create MIHCSMEMetadata from a pandas DataFrame of assay conditions.

    Args:
        df: DataFrame with at minimum 'Plate' and 'Well' columns.
            All other columns become condition fields in the conditions dict.
        **kwargs: Additional fields for MIHCSMEMetadata (investigation_information, etc.)

    Returns:
        MIHCSMEMetadata instance with assay conditions from DataFrame

    Example:
        >>> import pandas as pd
        >>> df = pd.DataFrame({
        ...     "Plate": ["Plate1", "Plate1"],
        ...     "Well": ["A01", "A02"],
        ...     "Treatment": ["DMSO", "Drug"],
        ...     "Dose": ["0.1", "10"],
        ...     "DoseUnit": ["µM", "µM"],
        ... })
        >>> metadata = MIHCSMEMetadata.from_dataframe(df)
    """
    import pandas as pd

    if df.empty:
        return cls(assay_conditions=[], **kwargs)

    # Check required columns
    if "Plate" not in df.columns:
        raise ValueError("DataFrame must have a 'Plate' column")
    if "Well" not in df.columns:
        raise ValueError("DataFrame must have a 'Well' column")

    assay_conditions = []
    for _, row in df.iterrows():
        # Build condition dict with all columns except Plate and Well
        conditions = {}
        for col in df.columns:
            if col in ["Plate", "Well"]:
                continue  # Skip Plate and Well

            value = row[col]
            # Skip NaN/None values
            if pd.isna(value):
                continue

            # Convert all values to strings
            conditions[col] = str(value) if not isinstance(value, str) else value

        # Create AssayCondition
        assay_conditions.append(
            AssayCondition(
                plate=str(row["Plate"]),
                well=str(row["Well"]),
                conditions=conditions,
            )
        )

    return cls(assay_conditions=assay_conditions, **kwargs)

from_omero_dict(data: Dict[str, Any]) -> 'MIHCSMEMetadata' classmethod #

Create a MIHCSMEMetadata instance from OMERO dictionary format.

Parameters:

Name Type Description Default
data Dict[str, Any]

Dictionary in OMERO format

required

Returns:

Type Description
'MIHCSMEMetadata'

MIHCSMEMetadata instance

Source code in src/mihcsme_py/models.py
@classmethod
def from_omero_dict(cls, data: Dict[str, Any]) -> "MIHCSMEMetadata":
    """
    Create a MIHCSMEMetadata instance from OMERO dictionary format.

    Args:
        data: Dictionary in OMERO format

    Returns:
        MIHCSMEMetadata instance
    """
    investigation_info = None
    if "InvestigationInformation" in data:
        investigation_info = InvestigationInformation.from_groups_dict(
            data["InvestigationInformation"]
        )

    study_info = None
    if "StudyInformation" in data:
        study_info = StudyInformation.from_groups_dict(data["StudyInformation"])

    assay_info = None
    if "AssayInformation" in data:
        assay_info = AssayInformation.from_groups_dict(data["AssayInformation"])

    assay_conditions = []
    if "AssayConditions" in data and isinstance(data["AssayConditions"], list):
        for condition_dict in data["AssayConditions"]:
            plate = condition_dict.pop("Plate", "")
            well = condition_dict.pop("Well", "")
            # All remaining fields go into conditions
            assay_conditions.append(
                AssayCondition(plate=plate, well=well, conditions=condition_dict)
            )

    reference_sheets = []
    for key, value in data.items():
        if key.startswith("_") and isinstance(value, dict):
            reference_sheets.append(ReferenceSheet(name=key, data=value))

    return cls(
        investigation_information=investigation_info,
        study_information=study_info,
        assay_information=assay_info,
        assay_conditions=assay_conditions,
        reference_sheets=reference_sheets,
    )

to_dataframe() -> 'pd.DataFrame' #

Convert assay conditions to a pandas DataFrame.

All condition fields (both standard and custom) are included as columns.

Returns:

Type Description
'pd.DataFrame'

DataFrame with columns: Plate, Well, and all condition fields

Source code in src/mihcsme_py/models.py
def to_dataframe(self) -> "pd.DataFrame":
    """
    Convert assay conditions to a pandas DataFrame.

    All condition fields (both standard and custom) are included as columns.

    Returns:
        DataFrame with columns: Plate, Well, and all condition fields
    """
    import pandas as pd

    if not self.assay_conditions:
        return pd.DataFrame()

    conditions_data = [condition.to_dict() for condition in self.assay_conditions]
    return pd.DataFrame(conditions_data)

to_omero_dict(namespace_base: str = 'MIHCSME') -> Dict[str, Any] #

Convert the Pydantic model to dictionary format for OMERO upload.

Parameters:

Name Type Description Default
namespace_base str

Base namespace for OMERO annotations

'MIHCSME'

Returns:

Type Description
Dict[str, Any]

Dictionary in the format expected by the OMERO upload function

Source code in src/mihcsme_py/models.py
def to_omero_dict(self, namespace_base: str = "MIHCSME") -> Dict[str, Any]:
    """
    Convert the Pydantic model to dictionary format for OMERO upload.

    Args:
        namespace_base: Base namespace for OMERO annotations

    Returns:
        Dictionary in the format expected by the OMERO upload function
    """
    result: Dict[str, Any] = {}

    # Convert Investigation Information
    if self.investigation_information:
        result["InvestigationInformation"] = self.investigation_information.groups

    # Convert Study Information
    if self.study_information:
        result["StudyInformation"] = self.study_information.groups

    # Convert Assay Information
    if self.assay_information:
        result["AssayInformation"] = self.assay_information.groups

    # Convert Assay Conditions to list of dicts using to_dict()
    if self.assay_conditions:
        result["AssayConditions"] = [c.to_dict() for c in self.assay_conditions]

    # Add reference sheets
    for ref_sheet in self.reference_sheets:
        result[ref_sheet.name] = ref_sheet.data

    return result

update_conditions_from_dataframe(df: 'pd.DataFrame') -> 'MIHCSMEMetadata' #

Update assay conditions from a DataFrame while preserving other metadata.

This is a convenience method that creates a new MIHCSMEMetadata instance with updated assay conditions from the DataFrame, while preserving all other metadata (investigation_information, study_information, etc.) from the current instance.

Parameters:

Name Type Description Default
df 'pd.DataFrame'

DataFrame with at minimum 'Plate' and 'Well' columns. All other columns become condition fields.

required

Returns:

Type Description
'MIHCSMEMetadata'

New MIHCSMEMetadata instance with updated conditions

Example

df = metadata.to_dataframe() df['New Column'] = df['Old Column'].str.lower() updated = metadata.update_conditions_from_dataframe(df)

updated has the new column, plus all original metadata#
Source code in src/mihcsme_py/models.py
def update_conditions_from_dataframe(self, df: "pd.DataFrame") -> "MIHCSMEMetadata":
    """
    Update assay conditions from a DataFrame while preserving other metadata.

    This is a convenience method that creates a new MIHCSMEMetadata instance
    with updated assay conditions from the DataFrame, while preserving all
    other metadata (investigation_information, study_information, etc.) from
    the current instance.

    Args:
        df: DataFrame with at minimum 'Plate' and 'Well' columns.
            All other columns become condition fields.

    Returns:
        New MIHCSMEMetadata instance with updated conditions

    Example:
        >>> df = metadata.to_dataframe()
        >>> df['New Column'] = df['Old Column'].str.lower()
        >>> updated = metadata.update_conditions_from_dataframe(df)
        >>> # updated has the new column, plus all original metadata
    """
    return self.from_dataframe(
        df,
        investigation_information=self.investigation_information,
        study_information=self.study_information,
        assay_information=self.assay_information,
        reference_sheets=self.reference_sheets,
    )

MIHCSMEMetadataLLM pydantic-model #

Bases: BaseModel

Subset of MIHCSMEMetadata for LLM extraction.

This model excludes assay_conditions and reference_sheets as they are too large/complex for LLM context. Use this model when passing metadata schema to an LLM for extraction or modification.

Show JSON schema:
{
  "$defs": {
    "Assay": {
      "description": "Assay information.",
      "properties": {
        "Assay Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Screen name",
          "title": "Assay Title"
        },
        "Assay internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Experimental ID, e.g. aMV-010, linked to ELN or labjournal",
          "title": "Assay Internal Id"
        },
        "Assay Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of screen plus additional unstructured information",
          "title": "Assay Description"
        },
        "Assay number of biological replicates": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Total number of biol. Repl.",
          "title": "Assay Number Of Biological Replicates"
        },
        "Number of plates": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Total number of plates, n-plates",
          "title": "Number Of Plates"
        },
        "Assay Technology Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Imaging method, Fbbi terms",
          "title": "Assay Technology Type"
        },
        "Assay Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of options: sub types of HCS e.g. Gene Knock down, RNAi, compound, EFO terms",
          "title": "Assay Type"
        },
        "Assay External URL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ELN or any other external url link to this screen",
          "title": "Assay External Url"
        },
        "Assay data URL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "OMERO url link to this screen",
          "title": "Assay Data Url"
        }
      },
      "title": "Assay",
      "type": "object"
    },
    "AssayComponent": {
      "description": "Assay component information.",
      "properties": {
        "Imaging protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url to protocols.io or protocols in ELN, at least protocol file name",
          "title": "Imaging Protocol"
        },
        "Sample preparation protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sample preparation method (Formaldahyde (PFA) fixed tissue, Live cells, unfixed tissue)",
          "title": "Sample Preparation Protocol"
        }
      },
      "title": "AssayComponent",
      "type": "object"
    },
    "AssayInformation": {
      "additionalProperties": true,
      "description": "Assay-level metadata with structured fields.",
      "example": {
        "assay": {
          "assay_internal_id": "ASY-001",
          "assay_title": "Example Screen"
        },
        "image_data": {
          "image_number_of_channels": "3"
        }
      },
      "properties": {
        "assay": {
          "anyOf": [
            {
              "$ref": "#/$defs/Assay"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Assay information"
        },
        "assay_component": {
          "anyOf": [
            {
              "$ref": "#/$defs/AssayComponent"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Assay component information"
        },
        "biosample": {
          "anyOf": [
            {
              "$ref": "#/$defs/BiosampleAssay"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Biosample information"
        },
        "image_data": {
          "anyOf": [
            {
              "$ref": "#/$defs/ImageData"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Image data information"
        },
        "image_acquisition": {
          "anyOf": [
            {
              "$ref": "#/$defs/ImageAcquisition"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Image acquisition information"
        },
        "specimen": {
          "anyOf": [
            {
              "$ref": "#/$defs/Specimen"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Specimen/channel information"
        }
      },
      "title": "AssayInformation",
      "type": "object"
    },
    "Biosample": {
      "description": "Biosample information.",
      "properties": {
        "Biosample Taxon": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "NCBI-taxon id, human = NCBITAXON:9606",
          "title": "Biosample Taxon"
        },
        "Biosample description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of biosample genotype",
          "title": "Biosample Description"
        },
        "Biosample Organism": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Which organism is your cell lines or tissue from. Examples: Human or mouse",
          "title": "Biosample Organism"
        },
        "Number of cell lines used": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "In case multiple cell lines are used indicate here",
          "title": "Number Of Cell Lines Used"
        }
      },
      "title": "Biosample",
      "type": "object"
    },
    "BiosampleAssay": {
      "description": "Biosample information specific to assay.",
      "properties": {
        "Cell lines storage location": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Storage location according to Database used or at least location",
          "title": "Cell Lines Storage Location"
        },
        "Cell lines clone number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Storage location DB info",
          "title": "Cell Lines Clone Number"
        },
        "Cell lines Passage number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Passage number of your cells",
          "title": "Cell Lines Passage Number"
        }
      },
      "title": "BiosampleAssay",
      "type": "object"
    },
    "Channel": {
      "description": "Single channel information for specimen imaging.",
      "properties": {
        "visualization_method": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Visualization method (e.g., Hoechst staining, GFP)",
          "title": "Visualization Method"
        },
        "entity": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Entity visualized (e.g., DNA, MAP1LC3B)",
          "title": "Entity"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Label used for entity (e.g., Nuclei, GFP-LC3)",
          "title": "Label"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sequential id of channel order in your image",
          "title": "Id"
        }
      },
      "title": "Channel",
      "type": "object"
    },
    "DataCollaborator": {
      "description": "Data collaborator information.",
      "properties": {
        "ORCID  Data Collaborator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ORCID ID of collaborator with experimental, collection or analysis part of this investigation",
          "title": "Orcid  Data Collaborator"
        }
      },
      "title": "DataCollaborator",
      "type": "object"
    },
    "DataOwner": {
      "description": "Data owner information.",
      "properties": {
        "First Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "First Name",
          "title": "First Name"
        },
        "Middle Name(s)": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Middle Name(s) if any",
          "title": "Middle Name(S)"
        },
        "Last Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Last Name",
          "title": "Last Name"
        },
        "User name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institutional user name",
          "title": "User Name"
        },
        "Institute": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institute level, e.g. Universiteit Leiden, Faculty of Science, Institute of Biology",
          "title": "Institute"
        },
        "E-Mail Address": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Institution email address",
          "title": "E-Mail Address"
        },
        "ORCID investigator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "ORCID ID as URL, e.g. https://orcid.org/0000-0002-3704-3675",
          "title": "Orcid Investigator"
        }
      },
      "title": "DataOwner",
      "type": "object"
    },
    "ImageAcquisition": {
      "description": "Image acquisition information.",
      "properties": {
        "Microscope id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url to micrometa app file link or other url describing your microscope",
          "title": "Microscope Id"
        }
      },
      "title": "ImageAcquisition",
      "type": "object"
    },
    "ImageData": {
      "description": "Image data information.",
      "properties": {
        "Image number of pixelsX": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of pixels in x in images",
          "title": "Image Number Of Pixelsx"
        },
        "Image number of pixelsY": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of pixels in y in images",
          "title": "Image Number Of Pixelsy"
        },
        "Image number of  z-stacks": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number z stacks in image, single image is z=1",
          "title": "Image Number Of  Z-Stacks"
        },
        "Image number of channels": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of channels in your image",
          "title": "Image Number Of Channels"
        },
        "Image number of timepoints": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicate number of time point(s) in your image",
          "title": "Image Number Of Timepoints"
        },
        "Image sites per well": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Number of fields, numeric value",
          "title": "Image Sites Per Well"
        }
      },
      "title": "ImageData",
      "type": "object"
    },
    "InvestigationInfo": {
      "description": "Core investigation information.",
      "properties": {
        "Project ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "EU/NWO/consortium ID \u2013 Examples: EuTOX",
          "title": "Project Id"
        },
        "Investigation Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "High level concept to link related studies",
          "title": "Investigation Title"
        },
        "Investigation internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Corresponding internal ID for your investigation",
          "title": "Investigation Internal Id"
        },
        "Investigation description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Short description for your investigation",
          "title": "Investigation Description"
        }
      },
      "title": "InvestigationInfo",
      "type": "object"
    },
    "InvestigationInformation": {
      "additionalProperties": true,
      "description": "Investigation-level metadata with structured fields.",
      "example": {
        "data_owner": {
          "email": "j.doe@example.com",
          "first_name": "Jane",
          "last_name": "Doe",
          "orcid": "https://orcid.org/0000-0002-3704-3675"
        },
        "investigation_info": {
          "investigation_title": "Example Investigation",
          "project_id": "EuTOX"
        }
      },
      "properties": {
        "data_owner": {
          "anyOf": [
            {
              "$ref": "#/$defs/DataOwner"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Data owner information"
        },
        "data_collaborators": {
          "description": "List of data collaborators",
          "items": {
            "$ref": "#/$defs/DataCollaborator"
          },
          "title": "Data Collaborators",
          "type": "array"
        },
        "investigation_info": {
          "anyOf": [
            {
              "$ref": "#/$defs/InvestigationInfo"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Core investigation information"
        }
      },
      "title": "InvestigationInformation",
      "type": "object"
    },
    "Library": {
      "description": "Library information.",
      "properties": {
        "Library File Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library File Name"
        },
        "Library File Format": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library File Format"
        },
        "Library Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Type"
        },
        "Library Manufacturer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Manufacturer"
        },
        "Library Version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Version"
        },
        "Library Experimental Conditions": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Any experimental conditions some cells were grown under as part of the study",
          "title": "Library Experimental Conditions"
        },
        "Quality Control Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A brief description of the kind of quality control measures that were taken",
          "title": "Quality Control Description"
        }
      },
      "title": "Library",
      "type": "object"
    },
    "Plate": {
      "description": "Plate information.",
      "properties": {
        "Plate type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: uclear",
          "title": "Plate Type"
        },
        "Plate type Manufacturer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: Greiner Bio-One",
          "title": "Plate Type Manufacturer"
        },
        "Plate type Catalog number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: 781081",
          "title": "Plate Type Catalog Number"
        }
      },
      "title": "Plate",
      "type": "object"
    },
    "Protocols": {
      "description": "Protocol information.",
      "properties": {
        "HCS library protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Hcs Library Protocol"
        },
        "growth protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Growth Protocol"
        },
        "treatment protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Treatment Protocol"
        },
        "HCS data analysis protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Hcs Data Analysis Protocol"
        }
      },
      "title": "Protocols",
      "type": "object"
    },
    "Specimen": {
      "description": "Specimen/channel information with dynamic channel support.\n\nChannels are stored as a list internally but can be converted to/from\nthe flat Excel format (Channel 1 visualization method, etc.).",
      "properties": {
        "Channel Transmission id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Channel id is dependent on different machines, first or last. If No transmission is acquired state NA",
          "title": "Channel Transmission Id"
        },
        "channels": {
          "description": "List of channel information (supports up to 8 channels)",
          "items": {
            "$ref": "#/$defs/Channel"
          },
          "title": "Channels",
          "type": "array"
        }
      },
      "title": "Specimen",
      "type": "object"
    },
    "Study": {
      "description": "Study information.",
      "properties": {
        "Study Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Manuscript/chapter/publication/paragraph title describing purpose or intention for one or multiple assays",
          "title": "Study Title"
        },
        "Study internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Study ID, linked to ELN or lab journal",
          "title": "Study Internal Id"
        },
        "Study Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of study with additional unstructured information",
          "title": "Study Description"
        },
        "Study Key Words": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of key words associated with your study (EFO-terms)",
          "title": "Study Key Words"
        }
      },
      "title": "Study",
      "type": "object"
    },
    "StudyInformation": {
      "additionalProperties": true,
      "description": "Study-level metadata with structured fields.",
      "example": {
        "biosample": {
          "biosample_organism": "Human"
        },
        "study": {
          "study_internal_id": "STD-001",
          "study_title": "Example Study"
        }
      },
      "properties": {
        "study": {
          "anyOf": [
            {
              "$ref": "#/$defs/Study"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Study information"
        },
        "biosample": {
          "anyOf": [
            {
              "$ref": "#/$defs/Biosample"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Biosample information"
        },
        "library": {
          "anyOf": [
            {
              "$ref": "#/$defs/Library"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library information"
        },
        "protocols": {
          "anyOf": [
            {
              "$ref": "#/$defs/Protocols"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Protocol information"
        },
        "plate": {
          "anyOf": [
            {
              "$ref": "#/$defs/Plate"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Plate information"
        }
      },
      "title": "StudyInformation",
      "type": "object"
    }
  },
  "description": "MIHCSME metadata for LLM extraction (excludes per-well assay conditions)",
  "properties": {
    "investigation_information": {
      "anyOf": [
        {
          "$ref": "#/$defs/InvestigationInformation"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "study_information": {
      "anyOf": [
        {
          "$ref": "#/$defs/StudyInformation"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "assay_information": {
      "anyOf": [
        {
          "$ref": "#/$defs/AssayInformation"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "title": "MIHCSMEMetadataLLM",
  "type": "object"
}

Config:

  • json_schema_extra: {'description': 'MIHCSME metadata for LLM extraction (excludes per-well assay conditions)'}

Fields:

to_full_metadata(assay_conditions: Optional[List[AssayCondition]] = None, reference_sheets: Optional[List[ReferenceSheet]] = None) -> MIHCSMEMetadata #

Convert to full MIHCSMEMetadata with optional conditions.

Parameters:

Name Type Description Default
assay_conditions Optional[List[AssayCondition]]

Optional list of assay conditions to include

None
reference_sheets Optional[List[ReferenceSheet]]

Optional list of reference sheets to include

None

Returns:

Type Description
MIHCSMEMetadata

Full MIHCSMEMetadata instance

Source code in src/mihcsme_py/models.py
def to_full_metadata(
    self,
    assay_conditions: Optional[List[AssayCondition]] = None,
    reference_sheets: Optional[List[ReferenceSheet]] = None,
) -> MIHCSMEMetadata:
    """Convert to full MIHCSMEMetadata with optional conditions.

    Args:
        assay_conditions: Optional list of assay conditions to include
        reference_sheets: Optional list of reference sheets to include

    Returns:
        Full MIHCSMEMetadata instance
    """
    return MIHCSMEMetadata(
        investigation_information=self.investigation_information,
        study_information=self.study_information,
        assay_information=self.assay_information,
        assay_conditions=assay_conditions or [],
        reference_sheets=reference_sheets or [],
    )

Plate pydantic-model #

Bases: BaseModel

Plate information.

Show JSON schema:
{
  "description": "Plate information.",
  "properties": {
    "Plate type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Example: uclear",
      "title": "Plate Type"
    },
    "Plate type Manufacturer": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Example: Greiner Bio-One",
      "title": "Plate Type Manufacturer"
    },
    "Plate type Catalog number": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Example: 781081",
      "title": "Plate Type Catalog Number"
    }
  },
  "title": "Plate",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

plate_type: Optional[str] = None pydantic-field #

Example: uclear

plate_type_catalog_number: StringCoerced = None pydantic-field #

Example: 781081

plate_type_manufacturer: Optional[str] = None pydantic-field #

Example: Greiner Bio-One

Protocols pydantic-model #

Bases: BaseModel

Protocol information.

Show JSON schema:
{
  "description": "Protocol information.",
  "properties": {
    "HCS library protocol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
      "title": "Hcs Library Protocol"
    },
    "growth protocol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
      "title": "Growth Protocol"
    },
    "treatment protocol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
      "title": "Treatment Protocol"
    },
    "HCS data analysis protocol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
      "title": "Hcs Data Analysis Protocol"
    }
  },
  "title": "Protocols",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

growth_protocol: Optional[str] = None pydantic-field #

Url/doi protocols.io or ELN associated url. At least SOP/protocol filename

hcs_data_analysis_protocol: Optional[str] = None pydantic-field #

Url/doi protocols.io or ELN associated url. At least SOP/protocol filename

hcs_library_protocol: Optional[str] = None pydantic-field #

Url/doi protocols.io or ELN associated url. At least SOP/protocol filename

treatment_protocol: Optional[str] = None pydantic-field #

Url/doi protocols.io or ELN associated url. At least SOP/protocol filename

ReferenceSheet pydantic-model #

Bases: BaseModel

Reference sheet data (sheets starting with '_').

Show JSON schema:
{
  "description": "Reference sheet data (sheets starting with '_').",
  "example": {
    "data": {
      "Human": "Homo sapiens",
      "Mouse": "Mus musculus"
    },
    "name": "_Organisms"
  },
  "properties": {
    "name": {
      "description": "Sheet name (including '_' prefix)",
      "title": "Name",
      "type": "string"
    },
    "data": {
      "additionalProperties": true,
      "description": "Key-value pairs from reference sheet",
      "title": "Data",
      "type": "object"
    }
  },
  "required": [
    "name"
  ],
  "title": "ReferenceSheet",
  "type": "object"
}

Config:

  • json_schema_extra: {'example': {'name': '_Organisms', 'data': {'Human': 'Homo sapiens', 'Mouse': 'Mus musculus'}}}

Fields:

data: Dict[str, Any] pydantic-field #

Key-value pairs from reference sheet

name: str pydantic-field #

Sheet name (including '_' prefix)

Specimen pydantic-model #

Bases: BaseModel

Specimen/channel information with dynamic channel support.

Channels are stored as a list internally but can be converted to/from the flat Excel format (Channel 1 visualization method, etc.).

Show JSON schema:
{
  "$defs": {
    "Channel": {
      "description": "Single channel information for specimen imaging.",
      "properties": {
        "visualization_method": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Visualization method (e.g., Hoechst staining, GFP)",
          "title": "Visualization Method"
        },
        "entity": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Entity visualized (e.g., DNA, MAP1LC3B)",
          "title": "Entity"
        },
        "label": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Label used for entity (e.g., Nuclei, GFP-LC3)",
          "title": "Label"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sequential id of channel order in your image",
          "title": "Id"
        }
      },
      "title": "Channel",
      "type": "object"
    }
  },
  "description": "Specimen/channel information with dynamic channel support.\n\nChannels are stored as a list internally but can be converted to/from\nthe flat Excel format (Channel 1 visualization method, etc.).",
  "properties": {
    "Channel Transmission id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Channel id is dependent on different machines, first or last. If No transmission is acquired state NA",
      "title": "Channel Transmission Id"
    },
    "channels": {
      "description": "List of channel information (supports up to 8 channels)",
      "items": {
        "$ref": "#/$defs/Channel"
      },
      "title": "Channels",
      "type": "array"
    }
  },
  "title": "Specimen",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

channel_transmission_id: StringCoerced = None pydantic-field #

Channel id is dependent on different machines, first or last. If No transmission is acquired state NA

channels: List[Channel] pydantic-field #

List of channel information (supports up to 8 channels)

from_flat_dict(data: Dict[str, Any]) -> 'Specimen' classmethod #

Create Specimen from flat dictionary format (Excel/OMERO).

Parameters:

Name Type Description Default
data Dict[str, Any]

Dictionary with keys like 'Channel 1 visualization method', etc.

required

Returns:

Type Description
'Specimen'

Specimen instance with channels list populated

Source code in src/mihcsme_py/models.py
@classmethod
def from_flat_dict(cls, data: Dict[str, Any]) -> "Specimen":
    """Create Specimen from flat dictionary format (Excel/OMERO).

    Args:
        data: Dictionary with keys like 'Channel 1 visualization method', etc.

    Returns:
        Specimen instance with channels list populated
    """
    channel_transmission_id = data.get("Channel Transmission id")

    # Parse channels (support up to 8)
    channels = []
    for i in range(1, 9):
        vis_method = data.get(f"Channel {i} visualization method")
        entity = data.get(f"Channel {i} entity")
        label = data.get(f"Channel {i} label")
        ch_id = data.get(f"Channel {i} id")

        # Only add channel if it has any data
        if any([vis_method, entity, label, ch_id]):
            channels.append(
                Channel(
                    visualization_method=vis_method,
                    entity=entity,
                    label=label,
                    id=ch_id,
                )
            )

    return cls(channel_transmission_id=channel_transmission_id, channels=channels)

to_flat_dict() -> Dict[str, Any] #

Convert to flat dictionary format for Excel/OMERO export.

Returns:

Type Description
Dict[str, Any]

Dictionary with keys like 'Channel Transmission id',

Dict[str, Any]

'Channel 1 visualization method', 'Channel 1 entity', etc.

Source code in src/mihcsme_py/models.py
def to_flat_dict(self) -> Dict[str, Any]:
    """Convert to flat dictionary format for Excel/OMERO export.

    Returns:
        Dictionary with keys like 'Channel Transmission id',
        'Channel 1 visualization method', 'Channel 1 entity', etc.
    """
    result: Dict[str, Any] = {}

    if self.channel_transmission_id:
        result["Channel Transmission id"] = self.channel_transmission_id

    for i, channel in enumerate(self.channels, start=1):
        if channel.visualization_method:
            result[f"Channel {i} visualization method"] = channel.visualization_method
        if channel.entity:
            result[f"Channel {i} entity"] = channel.entity
        if channel.label:
            result[f"Channel {i} label"] = channel.label
        if channel.id:
            result[f"Channel {i} id"] = channel.id

    return result

Study pydantic-model #

Bases: BaseModel

Study information.

Show JSON schema:
{
  "description": "Study information.",
  "properties": {
    "Study Title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Manuscript/chapter/publication/paragraph title describing purpose or intention for one or multiple assays",
      "title": "Study Title"
    },
    "Study internal ID": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Study ID, linked to ELN or lab journal",
      "title": "Study Internal Id"
    },
    "Study Description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Description of study with additional unstructured information",
      "title": "Study Description"
    },
    "Study Key Words": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "List of key words associated with your study (EFO-terms)",
      "title": "Study Key Words"
    }
  },
  "title": "Study",
  "type": "object"
}

Config:

  • populate_by_name: True

Fields:

study_description: Optional[str] = None pydantic-field #

Description of study with additional unstructured information

study_internal_id: StringCoerced = None pydantic-field #

Study ID, linked to ELN or lab journal

study_key_words: Optional[str] = None pydantic-field #

List of key words associated with your study (EFO-terms)

study_title: Optional[str] = None pydantic-field #

Manuscript/chapter/publication/paragraph title describing purpose or intention for one or multiple assays

StudyInformation pydantic-model #

Bases: BaseModel

Study-level metadata with structured fields.

Show JSON schema:
{
  "$defs": {
    "Biosample": {
      "description": "Biosample information.",
      "properties": {
        "Biosample Taxon": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "NCBI-taxon id, human = NCBITAXON:9606",
          "title": "Biosample Taxon"
        },
        "Biosample description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of biosample genotype",
          "title": "Biosample Description"
        },
        "Biosample Organism": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Which organism is your cell lines or tissue from. Examples: Human or mouse",
          "title": "Biosample Organism"
        },
        "Number of cell lines used": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "In case multiple cell lines are used indicate here",
          "title": "Number Of Cell Lines Used"
        }
      },
      "title": "Biosample",
      "type": "object"
    },
    "Library": {
      "description": "Library information.",
      "properties": {
        "Library File Name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library File Name"
        },
        "Library File Format": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library File Format"
        },
        "Library Type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Type"
        },
        "Library Manufacturer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Manufacturer"
        },
        "Library Version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Library file info",
          "title": "Library Version"
        },
        "Library Experimental Conditions": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Any experimental conditions some cells were grown under as part of the study",
          "title": "Library Experimental Conditions"
        },
        "Quality Control Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A brief description of the kind of quality control measures that were taken",
          "title": "Quality Control Description"
        }
      },
      "title": "Library",
      "type": "object"
    },
    "Plate": {
      "description": "Plate information.",
      "properties": {
        "Plate type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: uclear",
          "title": "Plate Type"
        },
        "Plate type Manufacturer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: Greiner Bio-One",
          "title": "Plate Type Manufacturer"
        },
        "Plate type Catalog number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Example: 781081",
          "title": "Plate Type Catalog Number"
        }
      },
      "title": "Plate",
      "type": "object"
    },
    "Protocols": {
      "description": "Protocol information.",
      "properties": {
        "HCS library protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Hcs Library Protocol"
        },
        "growth protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Growth Protocol"
        },
        "treatment protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Treatment Protocol"
        },
        "HCS data analysis protocol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Url/doi protocols.io or ELN associated url. At least SOP/protocol filename",
          "title": "Hcs Data Analysis Protocol"
        }
      },
      "title": "Protocols",
      "type": "object"
    },
    "Study": {
      "description": "Study information.",
      "properties": {
        "Study Title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Manuscript/chapter/publication/paragraph title describing purpose or intention for one or multiple assays",
          "title": "Study Title"
        },
        "Study internal ID": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Study ID, linked to ELN or lab journal",
          "title": "Study Internal Id"
        },
        "Study Description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Description of study with additional unstructured information",
          "title": "Study Description"
        },
        "Study Key Words": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of key words associated with your study (EFO-terms)",
          "title": "Study Key Words"
        }
      },
      "title": "Study",
      "type": "object"
    }
  },
  "additionalProperties": true,
  "description": "Study-level metadata with structured fields.",
  "example": {
    "biosample": {
      "biosample_organism": "Human"
    },
    "study": {
      "study_internal_id": "STD-001",
      "study_title": "Example Study"
    }
  },
  "properties": {
    "study": {
      "anyOf": [
        {
          "$ref": "#/$defs/Study"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Study information"
    },
    "biosample": {
      "anyOf": [
        {
          "$ref": "#/$defs/Biosample"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Biosample information"
    },
    "library": {
      "anyOf": [
        {
          "$ref": "#/$defs/Library"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Library information"
    },
    "protocols": {
      "anyOf": [
        {
          "$ref": "#/$defs/Protocols"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Protocol information"
    },
    "plate": {
      "anyOf": [
        {
          "$ref": "#/$defs/Plate"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Plate information"
    }
  },
  "title": "StudyInformation",
  "type": "object"
}

Config:

  • extra: allow
  • json_schema_extra: {'example': {'study': {'study_title': 'Example Study', 'study_internal_id': 'STD-001'}, 'biosample': {'biosample_organism': 'Human'}}}

Fields:

biosample: Optional[Biosample] = None pydantic-field #

Biosample information

groups: Dict[str, Dict[str, Any]] property #

Convert to groups dictionary format for OMERO upload.

library: Optional[Library] = None pydantic-field #

Library information

plate: Optional[Plate] = None pydantic-field #

Plate information

protocols: Optional[Protocols] = None pydantic-field #

Protocol information

study: Optional[Study] = None pydantic-field #

Study information

from_groups_dict(groups: Dict[str, Dict[str, Any]]) -> 'StudyInformation' classmethod #

Create from groups dictionary format.

Source code in src/mihcsme_py/models.py
@classmethod
def from_groups_dict(cls, groups: Dict[str, Dict[str, Any]]) -> "StudyInformation":
    """Create from groups dictionary format."""
    # Parse Study
    study = None
    if "Study" in groups:
        study = Study(**groups["Study"])

    # Parse Biosample
    biosample = None
    if "Biosample" in groups:
        biosample = Biosample(**groups["Biosample"])

    # Parse Library
    library = None
    if "Library" in groups:
        library = Library(**groups["Library"])

    # Parse Protocols
    protocols = None
    if "Protocols" in groups:
        protocols = Protocols(**groups["Protocols"])

    # Parse Plate
    plate = None
    if "Plate" in groups:
        plate = Plate(**groups["Plate"])

    return cls(
        study=study, biosample=biosample, library=library, protocols=protocols, plate=plate
    )

to_groups_dict() -> Dict[str, Dict[str, Any]] #

Convert to groups dictionary format.

Source code in src/mihcsme_py/models.py
def to_groups_dict(self) -> Dict[str, Dict[str, Any]]:
    """Convert to groups dictionary format."""
    groups = {}

    # Study group - automatically include all fields
    if self.study:
        data = _model_to_dict_with_aliases(self.study)
        if data:
            groups["Study"] = data

    # Biosample group - automatically include all fields
    if self.biosample:
        data = _model_to_dict_with_aliases(self.biosample)
        if data:
            groups["Biosample"] = data

    # Library group - automatically include all fields
    if self.library:
        data = _model_to_dict_with_aliases(self.library)
        if data:
            groups["Library"] = data

    # Protocols group - automatically include all fields
    if self.protocols:
        data = _model_to_dict_with_aliases(self.protocols)
        if data:
            groups["Protocols"] = data

    # Plate group - automatically include all fields
    if self.plate:
        data = _model_to_dict_with_aliases(self.plate)
        if data:
            groups["Plate"] = data

    return groups