diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94c3f6b8..94169cc2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: App build on: push: branches: - - "main" + - "fix-compare-page" defaults: run: @@ -46,13 +46,13 @@ jobs: - name: Get idaes extensions run: idaes get-extensions - # - name: Install correct tag of pareto - # working-directory: ../ - # run: git clone https://github.com/project-pareto/project-pareto.git && cd project-pareto && git fetch --all --tags && git checkout tags/1.0.0 -b 1.0.0 && pip install --progress-bar off . - - - name: Install correct branch of pareto + - name: Install correct tag of pareto working-directory: ../ - run: git clone https://github.com/project-pareto/project-pareto.git && cd project-pareto && pip install --progress-bar off . + run: git clone https://github.com/tarnold17/project-pareto.git && cd project-pareto && git fetch --all && git checkout generate_report_fix && pip install --progress-bar off . + + # - name: Install correct branch of pareto + # working-directory: ../ + # run: git clone https://github.com/project-pareto/project-pareto.git && cd project-pareto && pip install --progress-bar off . - name: Install build requirements working-directory: ./backend @@ -70,7 +70,7 @@ jobs: - name: Sign Windows Distribution run: | - AzureSignTool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v electron/dist/ParetoUI-24.07.10-win64.exe + AzureSignTool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v electron/dist/ParetoUI-24.07.15-win64.exe - name: Upload artifact for windows build uses: actions/upload-artifact@v4 @@ -78,4 +78,4 @@ jobs: with: name: windows-pareto-dist path: | - electron/dist/ParetoUI-24.07.10-win64.exe \ No newline at end of file + electron/dist/ParetoUI-24.07.15-win64.exe \ No newline at end of file diff --git a/electron/package-lock.json b/electron/package-lock.json index a0dc7f87..b5936434 100644 --- a/electron/package-lock.json +++ b/electron/package-lock.json @@ -1,12 +1,12 @@ { "name": "pareto-ui", - "version": "24.07.10", + "version": "24.07.15", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pareto-ui", - "version": "24.07.10", + "version": "24.07.15", "dependencies": { "@electron/remote": "^2.0.8", "axios": "^0.27.2", diff --git a/electron/package.json b/electron/package.json index 462e55ea..e3ddc1bb 100644 --- a/electron/package.json +++ b/electron/package.json @@ -1,6 +1,6 @@ { "name": "pareto-ui", - "version": "24.07.10", + "version": "24.07.15", "author": "Michael Pesce", "private": true, "main": "build/main.js", @@ -74,10 +74,10 @@ "nsis": { "oneClick": false, "allowToChangeInstallationDirectory": true, - "artifactName": "ParetoUI-24.07.10-win64.exe" + "artifactName": "ParetoUI-24.07.15-win64.exe" }, "dmg": { - "artifactName": "ParetoUI-24.07.10-arm64.dmg" + "artifactName": "ParetoUI-24.07.15-arm64.dmg" }, "deb": { "depends": [ @@ -86,7 +86,7 @@ "liblapack3", "libblas3" ], - "artifactName": "ParetoUI-24.07.10-amd64.deb" + "artifactName": "ParetoUI-24.07.15-amd64.deb" }, "directories": { "buildResources": "assets" @@ -106,7 +106,7 @@ "win": { "target": "nsis", "icon": "build/pareto-logo.ico", - "artifactName": "ParetoUI-24.07.10-win64.exe" + "artifactName": "ParetoUI-24.07.15-win64.exe" }, "linux": { "target": "Deb", diff --git a/electron/ui/src/assets/CategoryNames.json b/electron/ui/src/assets/CategoryNames.json index 1d7db710..53c057b5 100644 --- a/electron/ui/src/assets/CategoryNames.json +++ b/electron/ui/src/assets/CategoryNames.json @@ -53,6 +53,9 @@ "SWDProxFault": "Disposal proximity to fault", "SWDProxHpOrLpWell": "Disposal Proximity to HP/LP Well", "SWDRiskFactors": "Disposal Risk Factors", + "AirEmissionCoefficients": "Air Emissions Coeficcients", + "TreatmentEmissionCoefficients": "Treatment Emission Coefficients", + "DesalinationSurrogate": "Desalination Surrogate", "PNA":"PNA", "CNA":"CNA", "CCA":"CCA", diff --git a/electron/ui/src/assets/ParetoDictionary.json b/electron/ui/src/assets/ParetoDictionary.json index 82e5ece2..7baa10d6 100644 --- a/electron/ui/src/assets/ParetoDictionary.json +++ b/electron/ui/src/assets/ParetoDictionary.json @@ -132,5 +132,8 @@ "SWDProxEQ": "Proximity to earthquakes >= 3.0 magnitude", "SWDProxFault": "Disposal proximity to Fault", "SWDProxHpOrLpWell": "Disposal proximity to high pressure or low pressure injection well", - "SWDRiskFactors": "Disposal Risk Factors" + "SWDRiskFactors": "Disposal Risk Factors", + "AirEmissionCoefficients": "Air Emissions Coeficcients", + "TreatmentEmissionCoefficients": "Treatment Emission Coefficients", + "DesalinationSurrogate": "Desalination Surrogate" } \ No newline at end of file diff --git a/electron/ui/src/assets/Subcategories.json b/electron/ui/src/assets/Subcategories.json index bfb202b2..8ca486e5 100644 --- a/electron/ui/src/assets/Subcategories.json +++ b/electron/ui/src/assets/Subcategories.json @@ -11,7 +11,8 @@ "Economics","PadWaterQuality","StorageInitialWaterQuality","PadStorageInitialWaterQuality","DisposalOperatingCapacity", "RemovalEfficiency", "ReuseCapacity", "ReuseMinimum", "BeneficialReuseCost", "BeneficialReuseCredit", "TreatmentExpansionLeadTime", "DisposalExpansionLeadTime", "StorageExpansionLeadTime", "PipelineExpansionLeadTime_Dist", "PipelineExpansionLeadTime_Capac", "ExternalWaterQuality", "SWDDeep", - "SWDAveragePressure", "SWDProxPAWell", "SWDProxInactiveWell", "SWDProxEQ", "SWDProxFault", "SWDProxHpOrLpWell", "SWDRiskFactors" + "SWDAveragePressure", "SWDProxPAWell", "SWDProxInactiveWell", "SWDProxEQ", "SWDProxFault", "SWDProxHpOrLpWell", "SWDRiskFactors", + "AirEmissionCoefficients", "TreatmentEmissionCoefficients", "DesalinationSurrogate" ], "Static": [ "PNA", "CNA", "CCA", "NNA", "NCA", "NKA", "NRA", "NSA", "FCA", "RCA", "RNA", "RSA", diff --git a/electron/ui/src/components/OverrideTable/OverrideTableRows.js b/electron/ui/src/components/OverrideTable/OverrideTableRows.js index 85c1333e..910502f9 100644 --- a/electron/ui/src/components/OverrideTable/OverrideTableRows.js +++ b/electron/ui/src/components/OverrideTable/OverrideTableRows.js @@ -137,6 +137,7 @@ function BinaryVariableRow(props) { const [ rowName, setRowName ] = useState("") const [ presetValues, setPresetValues ] = useState({}) const [ technology, setTechnology ] = useState(null) + const [ disposalLocation, setDisposalLocation ] = useState(null) const [ uniqueIndex, setUniqueIndex ] = useState('') useEffect(() => { @@ -145,9 +146,11 @@ function BinaryVariableRow(props) { */ let tempDisplayValue = [...value] setDisplayValue(tempDisplayValue) - + // console.log(value) try { let preset_value_table = scenario.data_input.df_parameters[INFRASTRUCTURE_CAPEX_MAPPING[tempDisplayValue[0]].input_table] + // console.log("preset_value_table") + // console.log(preset_value_table) let preset_values = {} if(tempDisplayValue[0] === "Treatment Facility") { // check for technology in override values. if found, use that. else, use the value from scenario @@ -171,11 +174,29 @@ function BinaryVariableRow(props) { } } setTechnology(tempTechnology) + } else if(tempDisplayValue[0] === "Disposal Facility") { + let disposalKey = "SWDSites" + let disposalOptions = scenario.data_input.df_parameters[INFRASTRUCTURE_CAPEX_MAPPING[tempDisplayValue[0]].input_table][disposalKey] + let len = disposalOptions.length + for (let i = 0; i < len; i++) { + let each = disposalOptions[i] + preset_values[each] = {} + for (let row of Object.keys(preset_value_table)) { + if (row !== disposalKey) { + preset_values[each][row] = preset_value_table[row][i] + } + } + } + + let disposalLocation = tempDisplayValue[1] + setDisposalLocation(disposalLocation) } else { // this is janky but not sure how else to standardize reading the data from these different tables for (let key of Object.keys(preset_value_table)) { if(key !== "VALUE") { + // console.log("preset_value_table") + // console.log(preset_value_table) let leng = preset_value_table[key].length for(let i = 0; i < leng; i++) { preset_values[preset_value_table[key][i]] = preset_value_table.VALUE[i] @@ -219,13 +240,11 @@ function BinaryVariableRow(props) { let number_value if (displayValue[0] === "Treatment Facility") { number_value = presetValues[technology][event.target.value] + } else if (displayValue[0] === "Disposal Facility") { + number_value = presetValues[disposalLocation][event.target.value] } else { number_value = presetValues[event.target.value] - } - // console.log("number_value") - // console.log(number_value) - // if(number_value === 0) handleInputOverrideValue(event, true) - // else handleInputOverrideValue(event, false) + } handleInputOverrideValue(event, number_value) } @@ -257,6 +276,13 @@ function BinaryVariableRow(props) { )) : + value[0] === "Disposal Facility" ? + Object.entries(presetValues[disposalLocation]).map(([key,value]) => ( + + {value} + + )) + : Object.entries(presetValues).map(([key,value]) => ( {value} diff --git a/electron/ui/src/views/LandingPage/LandingPage.js b/electron/ui/src/views/LandingPage/LandingPage.js index f45430cf..073d6e83 100644 --- a/electron/ui/src/views/LandingPage/LandingPage.js +++ b/electron/ui/src/views/LandingPage/LandingPage.js @@ -58,7 +58,7 @@ export default function LandingPage(props) { -

v24.07.10 (PARETO v{process.env.REACT_APP_PARETO_VERSION})

+

v24.07.15 (PARETO v{process.env.REACT_APP_PARETO_VERSION})

diff --git a/electron/ui/src/views/ModelResults/ModelResults.js b/electron/ui/src/views/ModelResults/ModelResults.js index 8fd70bbd..25aa4bf7 100644 --- a/electron/ui/src/views/ModelResults/ModelResults.js +++ b/electron/ui/src/views/ModelResults/ModelResults.js @@ -127,7 +127,8 @@ export default function ModelResults(props) { setTerminationCondition('bad') } } - + // console.log("current scenario:") + // console.log(props.scenario) }, [props.category, props.scenario, props.scenario.results.status, props.scenario.data_input.df_parameters, props.scenario.results.data]); diff --git a/electron/ui/src/views/ScenarioCompare/ScenarioCompareOutput.js b/electron/ui/src/views/ScenarioCompare/ScenarioCompareOutput.js index 6e35a21b..fe7d4389 100644 --- a/electron/ui/src/views/ScenarioCompare/ScenarioCompareOutput.js +++ b/electron/ui/src/views/ScenarioCompare/ScenarioCompareOutput.js @@ -137,53 +137,77 @@ export default function ScenarioCompareOutput(props) { } const getStyle = (key) => { - if (key === "totalCapex") { - if (totalCapex[0] > totalCapex[1]) return {color:"green"} - else if (totalCapex[0] < totalCapex[1]) return {color:"red"} - else if (totalCapex[0] === totalCapex[1]) return {color:"#989698"} - } else if (key === "totalOpex") { - if (totalOpex[0] > totalOpex[1]) return {color:"green"} - else if (totalOpex[0] < totalOpex[1]) return {color:"red"} - else if (totalOpex[0] === totalOpex[1]) return {color:"#989698"} - } - else { - let tempStyle = {...styles.kpiTitle} - let diff = kpiDataPrimary[key].value - kpiDataReference[key].value - if (diff > 0) tempStyle.color = "green" - else if(diff < 0) tempStyle.color = "red" - else tempStyle.color = "grey" - return tempStyle + try { + if (key === "totalCapex") { + if (totalCapex[0] > totalCapex[1]) return {color:"green"} + else if (totalCapex[0] < totalCapex[1]) return {color:"red"} + else if (totalCapex[0] === totalCapex[1]) return {color:"#989698"} + } else if (key === "totalOpex") { + if (totalOpex[0] > totalOpex[1]) return {color:"green"} + else if (totalOpex[0] < totalOpex[1]) return {color:"red"} + else if (totalOpex[0] === totalOpex[1]) return {color:"#989698"} + } + else { + let tempStyle = {...styles.kpiTitle} + let diff = kpiDataPrimary[key].value - kpiDataReference[key].value + if (diff > 0) tempStyle.color = "green" + else if(diff < 0) tempStyle.color = "red" + else tempStyle.color = "grey" + return tempStyle + } + } catch (e) { + return {...styles.kpiTitle} } + } const getValue = (key) => { - if (key === "totalCapex") { - let capexDiff = "" - if (totalCapex[0] > totalCapex[1]) capexDiff+="+" - capexDiff+=(((totalCapex[0] - totalCapex[1])/totalCapex[1])*100).toLocaleString('en-US', {maximumFractionDigits: 0}) - return capexDiff - } else if (key === "totalOpex") { - let opexDiff = "" - if (totalOpex[0] > totalOpex[1]) opexDiff+="+" - opexDiff+=(((totalOpex[0] - totalOpex[1])/totalOpex[1])*100).toLocaleString('en-US', {maximumFractionDigits: 0}) - return opexDiff - } - else { - let diff = kpiDataPrimary[key].value - kpiDataReference[key].value - let returnGuy - if (key === "reuse_CompletionsDemandKPI") returnGuy = Math.round(diff) - else returnGuy = diff.toLocaleString('en-US', {maximumFractionDigits:0}) - returnGuy = ""+returnGuy - if (diff > 0) returnGuy = "+" + returnGuy - return returnGuy + try { + if (key === "totalCapex") { + let capexDiff = "" + if (totalCapex[0] > totalCapex[1]) capexDiff+="+" + capexDiff+=(((totalCapex[0] - totalCapex[1])/totalCapex[1])*100).toLocaleString('en-US', {maximumFractionDigits: 0}) + return capexDiff + } else if (key === "totalOpex") { + let opexDiff = "" + if (totalOpex[0] > totalOpex[1]) opexDiff+="+" + opexDiff+=(((totalOpex[0] - totalOpex[1])/totalOpex[1])*100).toLocaleString('en-US', {maximumFractionDigits: 0}) + return opexDiff + } + else { + let diff = kpiDataPrimary[key].value - kpiDataReference[key].value + let returnGuy + // if (key === "e_CompletionsReusedFrac") returnGuy = Math.round(diff) + if (key === "e_CompletionsReusedFrac") returnGuy = formatPercentage(diff, 0) + else returnGuy = diff.toLocaleString('en-US', {maximumFractionDigits:0}) + returnGuy = ""+returnGuy + if (diff > 0) returnGuy = "+" + returnGuy + return returnGuy + } + } catch(e) { + return null } + } + const formatNumber = (value) => { if (value === undefined) return value else return value.toLocaleString('en-US', {maximumFractionDigits:2}) } + const formatPercentage = (num, scale) => { + console.log("formatting: "+num) + num *= 100 + if (scale > 0) { + num = num * (10 ** scale) + num = Math.round(num) + num = num / (10 ** scale) + return num + }else return Math.round(num) + + } + const handleHover = (target, table, value) => { setHoverRow(target) setHoverTable(table) @@ -361,17 +385,17 @@ export default function ScenarioCompareOutput(props) { Recycling Rate    - {getValue("reuse_CompletionsDemandKPI")}% + {getValue("e_CompletionsReusedFrac")}% - {Math.round(kpiDataPrimary.reuse_CompletionsDemandKPI.value)}% + {formatPercentage(kpiDataPrimary.e_CompletionsReusedFrac.value, 0)}% - vs {Math.round(kpiDataReference.reuse_CompletionsDemandKPI.value)}% + vs {formatPercentage(kpiDataReference.e_CompletionsReusedFrac.value, 0)}%