Beispiel #1
0
class KnowledgeModelEntities(AttributesMixin):
    answers = DictAttribute(StringType(), ObjectType(Answer))
    chapters = DictAttribute(StringType(), ObjectType(Chapter))
    choices = DictAttribute(StringType(), ObjectType(Choice))
    experts = DictAttribute(StringType(), ObjectType(Expert))
    integrations = DictAttribute(StringType(), ObjectType(Integration))
    questions = DictAttribute(
        StringType(),
        MappingType(
            'question_type', {
                OPTIONS_QUESTION: ObjectType(OptionsQuestion),
                MULTI_CHOICE_QUESTION: ObjectType(MultiChoiceQuestion),
                LIST_QUESTION: ObjectType(ListQuestion),
                VALUE_QUESTION: ObjectType(ValueQuestion),
                INTEGRATION_QUESTION: ObjectType(IntegrationQuestion),
            }))
    references = DictAttribute(
        StringType(),
        MappingType(
            'reference_type', {
                RESOURCE_PAGE_REFERENCE: ObjectType(ResourcePageReference),
                URL_REFERENCE: ObjectType(URLReference),
                CROSS_REFERENCE: ObjectType(CrossReference),
            }))
    tags = DictAttribute(StringType(), ObjectType(Tag))
Beispiel #2
0
class IntegrationReply(ReplyValue):
    value = Attribute(
        MappingType(
            'type', {
                PLAIN_TYPE: ObjectType(PlainType),
                INTEGRATION_TYPE: ObjectType(IntegrationType),
            }))
Beispiel #3
0
class QuestionnaireReportDTO(AttributesMixin):
    indications = ListAttribute(
        MappingType(
            'indication_type', {
                ANSWERED_INDICATION: ObjectType(AnsweredIndication),
                LEVELS_ANSWERED_INDICATION:
                ObjectType(LevelsAnsweredIndication),
            }))
Beispiel #4
0
class QuestionnairePermRecordDTO(AttributesMixin):
    member = Attribute(
        MappingType(
            'type', {
                GROUP_MEMBER: ObjectType(GroupMember),
                USER_MEMBER: ObjectType(UserMember),
            }))
    perms = ListAttribute(StringType())
Beispiel #5
0
class SetReplyEvent(QuestionnaireEvent):
    path = StringAttribute(nullable=True)
    value = Attribute(MappingType(
        'type', {
            ANSWER_REPLY: ObjectType(AnswerReply),
            INTEGRATION_REPLY: ObjectType(IntegrationReply),
            ITEM_LIST_REPLY: ObjectType(ItemListReply),
            MULTI_CHOICE_REPLY: ObjectType(MultiChoiceReply),
            STRING_REPLY: ObjectType(StringReply),
        }),
                      nullable=True)
Beispiel #6
0
class Reply(AttributesMixin):
    created_at = DateTimeAttribute()
    created_by = ObjectAttribute(UserSuggestion)
    value = Attribute(
        MappingType(
            'type', {
                ANSWER_REPLY: ObjectType(AnswerReply),
                INTEGRATION_REPLY: ObjectType(IntegrationReply),
                ITEM_LIST_REPLY: ObjectType(ItemListReply),
                MULTI_CHOICE_REPLY: ObjectType(MultiChoiceReply),
                STRING_REPLY: ObjectType(StringReply),
            }))
Beispiel #7
0
class Questionnaire(Model):
    created_at = DateTimeAttribute()
    creator_uuid = StringAttribute(nullable=True)
    events = ListAttribute(MappingType('type', {
        SET_REPLY_EVENT: ObjectType(SetReplyEvent),
        CLEAR_REPLY_EVENT: ObjectType(ClearReplyEvent),
        SET_LEVEL_EVENT: ObjectType(SetLevelEvent),
        SET_LABELS_EVENT: ObjectType(SetLabelsEvent),
    }))
    format = ObjectAttribute(TemplateFormat, nullable=True)
    format_uuid = StringAttribute(nullable=True)
    knowledge_model = ObjectAttribute(KnowledgeModel)
    labels = DictAttribute(StringType(), StringType())
    level = IntegerAttribute()
    name = StringAttribute()
    package = ObjectAttribute(PackageSimpleDTO)
    permissions = ListAttribute(ObjectType(QuestionnairePermRecordDTO))
    replies = DictAttribute(StringType(), ObjectType(Reply))
    selected_tag_uuids = ListAttribute(StringType())
    sharing = StringAttribute(choices=QUESTIONNAIRE_SHARING)
    state = StringAttribute(choices=QUESTIONNAIRE_STATES)
    template = ObjectAttribute(TemplateSimple, nullable=True)
    template_id = StringAttribute(nullable=True)
    updated_at = DateTimeAttribute()
    versions = ListAttribute(ObjectType(QuestionnaireVersion))
    visibility = StringAttribute(choices=QUESTIONNAIRE_VISIBILITIES)

    documents = ListOfModelsAttribute(Document, default=[])

    def _create(self):
        raise NotImplementedError('Cannot create questionnaires')

    def _update(self):
        raise NotImplementedError('Cannot update questionnaires')

    def _delete(self):
        raise NotImplementedError('Cannot delete questionnaires')