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))
class IntegrationReply(ReplyValue): value = Attribute( MappingType( 'type', { PLAIN_TYPE: ObjectType(PlainType), INTEGRATION_TYPE: ObjectType(IntegrationType), }))
class QuestionnaireReportDTO(AttributesMixin): indications = ListAttribute( MappingType( 'indication_type', { ANSWERED_INDICATION: ObjectType(AnsweredIndication), LEVELS_ANSWERED_INDICATION: ObjectType(LevelsAnsweredIndication), }))
class QuestionnairePermRecordDTO(AttributesMixin): member = Attribute( MappingType( 'type', { GROUP_MEMBER: ObjectType(GroupMember), USER_MEMBER: ObjectType(UserMember), })) perms = ListAttribute(StringType())
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)
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), }))
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')