Generating FET input file

Started by math, June 18, 2019, 02:32:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

math

In our department I'm responsible for creating schedules for all the lectures, exercise courses, seminars, etc. Since the set of lectures as well as the teacher assignment changes from semester to semester, I'm basically starting from scratch each time I have to create a new schedule. I have to add all the (new) subjects and create hundreds of activities and constraints.

FET is working absolutely perfect, everybody is happy with the generated schedules. However, it's quite a lot of work to enter all the data. It's even more annoying since I have all the data available in databases, so I would like to start working on automatically creating a FET configuration file. My goal is some kind of tool that reads data from various data sources and finally generates a FET configuration file.

Basically, the FET configuration file only seems to be some XML file, so it shouldn't be too difficult to generate it. However, I'm not quite sure if its a good idea to develop that data export on my own. My concern is that the export will fail if the data structure of that file changes in some future version of FET.

Therefore I would like to ask if there's some kind of recommended way of generating FET configuration files. Is there perhaps some kind of API available? 

Liviu Lalescu

I am happy FET works nicely for you.

1) The file format seems to be stable for a long time now - I hope it won't be changed for a long time in the future. (I added a new constraint in FET-5.38.0, but the rest remained untouched.)

2) Even if it changes, FET will be able to read the old format. In fact, FET-5.38.0 as it is now should be able to read FET-5.v.v any version (it might even read FET-4 files or some FET-3 files, which of course are obsolete - FET-5 was released in 2007, so 12 years ago). When you open this file with FET and save it, the new file will have the new structure, and won't be recognized by old applications knowing FET old structure.

3) Volker might answer better than me. He created the import from CSV and other import/export features in his proprietary TiTiTo.

4) It should be easy for you to update your database-to-FET converter to the latest FET XML format (even if FET can open also old files).

5) Unfortunately, there is no FET API, because I have no experience in best designing this option.

Volker Dirr

I think the current csv will be also stable. There are some nice feature requests for more advanced csv files, but i fear we need to keep the current style; there are alreadys to many users that use this basic csv format. We can't change it anymore, even a "better" format is useful. So if we change the csv, will need to implement a second alternative csv file format and also keep the old one. Sadly the current csv can care only about a bit basic stuff. So if you want to add more features, you should use the offical fet xml file format.

math

It took us quite some time to start, but now we're creating FET configuration files. At this, we had a strange error where FET did not act as expected. At the end we noticed that we had a typo in some XML element. However, FET did not complain when reading the configuration file.

Would it be possible to make FET a little pickier, e.g. complaining about unknown elements in the configuration file?

Liviu Lalescu

Could you please send me an example to demonstrate this?

math

Hi Liviu!

Attached you find a very basic configuration file that has typos in its XML elements. So it's Subjectss_List instead of Subjects_List and Acctivity_Tags_List instead of Activity_Tags_List. However, FET does not complain when reading the file.

Would it be possible to make FET complain about unknown XML elements?

Liviu Lalescu

#6
Hello, math,

Please see fet-results/logs/file_open.log. It writes there the read information and the number of unrecognized fields.

We have more variants to solve your report:

1) Keep things as they are. Just read that file immediately after opening the XML data in FET.

2) In that file, add each unrecognized field and the line and column in the XML file. Read that file immediately after opening the XML data in FET.

3) Report as an XML error when reading the file. The user cannot open the file. That is why I preferred not to add here, because the user might want to add his own fields.

4) Report an XML warning after opening the file with each unrecognized field.

Please let me know what you think (I am preparing a new FET release when Qt 5.14.1 will be ready, so please try to answer soon).

math

Hi Liviu!

I cannot find that file on my system. Is is generated when opening a file or only when generating a schedule?

My vote is on option 4: there are already warning when opting fet configuration files, e.g. that the configuration file has been saved with a newer FET version. Why not adding another warning dialog? This dialog could refer to the generated file_open.log for further details.

Liviu Lalescu

Quote from: math on January 26, 2020, 05:15:43 PM
I cannot find that file on my system. Is is generated when opening a file or only when generating a schedule?

I attach my file ~/fet-results/logs/file_open.log (archived with gzip, so that the forum accepts it). If you generate by command-line you can find it in the results directory.

If you changed the location of the results directory, search in that location.

Please let me know if you still cannot find the reading file log. I want to make sure everything is OK.

Quote
My vote is on option 4: there are already warning when opting fet configuration files, e.g. that the configuration file has been saved with a newer FET version. Why not adding another warning dialog? This dialog could refer to the generated file_open.log for further details.

OK, I will try this and let you know when it's ready to test.

Unfortunately, I think I will need to postpone the release of the official, because there will appear a few new fields to translate and I will need to coordinate with the translators to have the translations complete (we have 7 languages complete in the latest snapshot).

Liviu Lalescu

Dear math,

I hope I did it.

Please get it from https://lalescu.ro/liviu/fet/download/test/ and let me know. I will also post a Snapshots post soon.

Please test with some correct files and make sure no warnings appear. Then test with wrong files.

math

Hi Liviu!

I just downloaded and compiled the snapshot and now I see a warning when opening my faulty configuration file. Excellent work, thanks a lot! :)

Liviu Lalescu

Thank you for the report! The new official version will have this fix. I hope it will be released soon.