-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gnanakeethan Balasubramaniam <[email protected]>
- Loading branch information
0 parents
commit 9291878
Showing
42 changed files
with
57,730 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# EditorConfig is awesome: http:https://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_size = 2 | ||
indent_style = space | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.DS_Store | ||
build | ||
.idea | ||
tsconfig.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Green Software Foundation | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# if-model-template | ||
|
||
`If-model-template` is an environmental impact calculator template which exposes an API for [IEF](https://github.com/Green-Software-Foundation/ief) to retrieve energy and embodied carbon estimates. | ||
|
||
## Implementation | ||
|
||
Here can be implementation details of the model. For example which API is used, transformations and etc. | ||
|
||
## Usage | ||
|
||
To run the `<MODEL_HERE>`, model an instance of `ModelPluginInterface` must be created and its `configure()` method called. Then, the model's `execute()` method can be called, passing required arguments to it. | ||
|
||
This is how you could run the model in Typescript: | ||
|
||
```typescript | ||
async function runModel() { | ||
const newModel = await new Model().configure(params); | ||
const usage = await newModel.calculate([ | ||
{ | ||
timestamp: '2021-01-01T00:00:00Z', | ||
duration: '15s', | ||
'cpu-util': 34, | ||
}, | ||
{ | ||
timestamp: '2021-01-01T00:00:15Z', | ||
duration: '15s', | ||
'cpu-util': 12, | ||
}, | ||
]); | ||
|
||
console.log(usage); | ||
} | ||
|
||
runBoavizta(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
transformIgnorePatterns: [`/node_modules/.*`], | ||
transform: { | ||
'^.+\\.ts?$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: 'tsconfig.test.json', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "if-models", | ||
"description": "Impact Framework Standard Models", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Green Software Foundation", | ||
"email": "[email protected]" | ||
}, | ||
"dependencies": { | ||
"@azure/arm-monitor": "^7.0.0", | ||
"@cloud-carbon-footprint/aws": "^0.15.0", | ||
"axios": "^1.6.0", | ||
"dayjs": "^1.11.10", | ||
"js-yaml": "^4.1.0", | ||
"typescript": "^5.1.6", | ||
"typescript-cubic-spline": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.22.10", | ||
"@babel/preset-typescript": "^7.22.5", | ||
"@jest/globals": "^29.6.1", | ||
"@types/jest": "^29.5.7", | ||
"@types/js-yaml": "^4.0.8", | ||
"@types/node": "^20.4.5", | ||
"gts": "^5.0.0", | ||
"jest": "^29.6.1", | ||
"jest-mock-axios": "^4.7.2", | ||
"ts-jest": "^29.1.1" | ||
}, | ||
"engines": { | ||
"node": "18", | ||
"yarn": "1.22.19", | ||
"npm": "8.19.2" | ||
}, | ||
"keywords": [], | ||
"main": "build/index.js", | ||
"files": [ | ||
"build" | ||
], | ||
"repository": { | ||
"url": "https://github.com/Green-Software-Foundation/if-model-template.git" | ||
}, | ||
"scripts": { | ||
"fix": "gts fix", | ||
"lint": "gts lint", | ||
"prepare": "npm run build", | ||
"build": "tsc", | ||
"test": "jest --verbose" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
{ | ||
"0-Global": "WOR", | ||
"1-Europe": "EEE", | ||
"Albania": "ALB", | ||
"Algeria": "DZA", | ||
"Angola": "AGO", | ||
"Argentina": "ARG", | ||
"Armenia": "ARM", | ||
"Australia": "AUS", | ||
"Austria": "AUT", | ||
"Azerbaijan": "AZE", | ||
"Bahrain": "BHR", | ||
"Bangladesh": "BGD", | ||
"Belarus": "BLR", | ||
"Belgium": "BEL", | ||
"Benin": "BEN", | ||
"Bolivia": "BOL", | ||
"Bosnia and Herzegovina": "BIH", | ||
"Botswana": "BWA", | ||
"Brazil": "BRA", | ||
"Brunei": "BRN", | ||
"Bulgaria": "BGR", | ||
"Cambodia": "KHM", | ||
"Cameroon": "CMR", | ||
"Canada": "CAN", | ||
"Chile": "CHL", | ||
"China": "CHN", | ||
"Colombia": "COL", | ||
"Congo": "COG", | ||
"Costa Rica": "CRI", | ||
"Croatia": "HRV", | ||
"Cuba": "CUB", | ||
"Cyprus": "CYP", | ||
"Czech Republic": "CZE", | ||
"Denmark": "DNK", | ||
"Dominican Republic": "DOM", | ||
"DR Congo": "COD", | ||
"Ecuador": "ECU", | ||
"Egypt": "EGY", | ||
"El Salvador": "SLV", | ||
"Eritrea": "ERI", | ||
"Estonia": "EST", | ||
"Ethiopia": "ETH", | ||
"Finland": "FIN", | ||
"France": "FRA", | ||
"Gabon": "GAB", | ||
"Georgia": "GEO", | ||
"Germany": "DEU", | ||
"Ghana": "GHA", | ||
"Greece": "GRC", | ||
"Guatemala": "GTM", | ||
"Haiti": "HTI", | ||
"Honduras": "HND", | ||
"Hungary": "HUN", | ||
"Iceland": "ISL", | ||
"India": "IND", | ||
"Indonesia": "IDN", | ||
"Iran": "IRN", | ||
"Iraq": "IRQ", | ||
"Ireland": "IRL", | ||
"Israel": "ISR", | ||
"Italy": "ITA", | ||
"Ivory Coast": "CIV", | ||
"Jamaica": "JAM", | ||
"Japan": "JPN", | ||
"Jordan": "JOR", | ||
"Kazakhstan": "KAZ", | ||
"Kenya": "KEN", | ||
"Kuwait": "KWT", | ||
"Kyrgyzstan": "KGZ", | ||
"Latvia": "LVA", | ||
"Lebanon": "LBN", | ||
"Libyan Arab Jamahiriya": "LBY", | ||
"Lithuania": "LTU", | ||
"Luxembourg": "LUX", | ||
"Malaysia": "MYS", | ||
"Malta": "MLT", | ||
"Mexico": "MEX", | ||
"Moldova": "MDA", | ||
"Mongolia": "MNG", | ||
"Morocco": "MAR", | ||
"Mozambique": "MOZ", | ||
"Myanmar": "MMR", | ||
"Namibia": "NAM", | ||
"Nepal": "NPL", | ||
"Netherlands": "NLD", | ||
"New Zealand": "NZL", | ||
"Nicaragua": "NIC", | ||
"Nigeria": "NGA", | ||
"North Korea": "PRK", | ||
"North Macedonia": "MKD", | ||
"Norway": "NOR", | ||
"Oman": "OMN", | ||
"Pakistan": "PAK", | ||
"Panama": "PAN", | ||
"Paraguay": "PRY", | ||
"Peru": "PER", | ||
"Philippines": "PHL", | ||
"Poland": "POL", | ||
"Portugal": "PRT", | ||
"Qatar": "QAT", | ||
"Romania": "ROU", | ||
"Russian Federation": "RUS", | ||
"Saudi Arabia": "SAU", | ||
"Senegal": "SEN", | ||
"Serbia": "SCG", | ||
"Singapore": "SGP", | ||
"Slovakia": "SVK", | ||
"Slovenia": "SVN", | ||
"South Africa": "ZAF", | ||
"South Korea": "KOR", | ||
"Spain": "ESP", | ||
"Sri Lanka": "LKA", | ||
"Sudan": "SDN", | ||
"Sweden": "SWE", | ||
"Switzerland": "CHE", | ||
"Syrian Arab Republic": "SYR", | ||
"Taiwan": "TWN", | ||
"Tajikistan": "TJK", | ||
"Tanzania": "TZA", | ||
"Thailand": "THA", | ||
"Togo": "TGO", | ||
"Trinidad and Tobago": "TTO", | ||
"Tunisia": "TUN", | ||
"Turkey": "TUR", | ||
"Turkmenistan": "TKM", | ||
"Ukraine": "UKR", | ||
"United Arab Emirates": "ARE", | ||
"United Kingdom": "GBR", | ||
"United States of America": "USA", | ||
"Uruguay": "URY", | ||
"Uzbekistan": "UZB", | ||
"Venezuela": "VEN", | ||
"Vietnam": "VNM", | ||
"Yemen": "YEM", | ||
"Zambia": "ZMB", | ||
"Zimbabwe": "ZWE" | ||
} |
Oops, something went wrong.