# Generated by Django 3.1 on 2021-03-26 20:45

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='LabGroup',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lab_name', models.CharField(max_length=200)),
                ('lab_description', models.TextField(blank=True)),
                ('members', models.ManyToManyField(blank=True, related_name='lab_members', to=settings.AUTH_USER_MODEL)),
                ('owners', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Library',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('privacy_level', models.CharField(choices=[('PB', 'Public'), ('PR', 'Private')], default='PB', max_length=2)),
                ('quality_rating', models.CharField(choices=[('GO', 'Gold'), ('SI', 'Silver'), ('BR', 'Bronze')], default='BR', max_length=2)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('lab_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='chat.labgroup')),
            ],
        ),
        migrations.CreateModel(
            name='Locale',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('locale', models.TextField(blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='Metadata',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('strain_id', models.CharField(blank=True, max_length=255)),
                ('genbank_accession', models.CharField(blank=True, max_length=255)),
                ('ncbi_taxid', models.CharField(blank=True, max_length=255)),
                ('cKingdom', models.CharField(blank=True, max_length=255)),
                ('cPhylum', models.CharField(blank=True, max_length=255)),
                ('cClass', models.CharField(blank=True, max_length=255)),
                ('cOrder', models.CharField(blank=True, max_length=255)),
                ('cGenus', models.CharField(blank=True, max_length=255)),
                ('cSpecies', models.CharField(blank=True, max_length=255)),
                ('maldi_matrix', models.CharField(blank=True, max_length=255)),
                ('dsm_cultivation_media', models.CharField(blank=True, max_length=255)),
                ('cultivation_temp_celsius', models.CharField(blank=True, max_length=255)),
                ('cultivation_time_days', models.CharField(blank=True, max_length=255)),
                ('cultivation_other', models.CharField(blank=True, max_length=255)),
                ('user_firstname_lastname', models.CharField(blank=True, max_length=255)),
                ('user_orcid', models.CharField(blank=True, max_length=255)),
                ('pi_firstname_lastname', models.CharField(blank=True, max_length=255)),
                ('pi_orcid', models.CharField(blank=True, max_length=255)),
                ('dna_16s', models.CharField(blank=True, max_length=255)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('lab_name', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.labgroup')),
                ('library', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.library')),
            ],
        ),
        migrations.CreateModel(
            name='PrivacyLevel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('level', models.CharField(choices=[('PB', 'Public'), ('PR', 'Private')], default='PB', max_length=2)),
            ],
        ),
        migrations.CreateModel(
            name='SearchSpectra',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('privacy_level', models.CharField(blank=True, choices=[('PB', 'Public'), ('PR', 'Private')], default='PB', max_length=2, null=True)),
                ('spectrum_mass_hash', models.CharField(blank=True, max_length=255)),
                ('spectrum_intensity_hash', models.CharField(blank=True, max_length=255)),
                ('peak_mass', models.TextField(blank=True)),
                ('peak_intensity', models.TextField(blank=True)),
                ('peak_snr', models.TextField(blank=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('lab_name', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.labgroup')),
                ('library', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.library')),
                ('strain_id', models.ForeignKey(blank=True, db_column='strain_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.metadata')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Spectra',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('privacy_level', models.CharField(blank=True, choices=[('PB', 'Public'), ('PR', 'Private')], default='PB', max_length=2, null=True)),
                ('peak_mass', models.TextField(blank=True, help_text='A list of comma separated values, e.g., "1,2,3"')),
                ('peak_intensity', models.TextField(blank=True, help_text='A list of comma separated values, e.g., "1,2,3"')),
                ('peak_snr', models.TextField(blank=True, help_text='A list of comma separated values, e.g., "1,2,3"')),
                ('spectrum_mass_hash', models.CharField(blank=True, max_length=255)),
                ('spectrum_intensity_hash', models.CharField(blank=True, max_length=255)),
                ('picture', models.ImageField(blank=True, upload_to='spectra_images')),
                ('description', models.TextField(blank=True, max_length=2048)),
                ('posted_date', models.DateTimeField(auto_now_add=True)),
                ('max_mass', models.IntegerField(blank=True, null=True)),
                ('min_mass', models.IntegerField(blank=True, null=True)),
                ('acquisition_date', models.CharField(blank=True, max_length=255, null=True)),
                ('acquisition_mode', models.CharField(blank=True, max_length=255, null=True)),
                ('spot', models.CharField(blank=True, max_length=255, null=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('lab_name', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.labgroup')),
                ('library', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.library')),
                ('strain_id', models.ForeignKey(blank=True, db_column='strain_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.metadata')),
            ],
        ),
        migrations.CreateModel(
            name='UserTask',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('task_description', models.CharField(blank=True, choices=[('idbac_sql', 'Insert IDBac SQLite data to database'), ('spectra', 'Add spectra files to database'), ('preprocess', 'Preprocess spectra'), ('collapse', 'Collapse replicates'), ('cos_search', 'Cosine score search')], max_length=255, null=True)),
                ('last_modified', models.DateTimeField(auto_now_add=True)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Version',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('idbac_version', models.CharField(blank=True, max_length=200)),
                ('r_version', models.TextField(blank=True)),
                ('db_version', models.CharField(blank=True, max_length=200)),
            ],
        ),
        migrations.CreateModel(
            name='XML',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('xml_hash', models.CharField(blank=True, max_length=255)),
                ('xml', models.TextField(blank=True)),
                ('manufacturer', models.CharField(blank=True, max_length=255)),
                ('model', models.CharField(blank=True, max_length=255)),
                ('ionization', models.CharField(blank=True, max_length=255)),
                ('analyzer', models.CharField(blank=True, max_length=255)),
                ('detector', models.CharField(blank=True, max_length=255)),
                ('instrument_metafile', models.TextField(blank=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('lab_name', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.labgroup')),
            ],
        ),
        migrations.CreateModel(
            name='UserTaskStatus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.CharField(choices=[('start', 'Started'), ('run', 'Running'), ('complete', 'Completed'), ('error', 'Completed - Error'), ('info', 'Info')], max_length=255)),
                ('status_date', models.DateTimeField(auto_now_add=True)),
                ('extra', models.TextField(blank=True, null=True)),
                ('user_task', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.usertask')),
            ],
        ),
        migrations.AddField(
            model_name='usertask',
            name='statuses',
            field=models.ManyToManyField(to='chat.UserTaskStatus'),
        ),
        migrations.CreateModel(
            name='UserFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file', models.FileField(upload_to='uploads/', validators=[django.core.validators.FileExtensionValidator(allowed_extensions=['mzml', 'mzxml', 'fid'])])),
                ('upload_date', models.DateTimeField(auto_now_add=True)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('spectra', models.ManyToManyField(blank=True, to='chat.Spectra')),
            ],
        ),
        migrations.CreateModel(
            name='SpectraCosineScore',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('score', models.DecimalField(decimal_places=6, max_digits=10)),
                ('spectra1', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='spectra1', to='chat.spectra')),
                ('spectra2', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='spectra2', to='chat.spectra')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='spectra',
            name='xml_hash',
            field=models.ForeignKey(blank=True, db_column='xml_hash', null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.xml'),
        ),
        migrations.CreateModel(
            name='SearchSpectraCosineScore',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('score', models.DecimalField(decimal_places=6, max_digits=10)),
                ('spectra1', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='search_spectra1', to='chat.searchspectra')),
                ('spectra2', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='search_spectra2', to='chat.spectra')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='searchspectra',
            name='xml_hash',
            field=models.ForeignKey(blank=True, db_column='xml_hash', null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.xml'),
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(blank=True, max_length=2048)),
                ('comment_date', models.DateTimeField(auto_now_add=True)),
                ('spectra', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='chat.spectra')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='CollapsedSpectra',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('privacy_level', models.CharField(blank=True, choices=[('PB', 'Public'), ('PR', 'Private')], default='PB', max_length=2, null=True)),
                ('peak_mass', models.TextField(blank=True, help_text='A list of comma separated values, e.g., "1,2,3"')),
                ('peak_intensity', models.TextField(blank=True, help_text='A list of comma separated values, e.g., "1,2,3"')),
                ('peak_snr', models.TextField(blank=True, help_text='A list of comma separated values, e.g., "1,2,3"')),
                ('spectrum_mass_hash', models.CharField(blank=True, max_length=255)),
                ('spectrum_intensity_hash', models.CharField(blank=True, max_length=255)),
                ('peak_percent_presence', models.DecimalField(decimal_places=1, default=70.0, max_digits=4)),
                ('min_snr', models.DecimalField(decimal_places=2, default=0.25, max_digits=4)),
                ('tolerance', models.DecimalField(decimal_places=3, default=0.002, max_digits=10)),
                ('spectra_content', models.CharField(choices=[('PR', 'Protein'), ('SM', 'Small Molecule')], default='PR', max_length=2)),
                ('generated_date', models.DateTimeField(auto_now_add=True)),
                ('collapsed_spectra', models.ManyToManyField(to='chat.Spectra')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('lab_name', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.labgroup')),
                ('library', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.library')),
                ('strain_id', models.ForeignKey(blank=True, db_column='strain_id', null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.metadata')),
                ('xml_hash', models.ForeignKey(blank=True, db_column='xml_hash', null=True, on_delete=django.db.models.deletion.CASCADE, to='chat.xml')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CollapsedCosineScore',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('score', models.DecimalField(decimal_places=6, max_digits=10)),
                ('spectra1', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='spectra1', to='chat.collapsedspectra')),
                ('spectra2', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='spectra2', to='chat.collapsedspectra')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
