Shell script for cvs -> xml

Started by Jac, August 27, 2009, 05:53:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jac

Hi there,
I am new to FET, so I am not firm with all FET's features, but at first glance, it looks pretty outstanding. However, adding data seems (yet) a bit complicated to me (maybe this gets better when I get used to using FET), so I had an idea on how to simplify exporting and importing:

1. Create an OpenOffice [or Excel] table, including tables for teachers, rooms and courses, like: Teachers' names. Years and Courses, including durations etc. Teachers and their associated courses. Rooms and room requirements, etc. Summing up, easy to see and to check.
2. Save each table to a specified .cvs file (e.g., teachers.cvs courses.cvs rooms.cvs)
3. Launch shell script (like, bash is what I have in mind - easy but useful. Maybe some windows expert can write similar for their OS) which reads all .cvs files and creates a (moreorless) large XML file which contains all information that needs to be added using activities.
4. Import the created XML file to FET and let the timetable generate.

Now, the most striking effort I have in mind is that this should be moreorless failsafe. In the OpenOffice tables, you can easily detect if Mrs. Johnson's wish for having Friday off is fulfilled or Mr. Miller actually is booked for having no lessons before the 3rd lesson, and you can see what courses are associated with what teacher. Export the table and let the shell script create the XML data. Import, generate plan, done.
I mean, you needn't import all data one by one (teachers, activities, rooms, etc.) to FET.

And, if you actually do detect that something is weird, you just correct the mistake in the raw data (tables), export this again to .cvs and run the shell script again and that should do.

Now, my major questions:
1. Would this actually work? If I get a working XML file to read the syntax from, creating a shell script shouldn't be a too big problem, should it?
2. Anyone around who could support a template set of tables (see above: teachers, lessons, activities, etc.)? As I am new to FET, a helping hand to check if all data is complete (like, is everything there that we need to let FET do its excellent work?) would be great!
3. Am I carrying coals to Newcastle? If something like this has already been invented and is running, please let me know where to find it 8-)

Hope to get some replies. Thanks in advance.
Gregor

PS. I just noticed this might also be put to the "Suggestions" section, so if it is placed better there than here, it should be moved there.
Sorry for the confusion.

Liviu Lalescu

#1
One remark: you cannot import constraints from csv into FET.

About the rest of questions, I am not the best person to answer. I know that there is here on the forum an .xls file to import results into Excel, but it is in Italian: http://lalescu.ro/liviu/fet/forum/index.php?topic=504.msg2960#msg2960

Of course, it is a good thing to generate a .fet file in the easiest way for you and run FET on it (you can also run the command line FET on it).

Let's wait for others' opinions.

Volker Dirr

It is easy with some basic data, but very difficult or even impossible with all data.
difficult data is for example:
-subactivitities that are modified manualy
-adding several similar constraints to the same thing. (for example if someone add a min n gaps == 5 with 100%, min n gaps == 4 with 98%, min n gaps with 3 == 95% and min n gaps == 90% to the same teacher. Things like that are pretty difficult to add by csv, because they are nearly unlimited with FET, but limited in a csv. (or do you want a single table per constraint? then it is of course also possible with csv, but it will be as confusing as the current style.)

Corfiot

I considered this when making my timetables but in practice you will find it's easier to totally bypass all this mucking about with scripts and spreadsheets.

Your work cycle would be to:
1. open old excel file
2. make changes
3. check
4. run scripts
5. import into fet
6. generate
7. parse results / find errors / goto 1

Too much work, too much to maintain.

I suggest you add everything directly into FET the first time. Then

1. open last year's FET file
2. Make changes
3. generate
4. parse results / find errors / goto 1

I keep 2 FET files for each schedule. Once it's ready to be published to teachers, I generate a schedule and that gives me a .fet file with locked activities. I call it blah_LOCKED.fet. I work on that to make changes that teachers require. Then, for the NEXT schedule (eg next year's semester 1), I open the unlocked FET file and work off that.

It works great since most constraints rarely change between years, so all I have to do is change some courses, reinput the student totals and reset the teacher not available times. All the other rules stay put.

Hope this helps, YMMV
--G