示例#1
0
    def test_gen_ddlm(self, in_tmpdir, test_files):
        myIo = IoAdapterPy()
        containerList = myIo.readFile(
            inputFilePath=str(test_files / 'mmcif_pdbx_v5_next.dic'))
        dApi = DictionaryApi(containerList=containerList, consolidate=True)
        parentD = dApi.getParentDictionary()
        #
        oCList = []
        dDef = DataContainer('mmcif_pdbx_ddlm_auto')
        dc = DataCategory("dictionary")
        dc.appendAttribute("title")
        dc.appendAttribute("class")
        dc.appendAttribute("version")
        dc.appendAttribute("date")
        dc.appendAttribute("ddl_conformance")
        dc.appendAttribute("text")
        dc.append([
            'mmcif_pdbx_ddlm_auto', 'Instance', 'latest', '2018-03-09',
            'ddlm best effort',
            'Software converted PDBx dictionary using DDLm semantics'
        ])
        dDef.append(dc)
        oCList.append(dDef)

        catIdx = dApi.getCategoryIndex()
        for catName in sorted(catIdx.keys()):
            attNameList = catIdx[catName]
            # created definition container -
            cDef = DefinitionContainer(catName)
            oCList.append(cDef)
            #
            dc = DataCategory("definition")
            dc.appendAttribute("id")
            dc.appendAttribute("scope")
            dc.appendAttribute("class")
            dc.appendAttribute("update")
            dc.append([catName, "Category", "Loop", "2018-03-09"])
            cDef.append(dc)
            val = dApi.getCategoryDescription(category=catName)
            dc = DataCategory("description")
            dc.appendAttribute("text")
            dc.append([val])
            cDef.append(dc)
            #
            dc = DataCategory("name")
            dc.appendAttribute("category_id")
            dc.appendAttribute("object_id")

            valList = dApi.getCategoryGroupList(category=catName)
            pcg = catName
            for val in valList:
                if val != 'inclusive_group':
                    pcg = val
                    break
            dc.append([catName, pcg])
            cDef.append(dc)

            valList = dApi.getCategoryKeyList(category=catName)
            if len(valList) < 1:
                print("Missing caegory key for category %s\n" % catName)
            else:
                dc = DataCategory("category")
                dc.appendAttribute("key_id")
                kItemName = CifName.itemName(catName, "synthetic_key")
                dc.append([kItemName])
                cDef.append(dc)

                iDef = DefinitionContainer(kItemName)
                self._makeKeyItem(catName, "synthetic_key", valList, iDef)
                oCList.append(iDef)

            for attName in attNameList:
                itemName = CifName.itemName(catName, attName)
                iDef = DefinitionContainer(itemName)

                oCList.append(iDef)

                #
                dc = DataCategory("definition")
                dc.appendAttribute("id")
                dc.appendAttribute("scope")
                dc.appendAttribute("class")
                dc.appendAttribute("update")
                dc.append([itemName, "Item", "Single", "2013-08-22"])
                iDef.append(dc)
                #
                val = dApi.getDescription(category=catName, attribute=attName)
                dc = DataCategory("description")
                dc.appendAttribute("text")
                dc.append([val])
                iDef.append(dc)
                #
                dc = DataCategory("name")
                dc.appendAttribute("category_id")
                dc.appendAttribute("object_id")
                #
                if itemName in parentD:
                    dc.appendAttribute("linked_item_id")
                    dc.append([catName, attName, parentD[itemName][0]])
                else:
                    dc.append([catName, attName])
                iDef.append(dc)
                #
                #
                aliasList = dApi.getItemAliasList(category=catName,
                                                  attribute=attName)
                if len(aliasList) > 0:
                    dc = DataCategory("alias")
                    dc.appendAttribute("definition_id")
                    for alias in aliasList:
                        dc.append([alias[0]])
                    iDef.append(dc)

                enList = dApi.getEnumListAltWithDetail(category=catName,
                                                       attribute=attName)

                tC = dApi.getTypeCode(category=catName, attribute=attName)
                tcontainer = 'Single'
                purpose = 'Describe'
                source = 'Recorded'
                contents = 'Text'
                #
                if tC is None:
                    self.__lfh.write("Missing data type attribute %s\n" %
                                     attName)
                elif tC in [
                        'code', 'atcode', 'name', 'idname', 'symop', 'fax',
                        'phone', 'email', 'code30', 'ec-type'
                ]:
                    purpose = 'Encode'
                    contents = 'Text'
                    source = 'Assigned'
                elif tC in ['ucode']:
                    purpose = 'Encode'
                    contents = 'Code'
                    source = 'Assigned'
                elif tC in ['line', 'uline', 'text']:
                    purpose = 'Describe'
                    source = 'Recorded'
                    contents = 'Text'
                elif tC in ['int']:
                    purpose = 'Number'
                    source = 'Recorded'
                    contents = 'Integer'
                elif tC in ['int-range']:
                    purpose = 'Number'
                    source = 'Recorded'
                    contents = 'Range'
                elif tC in ['float']:
                    purpose = 'Measurand'
                    source = 'Recorded'
                    contents = 'Real'
                elif tC in ['float-range']:
                    purpose = 'Measurand'
                    source = 'Recorded'
                    contents = 'Range'
                elif tC.startswith('yyyy'):
                    source = 'Assigned'
                    contents = 'Date'
                    purpose = 'Describe'

                if len(enList) > 0:
                    purpose = 'State'

                dc = DataCategory("type")
                dc.appendAttribute("purpose")
                dc.appendAttribute("source")
                dc.appendAttribute("contents")
                dc.appendAttribute("container")
                dc.append([purpose, source, contents, tcontainer])
                iDef.append(dc)
                #
                if (len(enList) > 0):
                    dc = DataCategory("enumeration_set")
                    dc.appendAttribute("state")
                    dc.appendAttribute("detail")
                    for en in enList:
                        dc.append([en[0], en[1]])
                    iDef.append(dc)

                dfv = dApi.getDefaultValue(category=catName, attribute=attName)
                bvList = dApi.getBoundaryList(category=catName,
                                              attribute=attName)
                if (((dfv is not None) and (dfv not in ['?', '.']))
                        or len(bvList) > 0):
                    row = []
                    dc = DataCategory("enumeration")
                    if dfv is not None:
                        dc.appendAttribute("default")
                        row.append(dfv)
                    if len(bvList) > 0:
                        dc.appendAttribute("range")
                        mminVp = -1000000
                        mmaxVp = 10000000
                        mminV = mmaxVp
                        mmaxV = mminVp
                        for bv in bvList:
                            minV = float(bv[0]) if bv[0] != '.' else mminVp
                            maxV = float(bv[1]) if bv[1] != '.' else mmaxVp
                            mminV = min(mminV, minV)
                            mmaxV = max(mmaxV, maxV)
                        if mminV == mminVp:
                            mminV = ''
                        if mmaxV == mmaxVp:
                            mmaxV = ''
                        row.append(str(mminV) + ":" + str(mmaxV))

                    dc.append(row)
                    iDef.append(dc)

        myIo.writeFile(outputFilePath="mmcif_pdbx_ddlm_auto.dic",
                       containerList=oCList)
    def test_markup_category_group(self, in_tmpdir, test_files, out_file_name,
                                   groupSelectList):
        oFile = out_file_name
        rL = []

        myIo = IoAdapter()
        containerList = myIo.readFile(
            str(test_files / "mmcif_pdbx_v5_next.dic"))
        dApi = DictionaryApi(containerList=containerList, consolidate=True)
        #
        groupList = dApi.getCategoryGroups()
        print('groupList %s\n' % groupList)
        for groupName in groupList:
            if groupSelectList and groupName not in groupSelectList:
                continue

            #
            # Goup header details
            #
            rL.append("# Category Group %s" % groupName)
            rL.append("")
            rL.append("")
            rL.append("%s" % dApi.getCategoryGroupDescription(groupName))
            rL.append("")
            rL.append("---")
            rL.append("")
            catNameList = dApi.getCategoryGroupCategories(groupName=groupName)
            #
            cList = self.__sortIgnoreCase(catNameList)
            for catName in cList:
                print('Group %s category %s\n' % (groupName, catName))
                catDescription = dApi.getCategoryDescription(category=catName)
                catExTupList = dApi.getCategoryExampleList(category=catName)
                keyItemNameList = dApi.getCategoryKeyList(category=catName)
                keyAttNameList = [
                    CifName.attributePart(k) for k in keyItemNameList
                ]
                #
                # Category header details
                #
                rL.append("## Category %s" % catName)
                rL.append("")
                rL.append("")
                rL.append(" %s" % catDescription)
                rL.append("")
                rL.append("---")
                rL.append("")
                if catExTupList:
                    rL.extend(
                        self.__formatTupListInset(catExTupList, tab='     '))
                    #
                    # summary table
                    #
                rL.append("")
                rL.append("---")
                rL.append("")
                rL.append(
                    "| Attribute | Key | Required | Type | Units | Enumerated | Bounded |"
                )
                rL.append(
                    "| --------- | --- | -------- | ---- | ----- | ---------- | ------- |"
                )
                aList = self.__sortIgnoreCase(
                    dApi.getAttributeNameList(category=catName))
                for attName in aList:
                    isKey = attName in keyAttNameList
                    attDescription = dApi.getDescription(category=catName,
                                                         attribute=attName)
                    attUnits = dApi.getUnits(category=catName,
                                             attribute=attName)
                    attMandatory = dApi.getMandatoryCode(category=catName,
                                                         attribute=attName)
                    attTypeCode = dApi.getTypeCode(category=catName,
                                                   attribute=attName)

                    enumTupList = dApi.getEnumListWithDetail(category=catName,
                                                             attribute=attName)
                    if len(enumTupList) > 0:
                        isEnum = True
                    else:
                        isEnum = False
                    bL = dApi.getBoundaryList(category=catName,
                                              attribute=attName)
                    if len(bL) > 0:
                        isBounded = True
                    else:
                        isBounded = False
                    rL.append(
                        '| %s | %s | %s | %s | %s | %s | %s |' %
                        (attName, self.__trB(isKey), attMandatory, attTypeCode,
                         attUnits, self.__trB(isEnum), self.__trB(isBounded)))
                #
                rL.append("")
                rL.append("---")
                rL.append("")
                #
                for attName in aList:
                    isKey = attName in keyAttNameList
                    attMandatory = dApi.getMandatoryCode(category=catName,
                                                         attribute=attName)
                    #
                    tN = '_' + catName + '.' + attName
                    if isKey:
                        tN = tN + ' (key)'
                    elif attMandatory.upper() in ['YES', 'Y']:
                        tN = tN + ' (required)'
                    #
                    rL.append("#### %s\n" % tN)
                    rL.append("")
                    attDescription = dApi.getDescription(category=catName,
                                                         attribute=attName)
                    rL.append(" %s\n" % attDescription)
                    rL.append("")
                    attUnits = dApi.getUnits(category=catName,
                                             attribute=attName)
                    attTypeCode = dApi.getTypeCode(category=catName,
                                                   attribute=attName)

                    enumTupList = dApi.getEnumListWithDetail(category=catName,
                                                             attribute=attName)
                    if len(enumTupList) > 0:
                        rL.append("")
                        rL.append("---")
                        rL.append("")
                        rL.append("| Allowed Values | Detail |")
                        rL.append("| -------------- | ------ |")
                        for tup in enumTupList:
                            if tup[1] and len(tup[1]) > 0:
                                rL.append("| %s | %s |" % (tup[0], tup[1]))
                            else:
                                rL.append("| %s | %s |" % (tup[0], ' '))
                        rL.append("")

                    #
                    bL = dApi.getBoundaryList(category=catName,
                                              attribute=attName)
                    btL = self.__processbounds(bL)
                    if len(btL) > 0:
                        tup = btL[0]
                        rL.append("")
                        rL.append("---")
                        rL.append("")
                        rL.append("| %s | %s |" % (tup[0], tup[1]))
                        #
                        rL.append("| ------------- | ------ |")
                        for tup in btL[1:]:
                            rL.append("| %s | %s |" % (tup[0], tup[1]))
                        rL.append("")
                    rL.append("")
        with open(str(oFile), 'w') as ofh:
            ofh.write('\n'.join(rL))
示例#3
0
    def testGenDDLm(self):
        """Generating alternative DDLm metadata format. (starting point)"""
        try:
            myIo = IoAdapterPy(self.__verbose, self.__lfh)
            self.__containerList = myIo.readFile(
                inputFilePath=self.__pathPdbxDictionary)
            dApi = DictionaryApi(containerList=self.__containerList,
                                 consolidate=True,
                                 verbose=self.__verbose)
            parentD = dApi.getParentDictionary()
            #
            oCList = []
            dDef = DataContainer("mmcif_pdbx_ddlm_auto")
            dc = DataCategory("dictionary")
            dc.appendAttribute("title")
            dc.appendAttribute("class")
            dc.appendAttribute("version")
            dc.appendAttribute("date")
            dc.appendAttribute("ddl_conformance")
            dc.appendAttribute("text")
            dc.append([
                "mmcif_pdbx_ddlm_auto", "Instance", "latest", "2018-03-09",
                "ddlm best effort",
                "Software converted PDBx dictionary using DDLm semantics"
            ])
            dDef.append(dc)
            oCList.append(dDef)

            catIdx = dApi.getCategoryIndex()
            for catName in sorted(catIdx.keys()):
                attNameList = catIdx[catName]
                # created definition container -
                cDef = DefinitionContainer(catName)
                oCList.append(cDef)
                #
                dc = DataCategory("definition")
                dc.appendAttribute("id")
                dc.appendAttribute("scope")
                dc.appendAttribute("class")
                dc.appendAttribute("update")
                dc.append([catName, "Category", "Loop", "2018-03-09"])
                cDef.append(dc)
                val = dApi.getCategoryDescription(category=catName)
                dc = DataCategory("description")
                dc.appendAttribute("text")
                dc.append([val])
                cDef.append(dc)
                #
                dc = DataCategory("name")
                dc.appendAttribute("category_id")
                dc.appendAttribute("object_id")

                valList = dApi.getCategoryGroupList(category=catName)
                pcg = catName
                for val in valList:
                    if val != "inclusive_group":
                        pcg = val
                        break
                dc.append([catName, pcg])
                cDef.append(dc)

                valList = dApi.getCategoryKeyList(category=catName)
                if not valList:
                    self.__lfh.write("Missing caegory key for category %s\n" %
                                     catName)
                else:
                    dc = DataCategory("category")
                    dc.appendAttribute("key_id")
                    kItemName = CifName.itemName(catName, "synthetic_key")
                    dc.append([kItemName])
                    cDef.append(dc)

                    iDef = DefinitionContainer(kItemName)
                    self.__makeKeyItem(catName, "synthetic_key", valList, iDef)
                    oCList.append(iDef)

                for attName in attNameList:
                    itemName = CifName.itemName(catName, attName)
                    iDef = DefinitionContainer(itemName)

                    oCList.append(iDef)

                    #
                    dc = DataCategory("definition")
                    dc.appendAttribute("id")
                    dc.appendAttribute("scope")
                    dc.appendAttribute("class")
                    dc.appendAttribute("update")
                    dc.append([itemName, "Item", "Single", "2013-08-22"])
                    iDef.append(dc)
                    #
                    val = dApi.getDescription(category=catName,
                                              attribute=attName)
                    dc = DataCategory("description")
                    dc.appendAttribute("text")
                    dc.append([val])
                    iDef.append(dc)
                    #
                    dc = DataCategory("name")
                    dc.appendAttribute("category_id")
                    dc.appendAttribute("object_id")
                    #
                    if itemName in parentD:
                        dc.appendAttribute("linked_item_id")
                        dc.append([catName, attName, parentD[itemName][0]])
                    else:
                        dc.append([catName, attName])
                    iDef.append(dc)
                    #
                    #
                    aliasList = dApi.getItemAliasList(category=catName,
                                                      attribute=attName)
                    if aliasList:
                        dc = DataCategory("alias")
                        dc.appendAttribute("definition_id")
                        for alias in aliasList:
                            dc.append([alias[0]])
                        iDef.append(dc)

                    enList = dApi.getEnumListAltWithDetail(category=catName,
                                                           attribute=attName)

                    tC = dApi.getTypeCode(category=catName, attribute=attName)
                    tcontainer = "Single"
                    purpose = "Describe"
                    source = "Recorded"
                    contents = "Text"
                    #
                    if tC is None:
                        self.__lfh.write("Missing data type attribute %s\n" %
                                         attName)
                    elif tC in [
                            "code", "atcode", "name", "idname", "symop", "fax",
                            "phone", "email", "code30", "ec-type"
                    ]:
                        purpose = "Encode"
                        contents = "Text"
                        source = "Assigned"
                    elif tC in ["ucode"]:
                        purpose = "Encode"
                        contents = "Code"
                        source = "Assigned"
                    elif tC in ["line", "uline", "text"]:
                        purpose = "Describe"
                        source = "Recorded"
                        contents = "Text"
                    elif tC in ["int"]:
                        purpose = "Number"
                        source = "Recorded"
                        contents = "Integer"
                    elif tC in ["int-range"]:
                        purpose = "Number"
                        source = "Recorded"
                        contents = "Range"
                    elif tC in ["float"]:
                        purpose = "Measurand"
                        source = "Recorded"
                        contents = "Real"
                    elif tC in ["float-range"]:
                        purpose = "Measurand"
                        source = "Recorded"
                        contents = "Range"
                    elif tC.startswith("yyyy"):
                        source = "Assigned"
                        contents = "Date"
                        purpose = "Describe"

                    if enList:
                        purpose = "State"

                    dc = DataCategory("type")
                    dc.appendAttribute("purpose")
                    dc.appendAttribute("source")
                    dc.appendAttribute("contents")
                    dc.appendAttribute("container")
                    dc.append([purpose, source, contents, tcontainer])
                    iDef.append(dc)
                    #
                    if enList:
                        dc = DataCategory("enumeration_set")
                        dc.appendAttribute("state")
                        dc.appendAttribute("detail")
                        for en in enList:
                            dc.append([en[0], en[1]])
                        iDef.append(dc)

                    dfv = dApi.getDefaultValue(category=catName,
                                               attribute=attName)
                    bvList = dApi.getBoundaryList(category=catName,
                                                  attribute=attName)
                    if ((dfv is not None) and
                        (dfv not in ["?", "."])) or bvList:
                        row = []
                        dc = DataCategory("enumeration")
                        if dfv is not None:
                            dc.appendAttribute("default")
                            row.append(dfv)
                        if bvList:
                            dc.appendAttribute("range")
                            mminVp = -1000000
                            mmaxVp = 10000000
                            mminV = mmaxVp
                            mmaxV = mminVp
                            for bv in bvList:
                                minV = float(bv[0]) if bv[0] != "." else mminVp
                                maxV = float(bv[1]) if bv[1] != "." else mmaxVp
                                mminV = min(mminV, minV)
                                mmaxV = max(mmaxV, maxV)
                            if mminV == mminVp:
                                mminV = ""
                            if mmaxV == mmaxVp:
                                mmaxV = ""
                            row.append(str(mminV) + ":" + str(mmaxV))

                        dc.append(row)
                        iDef.append(dc)

            myIo.writeFile(outputFilePath=os.path.join(
                HERE, "test-output", "mmcif_pdbx_ddlm_auto.dic"),
                           containerList=oCList)

        except Exception as e:
            logger.exception("Failing with %s", str(e))
            self.fail()
示例#4
0
    def __testMarkupCategoryGroup(self, oFile, groupSelectList=None):
        """Test case -  extract the content to be rendered -"""
        startTime = time.time()
        logger.debug("\nStarting at %s\n",
                     time.strftime("%Y %m %d %H:%M:%S", time.localtime()))
        try:
            rL = []

            myIo = IoAdapter()
            containerList = myIo.readFile(self.__pathPdbxV50Dictionary)
            dApi = DictionaryApi(containerList=containerList,
                                 consolidate=True,
                                 verbose=self.__verbose)
            #
            groupList = dApi.getCategoryGroups()
            logger.debug("groupList %s\n", groupList)
            for groupName in groupList:
                if groupSelectList and groupName not in groupSelectList:
                    continue

                #
                # Goup header details
                #
                rL.append("# Category Group %s" % groupName)
                rL.append("")
                rL.append("")
                rL.append("%s" % dApi.getCategoryGroupDescription(groupName))
                rL.append("")
                rL.append("---")
                rL.append("")
                catNameList = dApi.getCategoryGroupCategories(
                    groupName=groupName)
                #
                cList = self.__sortIgnoreCase(catNameList)
                for catName in cList:
                    logger.debug("Group %s category %s\n", groupName, catName)
                    catDescription = dApi.getCategoryDescription(
                        category=catName)
                    catExTupList = dApi.getCategoryExampleList(
                        category=catName)
                    keyItemNameList = dApi.getCategoryKeyList(category=catName)
                    keyAttNameList = [
                        CifName.attributePart(k) for k in keyItemNameList
                    ]
                    #
                    # Category header details
                    #
                    rL.append("## Category %s" % catName)
                    rL.append("")
                    rL.append("")
                    rL.append(" %s" % catDescription)
                    rL.append("")
                    rL.append("---")
                    rL.append("")
                    if catExTupList:
                        rL.extend(
                            self.__formatTupListInset(catExTupList,
                                                      tab="     "))
                        #
                        # summary table
                        #
                    rL.append("")
                    rL.append("---")
                    rL.append("")
                    rL.append(
                        "| Attribute | Key | Required | Type | Units | Enumerated | Bounded |"
                    )
                    rL.append(
                        "| --------- | --- | -------- | ---- | ----- | ---------- | ------- |"
                    )
                    aList = self.__sortIgnoreCase(
                        dApi.getAttributeNameList(category=catName))
                    for attName in aList:
                        isKey = attName in keyAttNameList
                        attDescription = dApi.getDescription(category=catName,
                                                             attribute=attName)
                        attUnits = dApi.getUnits(category=catName,
                                                 attribute=attName)
                        attMandatory = dApi.getMandatoryCode(category=catName,
                                                             attribute=attName)
                        attTypeCode = dApi.getTypeCode(category=catName,
                                                       attribute=attName)

                        enumTupList = dApi.getEnumListWithDetail(
                            category=catName, attribute=attName)
                        if enumTupList:
                            isEnum = True
                        else:
                            isEnum = False
                        bL = dApi.getBoundaryList(category=catName,
                                                  attribute=attName)
                        if bL:
                            isBounded = True
                        else:
                            isBounded = False
                        rL.append("| %s | %s | %s | %s | %s | %s | %s |" %
                                  (attName, self.__trB(isKey), attMandatory,
                                   attTypeCode, attUnits, self.__trB(isEnum),
                                   self.__trB(isBounded)))
                    #
                    rL.append("")
                    rL.append("---")
                    rL.append("")
                    #
                    for attName in aList:
                        isKey = attName in keyAttNameList
                        attMandatory = dApi.getMandatoryCode(category=catName,
                                                             attribute=attName)
                        #
                        tN = "_" + catName + "." + attName
                        if isKey:
                            tN = tN + " (key)"
                        elif attMandatory.upper() in ["YES", "Y"]:
                            tN = tN + " (required)"
                        #
                        rL.append("#### %s\n" % tN)
                        rL.append("")
                        attDescription = dApi.getDescription(category=catName,
                                                             attribute=attName)
                        rL.append(" %s\n" % attDescription)
                        rL.append("")
                        attUnits = dApi.getUnits(category=catName,
                                                 attribute=attName)
                        attTypeCode = dApi.getTypeCode(category=catName,
                                                       attribute=attName)

                        enumTupList = dApi.getEnumListWithDetail(
                            category=catName, attribute=attName)
                        if enumTupList:
                            rL.append("")
                            rL.append("---")
                            rL.append("")
                            rL.append("| Allowed Values | Detail |")
                            rL.append("| -------------- | ------ |")
                            for tup in enumTupList:
                                if tup[1]:
                                    rL.append("| %s | %s |" % (tup[0], tup[1]))
                                else:
                                    rL.append("| %s | %s |" % (tup[0], " "))
                            rL.append("")

                        #
                        bL = dApi.getBoundaryList(category=catName,
                                                  attribute=attName)
                        btL = self.__processbounds(bL)
                        if btL:
                            tup = btL[0]
                            rL.append("")
                            rL.append("---")
                            rL.append("")
                            rL.append("| %s | %s |" % (tup[0], tup[1]))
                            #
                            rL.append("| ------------- | ------ |")
                            for tup in btL[1:]:
                                rL.append("| %s | %s |" % (tup[0], tup[1]))
                            rL.append("")
                        rL.append("")
            with open(oFile, "w") as ofh:
                ofh.write("\n".join(rL))

        except Exception as e:
            logger.exception("Failing with %s", str(e))
            self.fail()

        endTime = time.time()
        logger.debug("\nCompleted at %s (%.2f seconds)",
                     time.strftime("%Y %m %d %H:%M:%S", time.localtime()),
                     endTime - startTime)