Python:Check

From wiki
Jump to navigation Jump to search

from dataclasses import dataclass from typing import Optional import dacite @dataclass class Check:

   """
   I am a quality check
   """
   pageTitle:str
   qKey:Optional[str] # the full qualifying (primary) key of this check
   key:Optional[str] # the local key of this check
   concept:Optional[str] # the concept of the items being checked by this check
   since:Optional[str] # the date this check was activated
   check:Optional[str] # the description of what is checked by this Check
   problem:Optional[str] # problem of this item
   ok:Optional[float] # number of items that pass the check/are ok
   total:Optional[float] # number of items that are checked in total
   pain:Optional[float] # pain of this item
   @classmethod
   def askQuery(cls):
       """
       get the ask Query for Check
       
       Returns:
           str: the mediawiki markup for the ask query
       """

ask="""

pageTitleqKeykeyconceptsincecheckproblemoktotalpain
Check/Chapter nochapter_nonoChapterChapter must have nono missing17173
Check/Keyword KeywordShouldBeReferencedkeyword_KeywordShouldBeReferencedKeywordShouldBeReferencedKeywordkeywords which are defined should be referenced at least oncekeyword never referenced4364584
Check/Keyword KeywordsLinkskeyword_KeywordsLinksKeywordsLinksKeywordkeyword links in keywords should point to valid keywordskeyword definition missing4574584
Check/Keyword Literature4Keywordskeyword_Literature4KeywordsLiterature4KeywordsKeyword18 February 2023literature referenced in keywords should be defined in literature listliterature definition missing4584584
Check/Lg Keywords4LearningGoalslg_Keywords4LearningGoalsKeywords4LearningGoalsLearningGoalkeywords referenced in learning goals should be defined in keyword listkeywords definition missing1011014
Check/Lg KeywordsOfLearningGoalslg_KeywordsOfLearningGoalsKeywordsOfLearningGoalsLearningGoalLearningGoals with level>1 should have a list of keywordskeywords missing1011014
Check/Lg Relevancelg_RelevanceRelevanceLearningGoal1 February 2023Learning Goals must have a relevancerelevance missing1011013
Check/Lg Slidelg_SlideSlideLearningGoal8 February 2023There should be at least one slide for learning goal with level>1No slide references the learning goal981014
Check/Lg errorslg_errorserrorsLearningGoal17 February 2023LearningGoal should have no software errors attacheda software error occured1011016
Check/Lg qKeylg_qKeyqKeyLearningGoal1 February 2023LearningGoal must have qKeyqKey missing1011013
Check/Presentation keypresentation_keykeyPresentationPresentation must have keykey missing993
Check/Pubs LookupIdentifierpubs_LookupIdentifierLookupIdentifierPublication12 February 2023a publication should have a wikidata id an isbn or a doipublication has no identifier to lookup details29294
Check/Pubs PublicationShouldBeReferencedpubs_PublicationShouldBeReferencedPublicationShouldBeReferencedPublicationpublication which is defined should be referenced as literature at least oncepublication never referenced as literature22294
Check/Pubs errorspubs_errorserrorsPublication17 February 2023Publication should have no software errors attacheda software error occured29296
Check/Pubs idpubs_ididPublication1 February 2023Publication must have idid missing29293
Check/Rl idrl_ididRelevanceLevelRelevanceLevel must have idid missing443
Check/Sheet conceptsheet_conceptconceptSheet1 February 2023Sheet must have conceptconcept missing993
Check/Sheet errorssheet_errorserrorsSheet17 February 2023Sheet should have no software errors attacheda software error occured996
Check/Slide Literature4Slidesslide_Literature4SlidesLiterature4SlidesSlide11 February 2023literature referenced in slides should be defined in literature listliterature definition missing6616614
Check/Slide SlideLinksslide_SlideLinksSlideLinksSlide9 February 2023links to other slides in slides should point to valid slidesslide linked to is missing6616614

"""

       return ask
       
   @classmethod
   def fromDict(cls,data:dict):
       """
       create a Check from the given dict
       
       Args:
           data(dict): the dict to create the Check from
       
       Returns:
           Check: the freshly created Check
       """
       check=dacite.from_dict(data_class=cls,data=data)
       return check