How we made the web app
for the state procurements

Warning! The article contains some legal (law, juristic) words and was a pain for me to write, because I don't usually use these words. It may contain some mistakes in terminology. You've been warned!

Also, probably it won't be very exciting for you to read (especially if you're not interested in Russian state procurement laws). I wrote this article mostly to reflect on what I did and what I learned when I was working on the project.

Well now, if you still want to read this - let's start!

When I was working on one of the Russian web development companies (at the years 2013 - 2014), I had a task to create an application for the NMCK calculation (what is the NMCK - see below) with web interface and which should work with the open data from the public government database.

On the project, besides me, was working only one other man. Also, for several lesser tasks we hired freelancers.

The application was designed for the public sector entities (state-owned and state-funded organizations).

Basically, these organizations could make procurements (purchases) on the government money to buy things they need, but they had to report back on what these money were spent (of course). This was regulated by law and there were standard report forms - and our application was supposed to help in making this reports (a big part of this report was the calculation of NMCK, which defined the price for the contract based on the existing contracts).

Our clients - end users - were hospitals, public schools, and many other organizations - even police! Well, their accounting dept.

Russian Official State Procurements web site

The Russian Official
State Proc. web site

The application - which was named "Calculator of NMCK" - was a web application with multiple tabs with fields, tables, buttons and whatnot, which a user could use to fill info on his contract. On each tab there was a help button which could provide a hint on what to do (they were written by our lawyer, because we, of course, didn't have the law knowledge).

There was the contract search menu where the user could search for already existing contracts and add them to the tables (they needed to do that because the price on a new contract had to be based on the price of the existing, similar contracts).

Besides the database of contracts, there was the database of organizations. It could be used to fill the info about the user's organization faster - he didn't need to fill the full info by hand, he could just fill his organization id ("VAT id", or in Russian - "INN") and the app would fill the rest of the fields automatically.

Calculator of NMCK

Calculator of NMCK

After filling all the forms, user had to calculate the "NMCK". What is it? The point is, by the law a state-funded organization couldn't just buy something on the government money by an arbitrary price.

The organization had to explain why they choose this price for the contract - and to do so, it had to show some examples from the statistics - based on the already existing contracts. This was supposed to prevent cheating with procurements and spending the government money (hello, infamous Russian corruption!).

My definition of the NMCK and the related things, of course, isn't very precise and probably isn't very right - I'm not a lawyer (not even close!) and I don't really know the Russian law very well - but I've explained that as I understand that (and for the technical implementation it was enough back then).

Finally, after all the input, search and calculation, the application generated reports in MS Word and PDF formats, based on the filled data.

And such was the task - and the task was completed.

Calculator of NMCK

Selecting a method

We made it as a client-server application (as a servlet for Apache Tomcat), on Java with GWT (Google Web Toolkit) for front-end and MySQL for databases. Some parts were made on PHP by freelancers.

The most work were made by my colleague (another programmer) and me.
I did the most of the back-end code (on the server side), the functionality for working with tables and some other technical features - like the database searching and the result processing.

My colleague did most of the front-end interface, the NMCK calculation and the reports generation. For the report generation we used Aspose Words.

Calculator of NMCK

in the contract registry

The official Russian State Procurements web site often were down, but our application was supposed to work all the time - and so for this, and also for the more convenient work with datebase, we've decided to make regular unloading (import) of the data from the "Open Data" - from the public government server to the server of our company. For that purpose we've hired a team of freelancers - all the coordination with them was through Skype. They made PHP scripts for data importing. Later we set the scripts on the regular execution on Cron.

By the way, the server was on FreeBSD, with MySQL, Apache HTTP Server and Apache Tomcat.

I spent a lot of time working with that server and learned a lot (I had experience with Linux before, but FreeBSD was new to me back then).

Calculator of NMCK

The Administration Panel

There were several databases - separate for organizations (we set up the import of their data from the official database in the same way as for the contracts), separate for contracts, and for the users of our application - we had to store their logins, status, payments and other data.

The Administration Panel was created as an addition servlet - it was used for the user control, reading logs of user actions, etc.

And so, I've got a lot of experience while I've been working on this project. Many methods and techniques which we used there I did for the first time.
But, as a result of using them at the project, I've improved my web development skills, and got some experience in collaboration and interaction with freelancers.