# Generated by Django 4.2.7 on 2025-04-07 16:16

import django.db.models.deletion
from django.db import migrations, models

from simmate.apps.rdkit.utils import get_rdkit_ext_fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("chembl", "0001_setup"),
    ]

    operations = [
        migrations.CreateModel(
            name="ChemblDocument",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, null=True),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, db_index=True, null=True),
                ),
                ("source", models.JSONField(blank=True, null=True)),
                ("published_at", models.IntegerField(blank=True, null=True)),
                ("document_type", models.TextField(blank=True, null=True)),
                ("patent_id", models.TextField(blank=True, null=True)),
                ("doi", models.TextField(blank=True, null=True)),
                ("title", models.TextField(blank=True, null=True)),
            ],
            options={
                "db_table": "chembl__documents",
            },
        ),
        migrations.CreateModel(
            name="ChemblMolecule",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, null=True),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, db_index=True, null=True),
                ),
                ("molecule", models.TextField(blank=True, null=True)),
                ("molecule_original", models.TextField(blank=True, null=True)),
                ("is_3d", models.BooleanField(blank=True, null=True)),
                ("smiles", models.TextField(blank=True, null=True)),
                ("inchi", models.TextField(blank=True, null=True)),
                (
                    "inchi_key",
                    models.CharField(
                        blank=True, db_index=True, max_length=30, null=True
                    ),
                ),
                ("num_atoms", models.IntegerField(blank=True, null=True)),
                ("num_stereocenters", models.IntegerField(blank=True, null=True)),
                ("num_rings", models.IntegerField(blank=True, null=True)),
                ("num_h_acceptors", models.IntegerField(blank=True, null=True)),
                ("num_h_donors", models.IntegerField(blank=True, null=True)),
                ("molecular_weight", models.FloatField(blank=True, null=True)),
                ("molecular_weight_exact", models.FloatField(blank=True, null=True)),
                ("functional_groups", models.JSONField(blank=True, null=True)),
                ("log_p_rdkit", models.FloatField(blank=True, null=True)),
                ("tpsa_rdkit", models.FloatField(blank=True, null=True)),
                ("synthetic_accessibility", models.FloatField(blank=True, null=True)),
                *get_rdkit_ext_fields(),
                ("chembl_id", models.CharField(blank=True, max_length=25, null=True)),
                (
                    "molecule_type",
                    models.CharField(blank=True, max_length=25, null=True),
                ),
                ("drug_likeness", models.FloatField(blank=True, null=True)),
                ("alog_p_chembl", models.FloatField(blank=True, null=True)),
                ("rule_of_3_pass", models.BooleanField(blank=True, null=True)),
                ("rule_of_5_violations", models.IntegerField(blank=True, null=True)),
                ("pka_acidic_max", models.FloatField(blank=True, null=True)),
                ("pka_basic_max", models.FloatField(blank=True, null=True)),
                ("log_p_chemaxon", models.FloatField(blank=True, null=True)),
                ("log_d_chemaxon", models.FloatField(blank=True, null=True)),
                (
                    "acid_base_type",
                    models.CharField(blank=True, max_length=30, null=True),
                ),
                (
                    "num_h_acceptors_lipinski",
                    models.IntegerField(blank=True, null=True),
                ),
                ("num_h_donors_lipinski", models.IntegerField(blank=True, null=True)),
                (
                    "rule_of_5_violations_lipinski",
                    models.IntegerField(blank=True, null=True),
                ),
                ("natural_product_likeness", models.FloatField(blank=True, null=True)),
            ],
            options={
                "db_table": "chembl__molecules",
            },
        ),
        migrations.CreateModel(
            name="ChemblAssayResult",
            fields=[
                ("id", models.AutoField(primary_key=True, serialize=False)),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, db_index=True, null=True),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, db_index=True, null=True),
                ),
                ("source", models.JSONField(blank=True, null=True)),
                ("value_relation", models.TextField(blank=True, null=True)),
                ("value", models.FloatField(blank=True, null=True)),
                ("value_units", models.TextField(blank=True, null=True)),
                ("data_validity_check", models.BooleanField(blank=True, null=True)),
                ("value_type", models.TextField(blank=True, null=True)),
                ("activity_comment", models.TextField(blank=True, null=True)),
                ("data_validity_comment", models.TextField(blank=True, null=True)),
                ("is_potential_duplicate", models.BooleanField(blank=True, null=True)),
                ("value_range_max", models.FloatField(blank=True, null=True)),
                ("value_text", models.TextField(blank=True, null=True)),
                ("mode_of_action_type", models.TextField(blank=True, null=True)),
                ("description", models.TextField(blank=True, null=True)),
                ("target_organism", models.TextField(blank=True, null=True)),
                ("confidence_score", models.IntegerField(blank=True, null=True)),
                ("assay_type", models.TextField(blank=True, null=True)),
                ("assay_type_standard", models.TextField(blank=True, null=True)),
                (
                    "chembl_compound",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="chembl_assay_results",
                        to="chembl.chemblmolecule",
                    ),
                ),
                (
                    "chembl_document",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="chembl_assay_results",
                        to="chembl.chembldocument",
                    ),
                ),
            ],
            options={
                "db_table": "chembl__assay_results",
            },
        ),
    ]
