Skip to content

Commit f2dc68c

Browse files
committed
Error Fixes to Ontology Field Display
1 parent f61be72 commit f2dc68c

7 files changed

Lines changed: 75 additions & 113 deletions

File tree

data/Ontologies_forRepo.xlsx

26 Bytes
Binary file not shown.

data/source/ontologies_source.xlsx

-65 Bytes
Binary file not shown.

excel_to_json.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
"prefix_final": "Prefix",
1414
"title_final": "Title",
1515
"description_final": "Description",
16-
"cluster_final": "Is Part of Ontology Cluster",
16+
"cluster_final": "Cluster",
1717
"conforms_to_standards_final": "Conforms to Standard(s)",
1818
"primary_domain_final": "Primary Domain",
1919
"secondary_domain_final": "Secondary Domain",
2020
"reference_final": "Reference Source",
2121
"version_final": "Version",
22-
"created_final": "Created (or Issued or )",
22+
"created_final": "Created",
2323
"creator_final": "Creator",
2424
"publisher_final": "Publisher",
2525
"license_final": "License",
2626
"linked_aeco_final": "Linked-to AECO Ontologies",
2727
"linked_upper_final": "Linked-to Upper Ontologies",
28-
"linked_by_aeco_final": "Is Reused by Other AECO Ontologies",
28+
"linked_by_aeco_final": "linked-by AECO Ontologies",
2929
"serialization_final": "Has Serialization",
3030
"documentation_final": "Has Documentation",
3131
"conceptual_data_model_final": "Has Conceptual Model",

individualOntologyDetail.js

Lines changed: 62 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async function loadOntologyDetails() {
1919
}
2020

2121
const ontologies = await response.json();
22-
const ontology = ontologies.find(o => o.Name === ontologyName); // Find the ontology by name
22+
const ontology = ontologies.find(o => o.Title === ontologyName); // Find the ontology by Title
2323

2424
if (!ontology) {
2525
document.getElementById('ontology-details').innerHTML = 'Ontology not found.';
@@ -35,82 +35,66 @@ async function loadOntologyDetails() {
3535
}
3636
}
3737

38-
// Function to create and populate the ontology table
39-
// function populateOntologyTable(ontology) {
40-
// const tableBody = document.querySelector('#ontology-table tbody');
41-
// tableBody.innerHTML = '';
42-
43-
// // Populate the table with data
44-
// Object.keys(ontology).forEach(key => {
45-
// if (ontology[key] !== null) {
46-
// const row = document.createElement('tr');
47-
// row.innerHTML = `
48-
// <td>${key}</td>
49-
// <td>${ontology[key]}</td>
50-
// `;
51-
// tableBody.appendChild(row);
52-
// }
53-
// });
54-
// }
55-
5638

5739
function populateOntologyTable(ontology) {
5840

59-
// Update the page header with ontology Name and Acronym (new addition: 20250227)
41+
// Update the page header with ontology Title and Prefix (updated column names)
6042
const ontologyHeading = document.getElementById('ontology-heading');
61-
ontologyHeading.textContent = ontology.Name; // Set Name as the title
43+
ontologyHeading.textContent = ontology.Title; // Set Title as the title
6244

63-
// Check if Acronym exists and append it
64-
if (ontology.Acronym) {
65-
ontologyHeading.textContent += ` (${ontology.Acronym.toUpperCase()})`;
45+
// Check if Prefix exists and append it
46+
if (ontology.Prefix) {
47+
ontologyHeading.textContent += ` (${ontology.Prefix})`;
6648
}
6749

6850
const tableBody = document.querySelector('#ontology-table tbody');
6951
tableBody.innerHTML = ''; // Clear previous content
7052

71-
// Define the desired order of fields
53+
// Define the desired order of fields (updated to match JSON column names)
7254
const fieldOrder = [
7355
"Title",
74-
"Acronym",
75-
"Issued",
56+
"Prefix",
57+
"Created (or Issued or )",
7658
"Version",
7759
"License",
7860
"URI",
79-
"FOOPS Score",
61+
"FOOPs Score",
8062
"Description",
81-
"Conforms To Standard",
63+
"Conforms to Standard(s)",
8264
"Primary Domain",
8365
"Secondary Domain",
84-
"References",
85-
"Linked-to ontologies AECO",
86-
"Linked-by ontologies UPPER",
66+
"Reference Source",
67+
"Linked-to AECO Ontologies",
68+
"Linked-to Upper Ontologies",
8769
];
8870

8971
// Populate the table in the defined order
9072
fieldOrder.forEach((key) => {
91-
if (ontology[key] !== null && ontology[key] !== undefined) {
92-
let value = ontology[key];
93-
94-
// Capitalize specific fields
95-
if (key === "Acronym" || key === "Linked-to ontologies AECO" || key === "Linked-by ontologies UPPER") {
96-
value = String(value).toUpperCase();
97-
}
98-
73+
let value = ontology[key];
74+
75+
// Show blank for null/undefined values instead of hiding the row
76+
if (value === null || value === undefined) {
77+
value = "";
78+
}
9979

100-
const row = document.createElement('tr');
101-
row.innerHTML = `
102-
<td>${key}</td>
103-
<td>${value}</td>
104-
`;
105-
tableBody.appendChild(row);
80+
// Make URI a clickable link
81+
if (key === "URI" && value) {
82+
value = `<a href="${value}" target="_blank">${value}</a>`;
10683
}
84+
85+
const row = document.createElement('tr');
86+
row.innerHTML = `
87+
<td>${key}</td>
88+
<td>${value}</td>
89+
`;
90+
tableBody.appendChild(row);
10791
});
10892

109-
// Check if PartOfCluster is "Yes" and display ClusterName in the second box
93+
// Check if "Is Part of Ontology Cluster" exists and display ClusterName in the second box
11094
const clusterBox = document.getElementById('cluster-box');
111-
if (ontology.PartOfCluster === "Yes" && ontology.ClusterName) {
95+
if (ontology["Is Part of Ontology Cluster"]) {
11296
clusterBox.style.display = 'block'; // Make the cluster box visible
113-
clusterBox.querySelector('.cluster-name').textContent = ontology.ClusterName;
97+
clusterBox.querySelector('.cluster-name').textContent = ontology["Is Part of Ontology Cluster"];
11498
} else {
11599
clusterBox.style.display = 'none'; // Hide the cluster box if not part of a cluster
116100
}
@@ -124,33 +108,43 @@ function populateEvaluationTable(ontology) {
124108
// Define the fixed criteria and their corresponding keys in the JSON
125109
const evaluationCriteria = {
126110
"Connectivity": [
127-
{ criteria: "Linkage to upper ontologies", key: "Linkage to upper ontologies" },
128-
{ criteria: "Linkage to existing AECO ontologies", key: "Linkage to existing AECO ontologies" },
129-
{ criteria: "Linkage to meta schema ontologies", key: "Linkage to meta schema ontologies" }
111+
{ criteria: "Linkage to upper ontologies", key: "Linked-to Upper Ontologies" },
112+
{ criteria: "Linkage to existing AECO ontologies", key: "Linked-to AECO Ontologies" },
113+
{ criteria: "Linkage to meta schema ontologies", key: "Conforms to Standard(s)" }
130114
],
131115
"Accessibility": [
132-
{ criteria: "Conceptual Data model available", key: "Conceptual Data model available" },
133-
{ criteria: "Accessible as Serialization", key: "Accessible as Serialization" },
134-
{ criteria: "Accessible as a URI", key: "Accessible as a URI" }
116+
{ criteria: "Conceptual Data model available", key: "Has Conceptual Model" },
117+
{ criteria: "Accessible as Serialization", key: "Has Serialization" },
118+
{ criteria: "Accessible as a URI", key: "URI" }
135119
],
136120
"Documentation & Reuse": [
137-
{ criteria: "Clearly documented", key: "Clearly  documented" },
138-
{ criteria: "Use of annotations", key: "Use of annotations" },
139-
{ criteria: "Reused/Extended", key: "Reused/Extended by Explicit Import" }
121+
{ criteria: "Clearly documented", key: "Has Documentation" },
122+
{ criteria: "Use of annotations", key: "Has Annotations" },
123+
{ criteria: "Reused/Extended", key: "Is Reused by Other AECO Ontologies" }
140124
]
141125
};
142126

143-
// Axis score mappings
127+
// Axis score mappings (updated to match JSON column names)
144128
const axisScores = {
145-
"Connectivity": ontology["Connectivity"] || 0,
146-
"Accessibility": ontology["Accessability"] || 0,
147-
"Documentation & Reuse": ontology["Documentation & Reuse"] || 0
129+
"Connectivity": ontology["Alignment Score"] || 0,
130+
"Accessibility": ontology["Accessibility Score"] || 0,
131+
"Documentation & Reuse": ontology["Quality Score"] || 0
148132
};
149133

150134
Object.entries(evaluationCriteria).forEach(([axis, criteriaList]) => {
151135
criteriaList.forEach((item, index) => {
152-
let presence = ontology[item.key] ? ontology[item.key].trim().toLowerCase() : "no";
153-
presence = presence === "yes" ? "Yes" : "No";
136+
let value = ontology[item.key];
137+
let presence = "No";
138+
139+
// Handle different value types
140+
if (value !== null && value !== undefined) {
141+
if (typeof value === 'number') {
142+
presence = value >= 1 ? "Yes" : "No";
143+
} else if (typeof value === 'string') {
144+
const trimmed = value.trim().toLowerCase();
145+
presence = (trimmed !== "" && trimmed !== "no" && trimmed !== "n/a") ? "Yes" : "No";
146+
}
147+
}
154148

155149
const row = document.createElement("tr");
156150

@@ -185,11 +179,11 @@ function renderSpiderChart(ontology) {
185179
labels: ["Connectivity", "Accessibility", "Documentation & Reuse"],
186180
datasets: [
187181
{
188-
label: ontology.Name,
182+
label: ontology.Title,
189183
data: [
190-
ontology.Connectivity || 0,
191-
ontology.Accessability || 0,
192-
ontology["Documentation & Reuse"] || 0
184+
ontology["Alignment Score"] || 0,
185+
ontology["Accessibility Score"] || 0,
186+
ontology["Quality Score"] || 0
193187
],
194188
backgroundColor: "rgba(255, 99, 132, 0.2)",
195189
borderColor: "rgba(255, 99, 132, 1)",
@@ -210,36 +204,4 @@ function renderSpiderChart(ontology) {
210204
});
211205
}
212206

213-
// Fetch and Load Data
214-
async function loadOntologyDetails() {
215-
const urlParams = new URLSearchParams(window.location.search);
216-
const ontologyName = urlParams.get("ontology");
217-
218-
if (!ontologyName) {
219-
document.getElementById("ontology-details").innerHTML = "No ontology found.";
220-
return;
221-
}
222-
223-
try {
224-
const response = await fetch("data/Ontologies_forRepo.json");
225-
if (!response.ok) throw new Error("Failed to fetch ontology data");
226-
227-
const ontologies = await response.json();
228-
const ontology = ontologies.find(o => o.Name === ontologyName);
229-
230-
if (!ontology) {
231-
document.getElementById("ontology-details").innerHTML = "Ontology not found.";
232-
return;
233-
}
234-
235-
populateOntologyTable(ontology);
236-
populateEvaluationTable(ontology);
237-
renderSpiderChart(ontology);
238-
} catch (error) {
239-
console.error("Error fetching ontology data:", error);
240-
document.getElementById("ontology-details").innerHTML = "Error loading ontology data.";
241-
}
242-
}
243-
244207
window.onload = loadOntologyDetails;
245-

node_modules/.package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ontologyCards.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ function displayOntologies(ontologies) {
128128
card.classList.add('card');
129129

130130
const ontologyLink = document.createElement('a');
131-
ontologyLink.href = `individualOntologyDetail.html?ontology=${encodeURIComponent(ontology.Name)}`;
131+
ontologyLink.href = `individualOntologyDetail.html?ontology=${encodeURIComponent(ontology.Title)}`;
132132
ontologyLink.classList.add('card-link');
133133

134134
// Generate spider chart for the ontology
135135
const spiderChartUrl = generateSpiderChart({
136-
Connectivity: ontology.Alignment,
137-
Accessibility: ontology.Accessability,
136+
Connectivity: ontology["Alignment Score"],
137+
Accessibility: ontology["Accessability Score"],
138138
"Documentation & Reuse": ontology["Documentation & Reuse"],
139139
});
140140

@@ -151,13 +151,13 @@ function displayOntologies(ontologies) {
151151
<img src="${spiderChartUrl}" alt="Spider Chart">
152152
</div>
153153
<div class="content">
154-
<div class="name">${ontology.Name}</div>
155-
<div class="acronym">${ontology.Acronym || 'N/A'}</div>
154+
<div class="name">${ontology.Title}</div>
155+
<div class="acronym">${ontology.Prefix || 'N/A'}</div>
156156
<div class="details">
157157
<span><strong>Primary Domain:</strong> ${ontology['Primary Domain']}</span>
158158
<span><strong>Secondary Domain:</strong> ${ontology['Secondary Domain'] || 'N/A'}</span>
159-
<span><strong>FAIR Score:</strong> ${ontology['FOOPS'] || 'N/A'}</span>
160-
<span><strong>${ontology['Issued'] || 'Publication year unknown'}</strong></span>
159+
<span><strong>FAIR Score:</strong> ${ontology['FOOPS Score'] || 'N/A'}</span>
160+
<span><strong>${ontology['Created (or Issued or )'] || 'Publication year unknown'}</strong></span>
161161
</div>
162162
<div class="buttons">
163163
<button class="see-details">See Details</button>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)