Public
Edited
May 25, 2023
Insert cell
Insert cell
Insert cell
url_file = "https://raw.githubusercontent.com/J535D165/recordlinkage-annotator/master/examples/annotation_dishonesty.json"
Insert cell
data_pairs = d3.json(
url_file
)
Insert cell
viewof tt1 = Inputs.table(
data_pairs["pairs"][0]["fields"].map(row => row.a),
{
columns: [
"value"
],
header: {"value": "Ligne à identifier"}
}
)
Insert cell
viewof tt2 = Inputs.table(
data_pairs["pairs"][count]["fields"].map(row => row.b),
{
columns: [
"value"
],
header: {"value": "Paire potentielle"}
}
)
Insert cell
decision_label = [
{text: "Accepter 👍️", color: "green", decision: "Accepted"},
{text: "Rejeter 👎️", color: "red", decision: "Rejected"},
null
]
Insert cell
viewof decision = (count, Inputs.radio(
decision_label,
{label: "Décision",
format: x => (x == null) ? html`<span style="border-bottom: solid 2px blue; margin-bottom: -2px;">Décision à prendre 🤔` : html`<span style="text-transform: capitalize; border-bottom: solid 2px ${x.color}; margin-bottom: -2px;">${x.text}`,
value: null
}
))
Insert cell
viewof count2 = Inputs.button([
[html`<span style="text-transform: capitalize; border-bottom: solid 2px ${"green"}; margin-bottom: -2px;">${"Accepter"}`, decision => decision],
[html`<span style="text-transform: capitalize; border-bottom: solid 2px ${"red"}; margin-bottom: -2px;">${"Rejeter"}`, value => value - 1],
[html`<span style="border-bottom: solid 2px blue; margin-bottom: -2px;">Décision à prendre 🤔`, value => 0]
], {value: 0, label: "Décision"})
Insert cell
viewof decision = (count, Inputs.radio(
decision_label,
{label: "Décision",
format: x => (x == null) ? html`<span style="border-bottom: solid 2px blue; margin-bottom: -2px;">Décision à prendre` : html`<span style="text-transform: capitalize; border-bottom: solid 2px ${x.color}; margin-bottom: -2px;">${x.text}`,
value: null
}
))
Insert cell
viewof count = Inputs.button("Nouvel exemple à annoter !")
Insert cell
Insert cell
d = Object.assign({}, data_pairs["pairs"][count]["fields"][0]);
Insert cell
{
// Assuming `count` and `data_pairs` are already defined
const newElement = { ...data_pairs["pairs"][count]["fields"][0] }; // Create a shallow copy of the original element

if (decision !== null) {
newElement.field = decision.decision; // Update the "field" property with the value of `decision.decision`
} else {
newElement.field = "no decision yet"; // Set the "field" property to "nothing" if `decision.decision` is null
}

return newElement;
}
Insert cell
resetDecision = () => {
decision.value = null;
};
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more