def buildSecondaryTemplates(self): def addUnsortColumn(dataType, columnName): if WellDataConfig.wellDataSelectiveSortingEnabled: if columnName in WellDataConfig.wellDataSortableColumns[dataType]: return '' else: return 'class="unsortable"' else: return '' wellSecondaryData = self.wellDataAccessor.getWellSecondaryData() for dataType in wellSecondaryData: wikiText = '{| class="wikitable sortable" width="95%"\n' try: numberOfColumns = len(wellSecondaryData[dataType][0]) except IndexError: numberOfColumns = 0 wikiText += '!colspan="' + str(numberOfColumns) + '"|' + WellDataConfig.wellDataProperFinalTableTopics[dataType] + '\n|-\n' for column in WellDataConfig.wellDataProperColumnNames[dataType]: wikiText += '!scope="col" ' + addUnsortColumn(dataType, column) + '| '+column + '\n' for row in wellSecondaryData[dataType]: wikiText += '|-\n' for item in row: wikiText += '| ' + str(item) + '\n' wikiText += '|-\n' wikiText += '|}' templateFile = self.fileHandler.writeWikiSourceFile(FileConfig.templateFilePath, self.wellID+'_'+dataType+'_Template.txt', 'Template:'+self.wellID+'-'+dataType, wikiText) PageUploadTableUpdater.addEntry(self.wellID, templateFile)
def buildPrimaryTemplates(self): operatorPrimaryData = self.operatorDataAccessor.getOperatorPrimaryData() numberOfRows = len(operatorPrimaryData) wikiText = '{| class="wikitable" width="95%"\n' wikiText += '!colspan="2"| Operator Details \n' wikiText += '|-\n' wikiText += '| Operator Name: ' + self.operatorID + '\n' if operatorPrimaryData['OPERATOR_ADDRESS'] is not None and operatorPrimaryData['OPERATOR_CITY'] is not None and operatorPrimaryData['OPERATOR_STATE'] is not None and operatorPrimaryData['OPERATOR_ZIP'] is not None: wikiText += '| style="width: 50%; height=100%; align=center" rowspan="' + str(numberOfRows+1) + '" | {{#display_map: ' + str(operatorPrimaryData['OPERATOR_ADDRESS'])+', ' + str(operatorPrimaryData['OPERATOR_CITY'])+', ' + str(operatorPrimaryData['OPERATOR_STATE'])+', ' + str(operatorPrimaryData['OPERATOR_ZIP']) + ' | width=100% | height=100% }} \n' wikiText += '|-\n' else: wikiText += '|-\n' if operatorPrimaryData['OPERATOR_OGO'] != 'NULL': wikiText += '| ' + OperatorDataConfig.operatorDetailsDataProperColumnNames['OPERATOR_OGO'] + ': ' + operatorPrimaryData['OPERATOR_OGO'] + '\n' wikiText += '|-\n' if operatorPrimaryData['OPERATOR_ADDRESS'] != 'NULL': wikiText += '| ' + OperatorDataConfig.operatorDetailsDataProperColumnNames['OPERATOR_ADDRESS'] + ': ' + operatorPrimaryData['OPERATOR_ADDRESS'] + '\n' wikiText += '|-\n' if operatorPrimaryData['OPERATOR_CITY'] != 'NULL': wikiText += '| ' + OperatorDataConfig.operatorDetailsDataProperColumnNames['OPERATOR_CITY'] + ': ' + operatorPrimaryData['OPERATOR_CITY'] + '\n' wikiText += '|-\n' if operatorPrimaryData['OPERATOR_STATE'] != 'NULL': wikiText += '| ' + OperatorDataConfig.operatorDetailsDataProperColumnNames['OPERATOR_STATE'] + ': ' + operatorPrimaryData['OPERATOR_STATE'] + '\n' wikiText += '|-\n' if operatorPrimaryData['OPERATOR_ZIP'] != 'NULL': wikiText += '| ' + OperatorDataConfig.operatorDetailsDataProperColumnNames['OPERATOR_ZIP'] + ': ' + operatorPrimaryData['OPERATOR_ZIP'] + '\n' wikiText += '|-\n' if operatorPrimaryData['UNCONVENTIONAL'] != 'NULL': wikiText += '| ' + OperatorDataConfig.operatorDetailsDataProperColumnNames['UNCONVENTIONAL'] + ': ' + ('Yes' if operatorPrimaryData['UNCONVENTIONAL'] is 'Y' else 'No') + '\n' wikiText += '|-\n' wikiText += '|}' templateFile = self.fileHandler.writeWikiSourceFile(FileConfig.templateFilePath, self.operatorID+'_Details_Template.txt', 'Template:'+self.operatorID+'-Details', wikiText) PageUploadTableUpdater.addEntry(self.operatorID, templateFile)
def buildPrimaryTemplates(self): wellPrimaryData = self.wellDataAccessor.getWellPrimaryData() numberOfRows = len(wellPrimaryData) wikiText = '{| class="wikitable" width="95%"\n' wikiText += '!colspan="2"| Well Details \n' wikiText += '|-\n' wikiText += '| Well ID: ' + self.wellID + '\n' if wellPrimaryData['LATITUDE_DECIMAL'] is not None and wellPrimaryData['LONGITUDE_DECIMAL'] is not None: wikiText += '| style="width: 50%; height=100%; align=center" rowspan="' + str(numberOfRows+1) + '" | {{#display_map: ' + str(wellPrimaryData['LATITUDE_DECIMAL'])+', ' + str(wellPrimaryData['LONGITUDE_DECIMAL']) + ' | width=100% | height=100% }} \n' wikiText += '|-\n' else: wikiText += '|-\n' if wellPrimaryData['WELL_COUNTY'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['WELL_COUNTY'] + ': [[' + wellPrimaryData['COUNTY_FULL_NAME'] + ']]\n' wikiText += '|-\n' if wellPrimaryData['WELL_MUNICIPALITY'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['WELL_MUNICIPALITY'] + ': [[' + wellPrimaryData['MUNICIPALITY_FULL_NAME'] + ']]\n' wikiText += '|-\n' if wellPrimaryData['OPERATOR_NAME'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['OPERATOR_NAME'] + ': [[' + wellPrimaryData['OPERATOR_NAME'] + ']]\n' wikiText += '|-\n' if wellPrimaryData['OPERATOR_OGO'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['OPERATOR_OGO'] + ': [[' + wellPrimaryData['OPERATOR_OGO'] + ']]\n' wikiText += '|-\n' if wellPrimaryData['FARM_NAME'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['FARM_NAME'] + ': ' + wellPrimaryData['FARM_NAME'] + '\n' wikiText += '|-\n' if wellPrimaryData['FIRST_PERMIT_ISSUED_DATE'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['FIRST_PERMIT_ISSUED_DATE'] + ': ' + str(wellPrimaryData['FIRST_PERMIT_ISSUED_DATE']) + '\n' wikiText += '|-\n' if wellPrimaryData['LAST_PERMIT_ISSUED_DATE'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['LAST_PERMIT_ISSUED_DATE'] + ': ' + str(wellPrimaryData['LAST_PERMIT_ISSUED_DATE']) + '\n' wikiText += '|-\n' if wellPrimaryData['SPUD_DATE'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['SPUD_DATE'] + ': ' + str(wellPrimaryData['SPUD_DATE']) + '\n' wikiText += '|-\n' if wellPrimaryData['UNCONVENTIONAL'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['UNCONVENTIONAL'] + ': ' + ('Yes' if wellPrimaryData['UNCONVENTIONAL'] is 'Y' else 'No') + '\n' wikiText += '|-\n' if wellPrimaryData['HORIZONTAL_WELL'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['HORIZONTAL_WELL'] + ': ' + ('Yes' if wellPrimaryData['HORIZONTAL_WELL'] is 'Y' else 'No') + '\n' wikiText += '|-\n' if wellPrimaryData['WELL_STATUS'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['WELL_STATUS'] + ': ' + ('Yes' if wellPrimaryData['WELL_STATUS'] == 'Active' else 'No') + '\n' wikiText += '|-\n' if wellPrimaryData['VIOLATION_COUNT'] != 'NULL': wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['VIOLATION_COUNT'] + ': ' + str(wellPrimaryData['VIOLATION_COUNT']) + '\n' wikiText += '|-\n' if wellPrimaryData['LATITUDE_DECIMAL'] is not None: wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['LATITUDE_DECIMAL'] + ': ' + str(wellPrimaryData['LATITUDE_DECIMAL']) + '\n' wikiText += '|-\n' if wellPrimaryData['LONGITUDE_DECIMAL'] is not None: wikiText += '| ' + WellDataConfig.wellDetailsDataProperColumnNames['LONGITUDE_DECIMAL'] + ': ' + str(wellPrimaryData['LONGITUDE_DECIMAL']) + '\n' wikiText += '|-\n' wikiText += '|}' templateFile = self.fileHandler.writeWikiSourceFile(FileConfig.templateFilePath, self.wellID+'_Details_Template.txt', 'Template:'+self.wellID+'-Details', wikiText) PageUploadTableUpdater.addEntry(self.wellID, templateFile)
def buildMainSource(self): source = '== Operator Details ==\n' source += '{{' + self.operatorID + '-Details}}\n' source += '__TOC__\n' source += '== Operator Well Data ==\n' source += '{{' + self.operatorID + '-wells}}\n' source += '__NOEDITSECTION__\n' sourceFile = self.fileHandler.writeWikiSourceFile(FileConfig.mainSourcePath, self.operatorID+'_main.txt', self.operatorID, source) PageUploadTableUpdater.addEntry(self.operatorID, sourceFile)
def buildMainSource(self): source = '== Municipality Details ==\n' #source += '{{' + self.munID + '-Details}}\n' source += '__TOC__\n' source += '== Oil and Gas Activity ==\n' source += '{{' + self.munID + '-wells}}\n' source += '__NOEDITSECTION__\n' sourceFile = self.fileHandler.writeWikiSourceFile(FileConfig.mainSourcePath, self.munID+'_main.txt', self.munID, source) PageUploadTableUpdater.addEntry(self.munID, sourceFile)
def buildMainSource(self): source = "== County Details ==\n" # source += '{{' + self.conID + '-Details}}\n' source += "__TOC__\n" source += "== Oil and Gas Activity ==\n" source += "{{" + self.conID + "-wells}}\n" source += "__NOEDITSECTION__\n" sourceFile = self.fileHandler.writeWikiSourceFile( FileConfig.mainSourcePath, self.conID + "_main.txt", self.conID, source ) PageUploadTableUpdater.addEntry(self.conID, sourceFile)
def buildSecondaryTemplates(self): def addUnsortColumn(dataType, columnName): if CountyDataConfig.countyDataSelectiveSortingEnabled: if columnName in CountyDataConfig.countyDataSortableColumns[dataType]: return '' else: return 'class="unsortable"' else: return '' CountySecondaryData = self.CountyDataAccessor.getConSecondaryData() for dataType in CountySecondaryData: wikiText = '{| class="wikitable sortable" width="95%"\n' try: numberOfColumns = len(CountyDataConfig.conDataProperColumnNames) except IndexError: numberOfColumns = 0 wikiText += '!colspan="' + str(numberOfColumns) + '"|' + CountyDataConfig.conDataProperFinalTableTopics[dataType] + '\n|-\n' for column in CountyDataConfig.conDataProperColumnNames[dataType]: wikiText += '!scope="col" ' + addUnsortColumn(dataType, column) + '| '+column + '\n' if dataType == 'wells': for row in CountySecondaryData[dataType]: wikiText += '|-\n' wikiText += '| ' + str('[[' + row + ']]') + '\n' if CountySecondaryData[dataType][row]['WELL_MUNICIPALITY'] != 'NULL': wikiText += '| ' + str('[[' + CountySecondaryData[dataType][row]['MUNICIPALITY_FULL_NAME'] + ']]') + '\n' else: wikiText += '| ' + '\n' if CountySecondaryData[dataType][row]['OPERATOR_NAME'] != 'NULL': wikiText += '| ' + str('[[' + CountySecondaryData[dataType][row]['OPERATOR_NAME'] + ']]') + '\n' else: wikiText += '| ' + '\n' if CountySecondaryData[dataType][row]['FIRST_PERMIT_ISSUED_DATE'] != 'NULL': wikiText += '| ' + str(CountySecondaryData[dataType][row]['FIRST_PERMIT_ISSUED_DATE']) + '\n' else: wikiText += '| ' + '\n' if CountySecondaryData[dataType][row]['SPUD_DATE'] != 'NULL': wikiText += '| ' + str(CountySecondaryData[dataType][row]['SPUD_DATE']) + '\n' else: wikiText += '| ' + '\n' if CountySecondaryData[dataType][row]['UNCONVENTIONAL'] != 'NULL': wikiText += '| ' + ('Yes' if CountySecondaryData[dataType][row]['UNCONVENTIONAL'] is 'Y' else 'No') + '\n' else: wikiText += '| ' + '\n' if CountySecondaryData[dataType][row]['HORIZONTAL_WELL'] != 'NULL': wikiText += '| ' + ('Yes' if CountySecondaryData[dataType][row]['HORIZONTAL_WELL'] is 'Y' else 'No') + '\n' else: wikiText += '| ' + '\n' if CountySecondaryData[dataType][row]['WELL_STATUS'] != 'NULL': wikiText += '| ' + ('Yes' if CountySecondaryData[dataType][row]['WELL_STATUS'] is 'Y' else 'No') + '\n' else: wikiText += '| ' + '\n' if CountySecondaryData[dataType][row]['VIOLATION_COUNT'] != 'NULL': wikiText += '| ' + str(CountySecondaryData[dataType][row]['VIOLATION_COUNT']) + '\n' else: wikiText += '| ' + '\n' wikiText += '|-\n' wikiText += '|}' templateFile = self.fileHandler.writeWikiSourceFile(FileConfig.templateFilePath, self.conID+'_'+dataType+'_Template.txt', 'Template:'+self.conID+'-'+dataType, wikiText) PageUploadTableUpdater.addEntry(self.conID, templateFile)