Skip to content

Commit

Permalink
start implementing SWP describer RDF export, part of #53
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradHoeffner committed Apr 25, 2024
1 parent 0977b82 commit ac83285
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion jobadbuilder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h2>Want to hire a Health IT professional? Create a job profile that fits.</h2>
<input name="pid" type="hidden" value="{rdfs:label}" />

<label>Position / Job title</label>
<input name="rdfs:label" type="literal" datatype="xsd:string" id="jobtitle" required />
<input name="rdfs:label" type="literal" datatype="xsd:string" id="title" required />

<p><legend>Competence in...</legend></p>
<div id="competenceContainer"></div>
Expand Down
13 changes: 13 additions & 0 deletions jobadbuilder/js/export.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { COMPETENCE_AREAS } from "./competence.js";

export function rdfExport() {
let s = "";
for (let a of Object.values(COMPETENCE_AREAS)) {
s += a.property + "\n";
}
console.log(s);
const REPO = "https://github.com/hitontology/ontology";
const title = `Add new Software Product '${document.getElementById("title").value}'`;
let encodedBody = encodeURIComponent(s);
window.open(`${REPO}/issues/new?title=${encodeURIComponent(title)}&body=${encodedBody}`);
}
7 changes: 4 additions & 3 deletions jobadbuilder/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const classes = {
},
};

function copy() {
export function copy() {
const text = document.getElementById("text");
text.select();
text.setSelectionRange(0, 99999);
Expand Down Expand Up @@ -134,13 +134,14 @@ async function rowEles(area, useLevels) {
input.value = 0;
});
}
const title = document.getElementById("jobtitle");
const title = document.getElementById("title");
title.addEventListener("change", (event) => {
const newtitle = title.value;
if (newtitle == "") return;
const oldad = text.value;
text.value = newtitle + "\n" + oldad;
title.value = "";
//title.value = "";
return false; // don't clear title field
});
return [label, input, levelInput, addButton];
}
Expand Down
12 changes: 8 additions & 4 deletions jobadbuilder/swp.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@
<h1>HITO Software Product Describer</h1>
<h2>Systematically describe a Health IT software product.</h2>

<form base="http://hitontology.eu/ontology/" id="competenceForm">
<form base="http://hitontology.eu/ontology/" id="competenceForm" onSubmit="return false;">
<input name="pid" type="hidden" value="{rdfs:label}" />

<label>Software Product Name</label>
<input name="rdfs:label" type="literal" datatype="xsd:string" id="jobtitle" required />
<input name="rdfs:label" type="literal" datatype="xsd:string" id="title" required />

<p><legend>Property...</legend></p>
<div id="competenceContainer"></div>
</form>
<textarea id="text"></textarea>
<button onclick="copy()">Copy</button>
<button id="copy">Copy</button>
<button id="rdfexport">Add this software product to HITO</button>
</div>

<script type="module">
import { describeSoftware } from "./js/main.js";
import { describeSoftware, copy } from "./js/main.js";
import { rdfExport } from "./js/export.js";
describeSoftware();
document.getElementById("copy").addEventListener("click", copy);
document.getElementById("rdfexport").addEventListener("click", rdfExport);
</script>
</body>
</html>

0 comments on commit ac83285

Please sign in to comment.