Which programming language for a work scheduling app
Posted by Sassy_Pig@reddit | learnprogramming | View on Reddit | 23 comments
My work currently only uses excel to make everyone's work schedules and over time schedules. Everyone sends their availability in for the month and we just kind of plop them in where they fit. This has been prone to error and is difficult to ensure everyone is getting scheduled fairly. I want to build something that would loop through the list of employees and schedule them according to their availability but also keep the OT hours as close as possible for fairness. I would still need to post an excel spreadsheet for everyone to view. I checked out the FAQ and I'm still not quite sure which language would be best for something like this. I don't think it needs to be a whole desktop app, just something I could maybe get to make a CSV that I could then upload to excel. Thanks in advance!
CodeTinkerer@reddit
While it's nice to program your own solution, you should explore options that are available on the Internet. Some of them may do what you want without you having to make a program.
Sassy_Pig@reddit (OP)
I agree, but my company won't spend the money so I was trying to find a solution that's free to them.
CodeTinkerer@reddit
In that case, go for it. I would look at paid options only to get some ideas, but something that meets your minimal needs should be your objective. I'd write down a list of requirements, things your program needs to do.
armahillo@reddit
what language do you know already? can you use that one?
Sassy_Pig@reddit (OP)
None unfortunately. Just some excel formulas and lookups.
armahillo@reddit
On the positive side, calculating and rendering to a CSV is a thing you can learn pretty early on with many languages.
If you have no prior procedural programming experience, you may have to shelve the idea for a moment to familiarize yourself with a language first and then come back to it.
Any scripting language that can be run from a command line should be able to do that, though -- I have done things like this with both Ruby and Python previously. I'm sure other languages can do it too.
qpazza@reddit
This is less language dependent and more requirements dependent. Any language can do this, it just depends on your end goal.
If I were you, I'd use whatever you're more comfortable with. There are going to be enough challenges to work through that you don't need to worry about language on this one
Sassy_Pig@reddit (OP)
I'm doing pretty much everything through excel spreadsheets. I know you can do some intense stuff with excel but I've not found a way to generate schedules with it.
qpazza@reddit
Ok, so what kind of capabilities do you have? And are you looking to 'get it done' or is it a 'learning project that might not really ever be finished' kind of thing?
With excel you can do macros. Which is basically a recording of the actions you take during the macro recording step. This results in VB code being generated, which you can see and modify.
An example of a macro, with my limited understanding of your project, would be to capture the steps required to add a timesheet. There would even be a new icon for that macro action
itsmrburrito@reddit
If you’re already using Microsoft Forms then lookup Microsoft PowrApps, specifically canvas apps. You can use an excel spreadsheet as a database, a Sharepoint list, or other (paid) options. It integrates with outlook, so you can send emails and schedule meetings, time off, etc. Need to send an email with a specific attachment? Power Automate works hand in hand with Power Apps to automate all that. The learning curve is a little steep as you learn the language and behaviors of the system, but I think the return on investment is a lot quicker than learning a language.
Hit me up if you want examples of apps or just to pick my brain.
Sassy_Pig@reddit (OP)
Oh ill have to look into this tomorrow. I hadn't looked into that yet. I've mostly been trying to do it on my own at no cost to the company cause they won't shell out any money they don't have to. But if there's some free integration that could be something I could get them to cave on.
perbrondum@reddit
The language and the ui can be solved after you figure out how to solve the problem. Scheduling problems are linear problems, solving a multi variable solution, in your case minimizing wasted time, while satisfying constraints like workers preference for batching hours together. Think of how schools schedule classes w teachers. There are software solutions out there to solve these problems but your biggest challenge will be to design the equations (what to max/mjn?) and constraints (expressing the preferences). The rest is just math.
interyx@reddit
Easiest way imo is to run a simple web interface connected to a Python backend.
I have heard that scheduling is a tricky problem, so you might need to do some research on the best ways to solve this problem.
But basically:
HTML frontend in a web form. It can be as simple or as complex as you want it. The simplest way is to have them enter their name or select their name from a dropdown, then they'll enter their availability. Exactly how to do this is a design decision; maybe they enter available times for every day of the month. Or a week, or specifically ask for time off. It might take some tinkering and thinking.
Anyway once the form is complete, when you submit it, it'll send the data to a Python backend, possibly running in Django. You probably want a database to store the data. You'll need some way to check or signal that all the forms have been submitted because you don't want to make a schedule with missing people. Then the backend will create the schedule, either manually or automatically.
You can store the data in some kind of virtual spreadsheet. There are a bunch of options but Pandas is very popular; once you have a pandas data frame it's trivially easy to create a spreadsheet, which can then be just imported straight into Excel for printing.
You might be able to reuse the form data if it's in a format that Python (or pandas) can parse. There's probably some kind of solution out there. You could even do Google forms with the responses saved to a spreadsheet that you can just download and import.
But that's how I would do it. Web form sends data to backend; backend processes data and makes it available and you can adjust and print the generated file.
Sassy_Pig@reddit (OP)
This all sounds like a great starting point for me to dive into and research. Thank you so much for the thorough answer!
aqua_regis@reddit
The language is barely the problem as basically any language will do.
Yet, you gravely underestimate the complexity of scheduling algorithms.
Scheduling is one of the more difficult problems in programming and definitely way, way out of your reach if you have to ask what language to use.
Scheduling programs cost so much because they are complicated.
Check out this post from two weeks ago where the author of a scheduling soltware (who, unfortunately, has in between deleted their account) shares their insight on how difficult this matter is.
Sassy_Pig@reddit (OP)
This seems accurate. I really have no previous experience for this. I have just been thinking about picking up programming for a while and now have found myself with a work problem I think programming could solve. I'm OK with it being out of my reach right now. As long as it's something I can learn to build at some point I wouldn't mind it taking time to learn, even if it's a bare bones version of something.
aqua_regis@reddit
TBH, you have to be prepared that it will take years before you get there.
Realistic-Delay-4780@reddit
I would think Python initially. It's really good for automation.
Sassy_Pig@reddit (OP)
Yeah, I know most languages can probably do the functionality of building it out in code. I just wasn't sure about creating the csv/excel file for uploading.
Realistic-Delay-4780@reddit
I use Python for something somewhat similar. pandas builds both csv and excel files pretty easily, openpyxl would help you make it pretty looking. the built in email engine (its name slips my mind atm) can help with sending the file, or selenium (or even requests) could help with uploading the file to a website.
Best of luck!
grantrules@reddit
How would you input people's availability.
Any language can handle the task.. it mainly depends on what kinda interface you want.
Sassy_Pig@reddit (OP)
Right now we use Microsoft Forms to collect the data. The questions we use are Name, Dates Not Available, Availability, and Available to work Holiday. The responses download into an excel sheet. In terms of an interface, I haven't super planned that out yet. Initial thoughts are a text box for the name, then a drop down for the date, and a drop down for the shift/hours for that date, with being able to add multiple dates/times to one user. Sorry if that doesn't make sense, not super familiar with making interfaces.
grantrules@reddit
Sounds like a web app.. then any backend language would be fine.. Python would be a pretty simple choice.. if you want the frontend to be dynamic you'd need JavaScript as well.