# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-09 14:17
from __future__ import unicode_literals

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import re


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('genome', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='CrossReference',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('source', models.PositiveSmallIntegerField(choices=[(1, 'UMLS'), (2, 'MSH'), (3, 'SNOMEDCT_US'), (4, 'MEDDRA'), (5, 'ICD-10'), (6, 'EPCC'), (7, 'ICD-O'), (8, 'DOID'), (9, 'MP'), (10, 'MPATH'), (11, 'PMID'), (12, 'NCIT'), (13, 'DOI'), (14, 'ORPHA'), (15, 'ICD-9'), (16, 'RGD')])),
                ('source_value', models.CharField(max_length=150)),
            ],
            options={
                'verbose_name': 'XRef',
                'verbose_name_plural': 'XRefs',
            },
        ),
        migrations.CreateModel(
            name='Disease',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('database', models.PositiveSmallIntegerField(choices=[(1, 'OMIM'), (2, 'ORPHA'), (3, 'DECIPHER')])),
                ('identifier', models.IntegerField()),
                ('description', models.TextField(blank=True)),
                ('qualifier', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'BILATERAL'), (2, 'CHRONIC'), (3, 'DISTAL'), (4, 'EPISODIC'), (5, 'GENERALIZED'), (6, 'MILD'), (7, 'MODERATE'), (8, 'NONPROGRESSIVE'), (9, 'PROFOUND'), (10, 'PROGRESSIVE'), (11, 'PROXIMAL'), (12, 'RECURRENT'), (13, 'REFRACTORY'), (14, 'SEVERE')], null=True)),
                ('evidence_code', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'ICE'), (2, 'IEA'), (3, 'PCS'), (4, 'TAS')], null=True)),
                ('create_date', models.DateField()),
                ('assigned_by', models.CharField(max_length=255)),
            ],
            options={
                'verbose_name': 'Disease',
                'verbose_name_plural': 'Diseases',
            },
        ),
        migrations.CreateModel(
            name='Synonym',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('description', models.TextField(blank=True)),
                ('scope', models.PositiveSmallIntegerField(blank=True, choices=[(1, 'EXACT'), (2, 'BROAD'), (3, 'NARROW'), (4, 'RELATED')], null=True)),
            ],
            options={
                'verbose_name': 'Synonym',
                'verbose_name_plural': 'Synonyms',
            },
        ),
        migrations.CreateModel(
            name='Term',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identifier', models.PositiveIntegerField(db_index=True)),
                ('label', models.CharField(blank=True, max_length=255)),
                ('description', models.TextField(blank=True)),
                ('created_by', models.CharField(blank=True, max_length=50)),
                ('created', models.CharField(blank=True, max_length=25)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('alternate_ids', models.CharField(blank=True, max_length=500, validators=[django.core.validators.RegexValidator(re.compile('^\\d+(?:\\,\\d+)*\\Z', 32), code='invalid', message='Enter only digits separated by commas.')])),
                ('can_be', models.ManyToManyField(blank=True, related_name='_term_can_be_+', to='hpo_terms.Term')),
                ('is_a', models.ManyToManyField(blank=True, related_name='_term_is_a_+', to='hpo_terms.Term')),
            ],
            options={
                'verbose_name': 'Term',
                'verbose_name_plural': 'Terms',
            },
        ),
        migrations.CreateModel(
            name='Version',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('label', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Version',
                'verbose_name_plural': 'Versions',
            },
        ),
        migrations.AddField(
            model_name='term',
            name='version',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='hpo_terms.Version'),
        ),
        migrations.AddField(
            model_name='synonym',
            name='hpo_term',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='synonyms', to='hpo_terms.Term'),
        ),
        migrations.AddField(
            model_name='disease',
            name='age_of_onset',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='disease_age_of_onsets', to='hpo_terms.Term'),
        ),
        migrations.AddField(
            model_name='disease',
            name='frequency',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='disease_frequencies', to='hpo_terms.Term'),
        ),
        migrations.AddField(
            model_name='disease',
            name='genes',
            field=models.ManyToManyField(blank=True, related_name='diseases', to='genome.Gene'),
        ),
        migrations.AddField(
            model_name='disease',
            name='hpo_terms',
            field=models.ManyToManyField(blank=True, related_name='diseases', to='hpo_terms.Term'),
        ),
        migrations.AddField(
            model_name='disease',
            name='mode_of_inheritance',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='disease_mois', to='hpo_terms.Term'),
        ),
        migrations.AddField(
            model_name='disease',
            name='version',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='hpo_terms.Version'),
        ),
        migrations.AddField(
            model_name='crossreference',
            name='hpo_term',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='xrefs', to='hpo_terms.Term'),
        ),
        migrations.AlterIndexTogether(
            name='term',
            index_together=set([('version', 'identifier')]),
        ),
        migrations.AlterUniqueTogether(
            name='disease',
            unique_together=set([('version', 'database', 'identifier')]),
        ),
        migrations.AlterIndexTogether(
            name='disease',
            index_together=set([('database', 'identifier')]),
        ),
    ]
