-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicd11to10_crawler.js
56 lines (41 loc) · 1.34 KB
/
icd11to10_crawler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var wait = 2000;
var limit = 10000;
function getTriple(counter) {
var triple = "";
if (document.getElementsByClassName("icd10code")[0] != null && document.getElementsByClassName("idclass").item(0) != null) {
var uri = document.getElementsByClassName("idclass").item(0).innerHTML;
uri = "<" + uri.split(": ")[1].replace(/\s/g, '') + ">";
var icd10 = document.getElementsByClassName("icd10code")[0].childNodes[1].innerHTML;
icd10 = "\"" + icd10.split(" : ")[1].replace(/\s/g, '') + "\"";
triple = uri + " <http://dbpedia.org/ontology/icd11> " + icd10 + ".\n";
console.log(triple);
icd11to10mapping += triple;
}
if (counter == limit) {
console.log("---------------------");
console.log(icd11to10mapping);
console.log("---------------------");
}
}
function f(counter) {
if (counter <= limit) {
try {
// bekomme den Pfeil
var x = document.getElementById("ygtvt" + counter);
//bekomme das Label
var element = x.nextSibling.firstChild.nextSibling
// console.log("ygtvlabel: " + counter);
// öffne den Baum
x.click();
// lade die Seite
element.click();
window.setTimeout(function() {getTriple(counter); }, wait);
} catch (err) {
console.log("X");
}
window.setTimeout(function() { f(counter + 1)}, wait);
} else {
}
}
var icd11to10mapping = "";
f(2);