Skip to content

Commit

Permalink
various
Browse files Browse the repository at this point in the history
  • Loading branch information
nuuuwan committed Jul 30, 2024
1 parent 4442e7e commit 52461e8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .eslintcache

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/nonview/constants/VERSION.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Auto-generated by javascript_version.py
export const DATETIME_STR = "2024-07-30 15:45:55";
export const DATETIME_STR = "2024-07-30 16:05:44";
export const VERSION_DATETIME = new Date(DATETIME_STR);

const VERSION = { DATETIME_STR, VERSION_DATETIME };
Expand Down
16 changes: 1 addition & 15 deletions src/nonview/core/GroundTruth.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
import DictUtils from "../../nonview/base/DictUtils";
import {
ATTR_IDX_HLIYAN,
ATTR_IDX_NUUUWAN,
} from "../../nonview/core/GroundTruthRawData";
import { ATTR_IDX_NUUUWAN } from "../../nonview/core/GroundTruthRawData";

import MathX from "../../nonview/base/MathX";
const ATTR_IDX_IDX = Object({
"@nuuuwan": ATTR_IDX_NUUUWAN,
"@nuuuwan (Economic Only)": DictUtils.filterDict(ATTR_IDX_NUUUWAN, [
"Economic Experience at the National Level",
"Will work with the IMF",
]),
"@nuuuwan (Constituitional Only)": DictUtils.filterDict(ATTR_IDX_NUUUWAN, [
"Voted for the 20th Amendment",
"Will support abolishing the Executive Presidency while in seat",
"Will support bringing back the 19th Amendment",
]),
"@h_liyan": ATTR_IDX_HLIYAN,
});

export default class GroundTruth {
Expand Down
170 changes: 19 additions & 151 deletions src/nonview/core/GroundTruthRawData.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const ATTR_IDX_NUUUWAN = {
const ATTR_IDX_NUUUWAN_ALL = {
"Voted for the 20th Amendment": {
AKD: -100,
DA: 100,
Expand Down Expand Up @@ -43,7 +43,7 @@ export const ATTR_IDX_NUUUWAN = {
SF: 100,
SP: -100,
},
"Member of the SLPP": {
"Member or Former-Member of the SLPP": {
AKD: -100,
DA: 100,
HdS: -100,
Expand All @@ -54,17 +54,7 @@ export const ATTR_IDX_NUUUWAN = {
SF: -100,
SP: -100,
},
"Will Dissolve the Parliament before 2025": {
AKD: 100,
DA: -100,
HdS: 100,
MAS: 100,
MS: -100,
PCR: 100,
RW: -100,
SF: 100,
SP: 100,
},

"Will support abolishing the Executive Presidency while in seat": {
AKD: 100,
DA: -100,
Expand All @@ -76,17 +66,7 @@ export const ATTR_IDX_NUUUWAN = {
SF: -100,
SP: -100,
},
"Will support bringing back the 19th Amendment": {
AKD: 100,
DA: -100,
HdS: 100,
MAS: 100,
MS: 100,
PCR: 100,
RW: -100,
SF: -100,
SP: 100,
},

"Economic Experience at the National Level": {
AKD: -100,
DA: -100,
Expand All @@ -109,18 +89,8 @@ export const ATTR_IDX_NUUUWAN = {
SF: -100,
SP: 100,
},
"Will work with the IMF": {
AKD: -100,
DA: 100,
HdS: 100,
MAS: 100,
MS: 100,
PCR: 100,
RW: 100,
SF: 100,
SP: 100,
},
"Aged less than 60 years": {

"Under 65 years old (Born after 1959)": {
AKD: 100,
DA: -100,
HdS: 100,
Expand Down Expand Up @@ -177,119 +147,17 @@ export const ATTR_IDX_NUUUWAN = {
},
};

export const ATTR_IDX_HLIYAN = {
"Voted for 20th amendment": {
AKD: -100,
DA: 100,
HdS: -100,
MAS: -100,
MS: 0,
PCR: -100,
RW: 0,
SF: -100,
SP: -100,
},
"Cabinet member between 2019 and now": {
AKD: -100,
DA: 100,
HdS: -100,
MAS: -100,
MS: -100,
PCR: -100,
RW: 100,
SF: -100,
SP: -100,
},
"Ex-military or armed group connections": {
AKD: 100,
DA: -100,
HdS: -100,
MAS: 100,
MS: -100,
PCR: 100,
RW: -100,
SF: 100,
SP: -100,
},
const CANDIDATE_LIST = ["AKD", "MAS", "RW", "SF", "SP"];

"Known racist group connections": {
AKD: -100,
DA: 100,
HdS: -100,
MAS: -100,
MS: 100,
PCR: 100,
RW: -100,
SF: -100,
SP: -100,
},

"Crime/war crime/corruption cases": {
AKD: -100,
DA: -100,
HdS: -100,
MAS: -100,
MS: -100,
PCR: -100,
RW: 100,
SF: 100,
SP: -100,
},

"No asset declaration": {
AKD: 100,
DA: 100,
HdS: -100,
MAS: -100,
MS: 100,
PCR: 100,
RW: 100,
SF: 100,
SP: 100,
},

"Will dissolve parliament before 2025": {
AKD: 100,
DA: -100,
HdS: 100,
MAS: 100,
MS: -100,
PCR: 100,
RW: -100,
SF: 100,
SP: 100,
},
"Will support abolishing presidency while in the seat": {
AKD: 100,
DA: -100,
HdS: 100,
MAS: 100,
MS: -100,
PCR: -100,
RW: -100,
SF: -100,
SP: -100,
},
"Will support bringing back 19th amendment": {
AKD: 100,
DA: -100,
HdS: 100,
MAS: 100,
MS: 100,
PCR: 100,
RW: -100,
SF: -100,
SP: 100,
},
"Past economic experience": {
AKD: -100,
DA: -100,
HdS: 100,
MAS: -100,
MS: 100,
PCR: -100,
RW: 100,
SF: -100,
SP: -100,
},
};
export const ATTR_IDX_NUUUWAN = Object.fromEntries(
Object.entries(ATTR_IDX_NUUUWAN_ALL).map(function ([id, candidateToWeight]) {
return [
id,
Object.fromEntries(
Object.entries(candidateToWeight).filter(function ([key, _]) {
return CANDIDATE_LIST.includes(key);
})
),
];
})
);
12 changes: 9 additions & 3 deletions src/nonview/core/Weight.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
export default class Weight {
static EMOJI = {
SUITABLE: "๐Ÿ˜Š",
UNSUITABLE: "โ˜น๏ธ",
NEUTRAL: "๐Ÿ˜",
};

static getMagnitudeText(weight) {
const absWeight = Math.abs(weight);
let magnitudeText;
Expand All @@ -17,13 +23,13 @@ export default class Weight {
}
static getDirectionText(weight) {
if (weight > 0) {
return "Suitable ๐Ÿ˜Š";
return "Suitable " + Weight.EMOJI.SUITABLE;
}

if (weight < 0) {
return "Unsuitable โ˜น๏ธ";
return "Unsuitable " + Weight.EMOJI.UNSUITABLE;
}
return "๐Ÿ˜";
return Weight.EMOJI.NEUTRAL;
}

static signed(weight) {
Expand Down
6 changes: 3 additions & 3 deletions src/view/molecules/CriterionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ function CustomSlider({
const marks = [
{
value: -100,
label: "โ˜น๏ธ",
label: Weight.EMOJI.UNSUITABLE,
},
{
value: 0,
label: "๐Ÿ˜",
label: Weight.EMOJI.NEUTRAL,
},
{
value: 100,
label: "๐Ÿ˜Š",
label: Weight.EMOJI.SUITABLE,
},
];

Expand Down

0 comments on commit 52461e8

Please sign in to comment.