Skip to content

Commit 714b7c3

Browse files
committed
2 parents 4f98ff1 + 373210f commit 714b7c3

File tree

1 file changed

+5
-63
lines changed

1 file changed

+5
-63
lines changed

table-component/src/App.vue

+5-63
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252

5353
<script>
5454
import axios from "axios";
55-
import YAML from "yamljs";
56-
import Papa from "papaparse";
5755
export default {
5856
name: "App",
5957
components: {},
@@ -107,72 +105,16 @@ export default {
107105
// }
108106
// },
109107
mounted() {
110-
const papaConf = {
111-
header: true,
112-
delimiter: "\t",
113-
skipEmptyLines: true
114-
};
115-
const startByValue = (path, obj = self, prefix = "") => {
116-
try {
117-
const properties = Array.isArray(path) ? path : path.split(".");
118-
const ret = properties.reduce((prev, curr) => {
119-
return obj.filter(e => {
120-
const values = Object.values(e)[0];
121-
const x = values.startsWith(prev) || values.startsWith(curr);
122-
return x;
123-
});
124-
});
125-
return Object.values(ret[ret.length - 1])[0].replace(prefix, "");
126-
} catch (err) {
127-
return "";
128-
}
129-
};
130108
axios
131109
.get(
132-
"https://raw.githubusercontent.com/mapping-commons/mapping-commons.github.io/main/mapping-server.yml"
110+
"https://raw.githubusercontent.com/mapping-commons/mapping-commons.github.io/refs/heads/main/data/mapping-data.json"
133111
)
134112
.then(response => {
135-
const registryList = YAML.parse(response.data);
136-
registryList.registries = registryList.registries || [];
137-
registryList.registries.forEach(registryEntry => {
138-
axios.get(registryEntry.uri).then(response => {
139-
const registry = YAML.parse(response.data);
140-
registry.mappings = registry.mappings || [];
141-
registry.mapping_set_references.forEach(mapping => {
142-
axios.get(mapping.mapping_set_id).then(response => {
143-
Papa.parse(response.data, {
144-
...papaConf,
145-
complete: tsv => {
146-
const tsvparsed = {
147-
license: startByValue(
148-
"# curie_map.# license: ",
149-
tsv.data,
150-
"# license: "
151-
),
152-
creator_id: startByValue(
153-
"# creator_id:.",
154-
tsv.data,
155-
"# creator_id: "
156-
),
157-
mapping_provider: startByValue(
158-
"# curie_map.# mapping_provider:",
159-
tsv.data,
160-
"# mapping_provider: "
161-
),
162-
mapping_set_description: startByValue(
163-
"# curie_map.# mapping_set_description:",
164-
tsv.data,
165-
"# mapping_set_description: "
166-
)
167-
};
168-
const obj = Object.assign({}, tsvparsed, mapping, registry);
169-
this.mappings.push(obj);
170-
}
171-
});
172-
});
173-
});
174-
});
113+
const registries = [];
114+
response.data.registries.forEach(registry => {
115+
registries.push(registry?.mapping_sets);
175116
});
117+
this.mappings = registries.flat();
176118
});
177119
}
178120
};

0 commit comments

Comments
 (0)