def __init__(self, id, version, block, user_id="", modified_on_str=""):
        self.id = id
        self.version = version
        self.user_id = user_id
        self.modified_on_str = modified_on_str
        
        # deal with the various blocks
        self.raw_block = block
        self.create_block = block.get(const.CASE_ACTION_CREATE, {})
        self.update_block = block.get(const.CASE_ACTION_UPDATE, {})
        self.close_block = block.get(const.CASE_ACTION_CLOSE, {})
        self._closes_case = const.CASE_ACTION_CLOSE in block
        self.index_block = block.get(const.CASE_ACTION_INDEX, {})
        self.attachment_block = block.get(const.CASE_ACTION_ATTACHMENT, {})

        # referrals? really? really???
        self.referral_block = block.get(const.REFERRAL_TAG, {})
        
        # actions
        self.actions = []
        if self.creates_case():
            self.actions.append(CREATE_ACTION_FUNCTION_MAP[self.version](self.create_block))
        if self.updates_case():
            self.actions.append(UPDATE_ACTION_FUNCTION_MAP[self.version](self.update_block))
        if self.closes_case():
            self.actions.append(CLOSE_ACTION_FUNCTION_MAP[self.version](self.close_block))
        if self.has_indices():
            self.actions.append(INDEX_ACTION_FUNCTION_MAP[self.version](self.index_block))
        if self.has_attachments():
            self.actions.append(ATTACHMENT_ACTION_FUNCTION_MAP[self.version](self.attachment_block))

        if not self.actions:
            self.actions.append(NOOP_ACTION_FUNCTION_MAP[self.version]({}))
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/casexml/apps/case/xml/parser.py/CaseUpdate.__init__/original