-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathparse_online_conferences.js
More file actions
154 lines (134 loc) · 4.16 KB
/
Copy pathparse_online_conferences.js
File metadata and controls
154 lines (134 loc) · 4.16 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
const axios = require('axios');
const yaml = require('js-yaml');
const { DateTime } = require('luxon');
const fs = require('fs');
const { exit } = require('process');
function parseDateWithTimezone(inputDate, timezone) {
return DateTime.fromFormat(inputDate, 'yyyy-MM-dd HH:mm:ss', { zone: timezone });
}
async function downloadYamlFile(url) {
try {
const response = await axios.get(url);
return response.data;
} catch (error) {
throw new Error(`Failed to download the file: ${error.message}`);
}
}
function parseYaml(yamlContent) {
try {
const data = yaml.load(yamlContent);
return data;
} catch (error) {
throw new Error(`Failed to parse the YAML file: ${error.message}`);
}
}
async function readJSONFile(filePath) {
try {
const data = await fs.promises.readFile(filePath, 'utf8');
const jsonObject = JSON.parse(data);
return jsonObject;
} catch (error) {
throw error;
}
}
const conferenceDenyList = [
'ICRA',
'AAMAS',
'RecSys',
'ACML',
'SIGIR-AP',
'SIGGRAPH Asia',
'CoRL',
'RO-MAN',
'AutoML-Conf',
'CoLLAs',
'UAI',
'RSS',
'IROS',
'KR',
'ICAPS',
'AISTATS',
'ACML',
'ICMI',
'ISMIR',
'ALT',
'HRI',
'COLT',
'ICCC',
'ICPR',
'3DV',
'ICME',
'ICIP',
'MIDL',
'FG',
'CHIL',
];
(async () => {
const folder = 'ccf-deadlines/conference/AI'
const files = fs.readdirSync(folder).filter((file) => file.endsWith('.yml'));
let conferenceData = [];
for (const file of files) {
const filePath = `${folder}/${file}`;
const yamlContent = fs.readFileSync(filePath, 'utf8');
data = parseYaml(yamlContent)[0];
data.confs.sort((a, b) => a.year - b.year);
data.conference = data.confs[data.confs.length - 1];
data.deadline = null;
data.abstract_deadline = null;
conferenceData.push(data);
}
const goodConferenceData = [];
for (const conference of conferenceData) {
if (conference.conference.timezone.toLowerCase() == "aoe"){
conference.conference.timezone = "UTC-12";
}
// TODO Incooperate multiple deadlines if available
last_deadline = conference.conference.timeline[conference.conference.timeline.length - 1];
// accept only conferences with a deadline in the future
const deadline = parseDateWithTimezone(last_deadline.deadline, conference.conference.timezone);
const now = DateTime.now();
if (!deadline.isValid ) {
console.log(deadline);
console.log("Invalid deadline for conference: ", conference.title);
continue;
}
if (!deadline.isValid || deadline < now) {
continue;
}
if (conferenceDenyList.includes(conference.title)) {
continue;
}
let abstract_deadline = null;
if ("abstract_deadline" in last_deadline) {
abstract_deadline = parseDateWithTimezone(last_deadline.abstract_deadline, conference.conference.timezone);
}
const manuallyAddedConferences = await readJSONFile('./conferences.json');
const alreadyManuallyAdded = manuallyAddedConferences.some((manualConference) => manualConference.shortcut.toLowerCase().includes(conference.title.toLowerCase()));
if (alreadyManuallyAdded) continue;
const conferenceObject = {
name: `${conference.title} ${conference.conference.year}`,
shortcut: conference.title,
location: conference.conference.place,
deadline: deadline.toISO(),
url: conference.conference.link,
abstractDeadline: abstract_deadline ? abstract_deadline : null,
note: "",
conferenceTime: conference.conference.date,
};
goodConferenceData.push(conferenceObject);
}
console.log("Number of good conferences: ", goodConferenceData.length);
// Convert the JSON array to a string
// The second argument (null) is a replacer function, and the third argument (4) is the number of spaces to use for indentation.
const jsonString = JSON.stringify(goodConferenceData, null, 4);
// File path
const filePath = './parsed_conferences.json';
// Write the JSON string to a file
fs.writeFile(filePath, jsonString, 'utf8', (err) => {
if (err) {
console.error('Error writing file:', err);
} else {
console.log('JSON array successfully written to file:', filePath);
}
});
})();