class Snv(Model):
    # required fields
    patient_id = fields.Integer(required=True)
    assembly = fields.Field(
        choices=[x.value for x in Assembly.__members__.values()],
        required=True)
    chr = fields.Field(choices=["X", "Y", "MT"] +
                       [str(x) for x in range(1, 23)],
                       required=True)
    start = fields.Integer(required=True)
    ref_allele = fields.String(required=True)
    alt_allele = fields.String(required=True)
    genotype = fields.Field(
        choices=[x.value for x in Genotype.__members__.values()],
        required=True)
    # optional fields
    user_transcript = fields.String()
    user_gene = fields.String()
    intergenic = fields.Boolean(default=False)
    inheritance = fields.Field(
        choices=[x.value for x in Inheritance.__members__.values()],
        default=Inheritance.unknown.value)
    pathogenicity = fields.Field(
        choices=[x.value for x in ClinicalSignificance.__members__.values()
                 ].append(None))
    contribution = fields.Field(
        choices=[x.value
                 for x in Penetrance.__members__.values()].append(None))
    shared = fields.String()
Ejemplo n.º 2
0
class ArticleFileUploadPart(Model):

    partNo = fields.Integer()
    startOffset = fields.Integer()
    endOffset = fields.Integer()
    status = fields.String()
    locked = fields.Boolean()
Ejemplo n.º 3
0
class ArticleL1(Model):

    id = fields.Integer(required=True)
    title = fields.String(required=True)
    doi = fields.String(required=True)
    url = fields.String(required=True)
    published_date = Date(required=True)

    citation = fields.String()
    confidential_reason = fields.String()
    embargo_type = fields.String()
    is_confidential = fields.Boolean()
    size = fields.Integer()
    funding = fields.String()
    tags = fields.Collection(fields.String)
    version = fields.Integer()
    is_active = fields.Integer()
    is_metadata_record = fields.Boolean()
    metadata_reason = fields.String()
    status = fields.String()
    description = fields.String()
    is_embargoed = fields.Boolean()
    embargo_date = Date()
    is_public = fields.Boolean()
    modified_date = Date()
    created_date = Date()
    has_linked_file = fields.Boolean()
    categories = fields.Collection(Category)
    license = fields.Embedded(License)
    defined_type = fields.Integer()
    published_date = Date()
    embargo_reason = fields.String()
    references = fields.Collection(fields.String)
class Phenotype(Model):
    # required fields
    person_id = fields.Integer(required=True)
    phenotype_id = fields.Integer(required=True)
    # optional fields
    observation = fields.Field(
        choices=[x.value for x in TermPresence.__members__.values()],
        default=TermPresence.present.value)
Ejemplo n.º 5
0
class ArticleShort(Model):

    id = fields.Integer(required=True)
    title = fields.String(required=True)
    doi = fields.String(required=True)
    url = fields.String(required=True)
    published_date = Date(required=True)
    thumb = fields.String(required=True)
    url_private_api = fields.String(required=True)
    url_private_html = fields.String(required=True)
    url_public_api = fields.String(required=True)
    url_public_html = fields.String(required=True)
    defined_type = fields.Integer(required=True)
    group_id = fields.Integer(required=False)
Ejemplo n.º 6
0
class ArticleFile(Model):

    status = fields.String()
    is_link_only = fields.Boolean()
    name = fields.String()
    viewer_type = fields.String()
    preview_state = fields.String()
    download_url = fields.String()
    supplied_md5 = fields.String()
    computed_md5 = fields.String()
    upload_token = fields.String()
    upload_url = fields.String()
    id = fields.Integer()
    size = fields.Integer()
Ejemplo n.º 7
0
class FileL1(Model):

    id = fields.Integer(required=True)
    name = fields.String(required=True)
    size = fields.Integer()

    status = fields.String()
    viewer_type = fields.String()
    preview_state = fields.String()
    preview_meta = fields.Field()
    is_link_only = fields.Boolean()
    upload_url = fields.String()
    upload_token = fields.String()
    supplied_md5 = fields.String()
    computed_md5 = fields.String()
Ejemplo n.º 8
0
class Author(Model):

    id = fields.Integer(required=True)
    full_name = fields.String(required=True)
    is_active = fields.Boolean()
    url_name = fields.String()
    orcid_id = fields.String()
Ejemplo n.º 9
0
class ArticleShort(Model):

    id = fields.Integer(required=True)
    title = fields.String(required=True)
    doi = fields.String(required=True)
    url = fields.String(required=True)
    published_date = Date(required=True)
Ejemplo n.º 10
0
class ChannelNews(OpentopicModel):
    """
    Represent single `ChannelNews` object.

    :param pk: channel news id
    :param news_index: unique news index value
    :param title: title of the news, it's title that news was published with
    :param description: description (body) of the news, it's description that news was published with
    :param extra_message: extra_message of the news, TODO: ? what is that ?
    :param url: url of the news, depends on publication options might be original url or blog url
     if news was already published to blog platform (wordpress), also depends on options might be short or long version
    :param is_published: bool value describing if news is already published (with success)
    :param is_scheduled: bool value describing if news is scheduled to be publish
    """

    pk = fields.Integer()
    news_index = fields.String()
    title = fields.String()
    description = fields.String()
    extra_message = fields.String()
    url = fields.String()
    is_published = fields.Boolean()
    is_scheduled = fields.Boolean()

    parser = parse_channelnews

    def __str__(self):
        return self.title
Ejemplo n.º 11
0
class CollectionShort(Model):

    title = fields.String()
    doi = fields.String()
    url = fields.String()
    id = fields.Integer()
    published_date = Date()
Ejemplo n.º 12
0
class HistoryItem(Model):
    id = fields.Integer(primary=True)
    type = fields.String()
    subject = fields.String()
    note = fields.String()

    entry_date = fields.String(name='entryDate', read_only=True)
    creator = fields.String(read_only=True)
    creator_name = fields.String(read_only=True)

    party = None
    opportunity = None
    case = None

    @property
    def _url(self):
        if getattr(self, '_persisted', False) is True:
            return '/api/history/%s' % self.id
        if not (self.party or self.opportunity or self.case):
            raise ValidationError('Party, opportunity, or case is required')
        if bool(self.party) + bool(self.opportunity) + bool(self.case) > 1:
            raise ValidationError(
                'Should only provide one of party, opportunity, case')
        if self.party:
            return '/api/party/%s/history' % self.party.id
        elif self.opportunity:
            return '/api/opportunity/%s/history' % self.opportunity.id
        elif self.case:
            return '/api/kase/%s/history' % self.case.id
Ejemplo n.º 13
0
class ArticleFileUploadStatus(Model):

    token = fields.String()
    md5 = fields.String()
    size = fields.Integer()
    name = fields.String()
    status = fields.String()
    parts = fields.Collection(ArticleFileUploadPart)
class Patient(Model):
    # required fields
    sex = fields.Field(choices=[
        '46XY', '46XX', '45X', '47XX', '47XXY', '47XYY', 'other', 'unknown'
    ],
                       required=True)
    reference = fields.String(required=True)
    project_id = fields.Integer(required=True)
    # optional fields
    age = fields.Field(choices=['unknown', 'Prenatal'] +
                       [str(x) for x in range(0, 101)],
                       default="unknown")
    prenatal = fields.Field(choices=[x for x in range(10, 43)].append(None))
    aneuploidy = fields.Boolean(default=False)
    user_id = fields.Integer()
    note = fields.String()
    consent = fields.Field(choices=['No', 'Yes'], default="No")
Ejemplo n.º 15
0
class Repo(Model):
    id = fields.Integer()
    name = fields.String()
    owner = fields.String()
    is_private = fields.Boolean()

    def parse(self, body, headers):
        return parse_repo(json.loads(body))

    def __repr__(self):
        return 'Repo({}/{})'.format(self.owner, self.name)
Ejemplo n.º 16
0
class ExampleModelJson(Model):

    int_field = fields.Integer()
    str_field = fields.String()
    col_int_field = fields.Collection(fields.Integer)
    col_str_field = fields.Collection(fields.String)

    def __str__(self):
        return "int: {0}, str: {1}, col_int: {2}, col_str: {3}".format(
            str(self.int_field), self.str_field, str(self.col_int_field),
            str(self.col_str_field))
class Person(Model):
    # required fields
    patient_id = fields.Integer(required=True)
    relation = fields.Field(choices=filter(
        lambda x: x not in [Relation.father.value, Relation.mother.value],
        [x.value for x in Relation.__members__.values()]),
                            required=True)
    # optional fields
    relation_status = fields.Field(
        choices=[x.value for x in AffectionStatus.__members__.values()],
        default=AffectionStatus.unknown.value)
Ejemplo n.º 18
0
class ArticleCreate(Model):

    title = fields.String(required=True)
    description = fields.String()
    tags = fields.Collection(fields.String)
    references = fields.Collection(fields.String)
    categories = fields.Collection(fields.Integer)
    authors = fields.Collection(AuthorCreate)
    custom_fields = fields.Field()
    defined_type = DefinedType()
    funding = fields.String()
    license = fields.Integer()
Ejemplo n.º 19
0
class RecommendationNews(OpentopicModel):
    """
    Represent single `RecommendationNews` object.

    :param pk: unique news index value
    :param title: title of the news, it's title that news was published with
    :param description: description (body) of the news, it's description that news was published with
    :param description_plain: same as description, except that html is excluded
    :param url: url of the news, depends on publication options might be original url or blog url
     if news was already published to blog platform (wordpress), also depends on options might be short or long version
    :param image: url to original image attached to news
    :param keywords: keywords for content
    :param popularity: total popularity from social medias
    :param twitter_count: number of twitter shares
    :param facebook_like_count: number of facebook shares
    :param linkedin_share_count: number of linkedin shares
    :param googleplus_share_count: number of g+ shares
    :param sorting_factor: int value represent opentopic algo score
    """

    pk = fields.String()
    title = fields.String()
    description = fields.String()
    description_plain = fields.String()
    url = fields.String()
    image = fields.String()
    keywords = fields.String()

    popularity = fields.Integer()
    twitter_count = fields.Integer()
    facebook_like_count = fields.Integer()
    linkedin_share_count = fields.Integer()
    googleplus_share_count = fields.Integer()

    sorting_factor = fields.Float()

    parser = parse_recommendationnews

    def __str__(self):
        return self.title
Ejemplo n.º 20
0
class CollectionL1(Model):

    title = fields.String()
    doi = fields.String()
    url = fields.String()
    id = fields.Integer()
    published_date = Date()

    group_resource_id = fields.String()
    resource_id = fields.String()
    resource_doi = fields.String()
    resource_title = fields.String()
    resource_version = fields.String()
    version = fields.Integer()
    description = fields.String()
    categories = fields.Collection(Category)
    references = fields.Collection(fields.String)
    tags = fields.Collection(fields.String)
    authors = fields.Collection(Author)
    institution_id = fields.Integer()
    group_id = fields.Integer()
    public = fields.Integer()
    # custom_metadata = fields.Collection(fields.Field)
    citation = fields.String()
    custom_fields = fields.Collection(CustomField)
    created_date = Date()
    modified_date = Date()
    resource_link = fields.String()
    articles_count = fields.Integer()
Ejemplo n.º 21
0
class Track(Model):
    """
    Model for a track from the Hypem API.

    Example track json data as returned by a Hypem API call to
    https://api.hypem.com/v2/tracks/2cr8m:
    {
        itemid: "2cr8m",
        artist: "Axwell/\Ingrosso",
        title: "Sun Is Shining (M-22 Remix)",
        dateposted: 1439439109,
        siteid: 14143,
        sitename: "POP ON AND ON",
        posturl: "http://poponandon.com/remix-alert-alesso-ingrosso-sun-is-shining-m-22-remix/",
        postid: 2739879,
        loved_count: 491,
        posted_count: 2,
        thumb_url: "http://static-ak.hypem.net/thumbs_new/a7/2739879.jpg",
        thumb_url_medium: "http://static-ak.hypem.net/thumbs_new/a7/2739879_120.jpg",
        thumb_url_large: "http://static-ak.hypem.net/thumbs_new/4f/2738767_320.jpg",
        time: 364,
        description: "Axwell /\ Ingrosso’s “Sun Is Shining” receives the remix treatment from M-22 and the result is pretty f*****g epic. M-22 bring the feels here, the build and the drop create a driving energy that commands hands-in-the-air action! Get into the vibes below v",
        itunes_link: "http://hypem.com/go/itunes_search/Axwell/\Ingrosso"
    }
    """

    itemid = fields.String()
    artist = fields.String()
    title = fields.String()
    dateposted = fields.Integer()
    siteid = fields.Integer()
    sitename = fields.String()
    posturl = fields.String()
    postid = fields.Integer()
    loved_count = fields.Integer()
    posted_count = fields.Integer()
    thumb_url = fields.String()
    thumb_url_medium = fields.String()
    thumb_url_large = fields.String()
    time = fields.Integer()
    description = fields.String()
    itunes_link = fields.String()

    ts_loved = fields.Integer()
    p_id = fields.Integer()

    def is_favorite(self):
        return self.ts_loved is not None
Ejemplo n.º 22
0
class TestCollectionModel(OpentopicModel):
    """
    Represent recommendation object.
    TODO: link to documentation
    """

    pk = fields.Integer()
    name = fields.String()

    parser = test_parser

    @property
    def id(self):
        return self.pk

    def __str__(self):
        return self.name
Ejemplo n.º 23
0
class Recommendation(OpentopicModel):
    """
    Represent single `Recommendation` object

    :param pk: id of `Recommendation`
    :param name: name of `Recommendation`
    """

    pk = fields.Integer()
    name = fields.String()

    parser = parse_recommendation

    @property
    def id(self):
        return self.pk

    def __str__(self):
        return self.name
Ejemplo n.º 24
0
class Case(Model):
    id = fields.Integer(primary=True)
    status = fields.String(choices=['OPEN', 'CLOSED'])
    name = fields.String(required=True)
    description = fields.String()
    owner = fields.String()
    close_date = fields.String(name='closeDate')

    created_on = fields.String(name='createdOn', read_only=True)
    updated_on = fields.String(name='updatedOn', read_only=True)

    party = None

    @property
    def _url(self):
        if getattr(self, '_persisted', False) is True:
            return '/api/kase/%s' % self.id
        if not self.party:
            raise ValidationError('Party is required')
        return '/api/party/%s/kase' % self.party.id
Ejemplo n.º 25
0
class Source(OpentopicModel):
    """
    Represent single `Source` object.

    :param pk: id of `Source`
    :param source_type: Type of the source
    :param name: Name of the source
    """

    pk = fields.Integer()
    source_type = fields.String()
    name = fields.String()

    parser = parse_source

    @property
    def id(self):
        return self.pk

    def __str__(self):
        return self.name
Ejemplo n.º 26
0
class Channel(OpentopicModel):
    """
    Represent single `Channel` object.

    :param pk: id of `Channel`
    :type pk:
    :param name: name of the channel
    :param channel_type: one of the value: mailchimp, facebook, twitter
    """

    pk = fields.Integer()
    name = fields.String()
    channel_type = fields.String()

    parser = parse_channel

    @property
    def id(self):
        return self.pk

    def __str__(self):
        return self.name
Ejemplo n.º 27
0
class License(Model):

    name = fields.Integer(required=True)
    value = fields.String(required=True)
    url = fields.String()
Ejemplo n.º 28
0
class Category(Model):

    id = fields.Integer(required=True)
    title = fields.String(required=True)
Ejemplo n.º 29
0
class CollectionVersion(Model):

    version = fields.Integer()
    url = fields.String()
Ejemplo n.º 30
0
class ArticleEmbargo(Model):

    is_embargoed = fields.Integer()
    embargo_date = Date()
    embargo_type = fields.String()
    embargo_reason = fields.String()