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()
Пример #2
0
class CollectionShort(Model):

    title = fields.String()
    doi = fields.String()
    url = fields.String()
    id = fields.Integer()
    published_date = Date()
Пример #3
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
Пример #4
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)
Пример #5
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()
Пример #6
0
class ArticleFileUploadStatus(Model):

    token = fields.String()
    md5 = fields.String()
    size = fields.Integer()
    name = fields.String()
    status = fields.String()
    parts = fields.Collection(ArticleFileUploadPart)
Пример #7
0
 class Website(Model):
     type = fields.String()
     web_service = fields.String(
         name='webService',
         choices=
         'URL SKYPE TWITTER FACEBOOK LINKED_IN XING FEED GOOGLE_PLUS FLICKR GITHUB YOUTUBE'
         .split())
     web_address = fields.String(name='webAddress')
Пример #8
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)
Пример #9
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()
Пример #10
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
Пример #11
0
class CollectionCreate(Model):

    title = fields.String(required=True)
    description = fields.String()
    # doi = fields.String()
    articles = fields.Collection(fields.Integer)
    authors = fields.Collection(AuthorCreate)
    categories = fields.Collection(fields.Integer)
    tags = fields.Collection(fields.String)
    references = fields.Collection(fields.String)
    # resource_id = fields.String()
    # resource_doi = fields.String()
    # resource_link = fields.String()
    # resource_title = fields.String()
    # resource_versions = fields.Integer()
    custom_fields = fields.Field()
Пример #12
0
class ArticleFileUploadPart(Model):

    partNo = fields.Integer()
    startOffset = fields.Integer()
    endOffset = fields.Integer()
    status = fields.String()
    locked = fields.Boolean()
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")
Пример #14
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()
Пример #15
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))
Пример #16
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
Пример #17
0
 class Address(Model):
     type = fields.String()
     street = fields.String()
     city = fields.String()
     state = fields.String()
     zip = fields.String()
     country = fields.String()
Пример #18
0
class CompactRouteEntity(Model):
  origin_code = fields.String()
  origin_name = fields.String()
  destination_code = fields.String()
  destination_name = fields.String()
  airline_code = fields.String()
  airline_name = fields.String()
Пример #19
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
Пример #20
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)
Пример #21
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
Пример #22
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()
Пример #23
0
class CustomField(Model):
    tag = fields.String()
    label = fields.String()
    string_value = fields.String(name='text')
    date_value = fields.String(name='date')
    boolean_value = fields.Boolean(name='boolean')

    party = None
    opportunity = None
    case = None

    @property
    def _url(self):
        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/customfields' % self.party.id
        elif self.opportunity:
            return '/api/opportunity/%s/customfields' % self.opportunity.id
        elif self.case:
            return '/api/kase/%s/customfields' % self.case.id
Пример #24
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
Пример #25
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
Пример #26
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
Пример #27
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
Пример #28
0
class Tag(Model):
    name = fields.String()

    party = None
    opportunity = None
    case = None

    @property
    def _url(self):
        if not self.name:
            raise ValidationError('Tag name is required')
        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/tag/%s' % (self.party.id, self.name)
        elif self.opportunity:
            return '/api/opportunity/%s/tag/%s' % (self.opportunity.id,
                                                   self.name)
        elif self.case:
            return '/api/kase/%s/tag/%s' % (self.case.id, self.name)
Пример #29
0
class User(models.Model):
    name = fields.String()
    email = fields.String()
Пример #30
0
class License(Model):

    name = fields.Integer(required=True)
    value = fields.String(required=True)
    url = fields.String()