Skip to content

Commit e8783f2

Browse files
authored
Add anchored CreditClassInfo datasets along with proposed updates (#35)
* add anchored datasets (v0) * add anchored datasets (v0 & v1) * drop v0 * rename to v0 * updates to BT01 * updates to C01 * use xxx for properties that warrent discussion * update xxx from note field * remove more inline notes * remove notes from C05 * drop comment * add csv of untracked fields * update csv * transpose table * truncate csv * update csv * create jsonld validation script, start refactoring Impact * add known fields csv * update validate script * update validate script * update validation script * add .vscode/launch.json for step debugging * add back astro launch.json * add validate output * cleanup C05 meatadata * update credit classes to incorporate missing metadata * add primary impacts and cobenefits for C01 and C03 * update C05 typeo * rm unneeded csvs * mv bufferPoolAccounts to hasBufferPoolAccounts for C05 * last updates to CreditClassInfo datasets * updates to Pauls ProjectInfo schema * fix PR bugs (incorrect url for managedUnderProgram values, missing eligible activity for C02 * rm validate_output file * update schema:url for consistent usage of marketplace URLs, and set as json-ld @id * fix typeo * typeo in Verra program URL * add start & end date slots to ProjectInfo
1 parent 606fbf9 commit e8783f2

23 files changed

+1457
-16
lines changed

.vscode/launch.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
"name": "Development server",
77
"request": "launch",
88
"type": "node-terminal"
9+
},
10+
{
11+
"name": "Python Debugger: Current File",
12+
"type": "debugpy",
13+
"request": "launch",
14+
"program": "${file}",
15+
"console": "integratedTerminal",
16+
"args": ["data/anchored/v0/classes/BT01.jsonld"],
17+
"cwd": "${workspaceFolder}/schema",
18+
"justMyCode": false
919
}
1020
]
1121
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import os
2+
import json
3+
import pandas as pd
4+
5+
# Define the folder containing the JSON-LD files
6+
folder_path = 'v0/classes' # update with your folder path
7+
8+
# Dictionary to store data where keys are file names (without extension) and values are dicts of key-value pairs
9+
data = {}
10+
11+
# Iterate over all files in the folder
12+
for filename in os.listdir(folder_path):
13+
if filename.endswith('.jsonld'):
14+
file_id = os.path.splitext(filename)[0] # Remove extension, e.g. "C01" from "C01.jsonld"
15+
file_path = os.path.join(folder_path, filename)
16+
with open(file_path, 'r', encoding='utf-8') as f:
17+
try:
18+
json_data = json.load(f)
19+
except json.JSONDecodeError as e:
20+
print(f"Error decoding JSON in file {filename}: {e}")
21+
continue
22+
23+
# Filter out key-value pairs that start with 'xxx:'
24+
filtered = {}
25+
for key, value in json_data.items():
26+
if not key.startswith("xxx:"):
27+
# # If the value is not a string, replace it with a placeholder
28+
# if isinstance(value, list):
29+
# filtered[key] = str(value)[:15]
30+
# elif isinstance(value, dict):
31+
# filtered[key] = str(value)[:15]
32+
# else:
33+
# filtered[key] = value
34+
filtered[key] = value
35+
data[file_id] = filtered
36+
37+
# Create a set of all keys found across all files
38+
all_keys = set()
39+
for file_dict in data.values():
40+
all_keys.update(file_dict.keys())
41+
42+
# Build a DataFrame where index is the keys (row names) and columns are file identifiers
43+
df = pd.DataFrame(index=sorted(all_keys))
44+
45+
for file_id, kv in data.items():
46+
# Create a Series for this file, aligning it with the DataFrame index
47+
s = pd.Series(kv)
48+
df[file_id] = s
49+
50+
# Save the DataFrame to CSV
51+
output_csv = 'known_fields.csv'
52+
df.to_csv(output_csv)
53+
54+
print(f"CSV output written to {output_csv}")
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import os
2+
import json
3+
import pandas as pd
4+
5+
# Define the folder containing the JSON-LD files
6+
folder_path = 'v0/classes' # update with your folder path
7+
8+
# Dictionary to store data where keys are file names (without extension) and values are dicts of key-value pairs
9+
data = {}
10+
11+
# Iterate over all files in the folder
12+
for filename in os.listdir(folder_path):
13+
if filename.endswith('.jsonld'):
14+
file_id = os.path.splitext(filename)[0] # Remove extension, e.g. "C01" from "C01.jsonld"
15+
file_path = os.path.join(folder_path, filename)
16+
with open(file_path, 'r', encoding='utf-8') as f:
17+
try:
18+
json_data = json.load(f)
19+
except json.JSONDecodeError as e:
20+
print(f"Error decoding JSON in file {filename}: {e}")
21+
continue
22+
23+
# Filter out key-value pairs that start with 'xxx:'
24+
filtered = {}
25+
for key, value in json_data.items():
26+
if key.startswith("xxx:"):
27+
# # If the value is not a string, replace it with a placeholder
28+
# if isinstance(value, list):
29+
# filtered[key] = str(value)[:15]
30+
# elif isinstance(value, dict):
31+
# filtered[key] = str(value)[:15]
32+
# else:
33+
# filtered[key] = value
34+
filtered[key] = value
35+
data[file_id] = filtered
36+
37+
# Create a set of all keys found across all files
38+
all_keys = set()
39+
for file_dict in data.values():
40+
all_keys.update(file_dict.keys())
41+
42+
# Build a DataFrame where index is the keys (row names) and columns are file identifiers
43+
df = pd.DataFrame(index=sorted(all_keys))
44+
45+
for file_id, kv in data.items():
46+
# Create a Series for this file, aligning it with the DataFrame index
47+
s = pd.Series(kv)
48+
df[file_id] = s
49+
50+
# Save the DataFrame to CSV
51+
output_csv = 'output.csv'
52+
df.to_csv(output_csv)
53+
54+
print(f"CSV output written to {output_csv}")

schema/data/anchored/known_fields.csv

Lines changed: 21 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"@type": "rfs:CreditClassInfo",
3+
"@context": {
4+
"rfs": "https://framework.regen.network/schema/",
5+
"rft": "https://framework.regen.network/taxonomy/",
6+
"schema": "http://schema.org/"
7+
},
8+
"schema:url": "https://app.regen.network/credit-classes/BT01",
9+
"schema:name": "Terrasos Biodiversity Unit",
10+
"schema:description": "The Biodioversity Credits protocol outlines a strategic framework for the development of projects that guarantee quantifiable gains in biodiversity, all while providing robust financial and legal assurances to secure their sustainability and enduring impact. This pioneering approach to biodiversity conservation and resource management emphasizes the selection of projects distinguished by their significant ecological value within a performance-based model. \n This protocol streamlines the process of registration, quantification, and issuance of Biodiversity Credits (VBC) for conservation projects that meet the eligibility criteria. It is designed to resonate with both individuals and organizations committed to contributing to the preservation of threatened ecosystems and biodiversity, ultimately delivering long-term sustainability and socio-economic benefits.",
11+
"rfs:hasPrimaryImpact": {
12+
"rfs:hasImpactType": "IMPROVED_BIODIVERSITY",
13+
"rfs:supportsSDG": [
14+
"SDG_15"
15+
],
16+
"schema:name": "Improved Biodiversity"
17+
},
18+
"rfs:hasCoBenefits": [
19+
{
20+
"rfs:hasImpactType": "IMPROVED_BIODIVERSITY",
21+
"rfs:supportsSDG": [
22+
"SDG_13"
23+
],
24+
"schema:name": "Climate"
25+
},
26+
{
27+
"rfs:hasImpactType": "IMPROVED_WILDLIFE_HABITAT",
28+
"schema:name": "Improved Wildlife Habitat"
29+
}
30+
],
31+
"rfs:managedUnderProgram": {
32+
"schema:url": "https://registry-program-guide.regen.network",
33+
"schema:name": "Regen Registry Program"
34+
},
35+
"rfs:hasCreditingPeriod": "P30Y",
36+
"rfs:eligibleEnvironmentTypes": [
37+
"TROPICAL_FOREST"
38+
],
39+
"rfs:eligibleActivities": [
40+
"CONSERVATION",
41+
"AFFORESTATION",
42+
"ECOSYSTEM_RESTORATION"
43+
],
44+
"rfs:hasCreditProtocol": [
45+
{
46+
"schema:url": "https://www.registry.regen.network/crediting-protocols/terrasos-biodiversity-unit",
47+
"schema:name": "Terrasos Protocol for Issuing Voluntary Biodiversity Credits",
48+
"schema:version": "V3.0"
49+
},
50+
{
51+
"schema:url": "https://www.registry.regen.network/crediting-protocols/terrasos-biodiversity-unit",
52+
"schema:name": "Terrasos Protocol for Issuing Voluntary Biodiversity Credits",
53+
"schema:version": "V4.0"
54+
}
55+
]
56+
}

0 commit comments

Comments
 (0)