Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,842

filter by tags archive

MactoGetting Started, you never forget your first Inmate

time to read 5 min | 964 words

People always love to start with CRUD, but it is almost never that simple. In this post, we will review the process required to accept an Inmate into the prison.

That process is composed of the following parts:

  1. Identification
    • Who is the guy?
    • Id number
    • Names
    • Photo
    • If we can’t identify / refuse to identify, we still need to be able to accept him.
  2. Lawful chain of incarceration
    • Go over all the documents for his arrest
    • Ensure that they are all in order
    • Ensure that they are continuous and valid
    • Check if there are any urgent things to do with him. For example, he may need to be at court today or the next day.
  3. Medical exam
    • Is it okay to hold the guy in prison?
    • If he is not healthy, can we take care of him in prison?
    • Does he require hospitalization?
    • Does he require medicine / treatment?
    • Are there any medical consideration into where to put him?
  4. Intelligence
    • Interviewing the guy
    • Report interesting details that are known about him
  5. Acceptability
    • Does he fit the level of Inmates we can accept? We usually don’t put murderers in minimum security prisons, for example.
    • Does he have any medical reason to reject him?
    • Are there any problems with the incarceration documents?
    • Is there any intelligence warning about the guy?
  6. Placement
    • Decide where to put the Inmate
    • What type of an Inmate is he? (Just arrested, sentenced, sentenced for a long period, etc)
    • Why is he in prison for?
    • What kind is he? (You want to avoid Inmate infighting, it creates paperwork, so you avoid putting them in conflict if possible)
    • Where there is room available?

Another important aspect to remember is that while we are allowed to reject invalid input (for example, we are allowed to say that the id number has to consist of only numeric characters), we are not allowed to reject input that is wrong.

What do I mean by that. Let us say that we have an Inmate at the door, and he doesn’t have his incarceration paperwork in order (well, not he, whoever brought him in, but you get the point). That means that legally, we can’t hold him. But Macto isn’t where things are actually happening, it is merely a support system that tracks what is going on in the real world. And the prison commander can decide to accept that guy anyway (say, because the paperwork in en route), and we have to allow for that. If we try to stop people from doing this, it is going to be worked around, and we don’t want that. The system is allowed, even encouraged, to warn the users when they are doing something wrong, but it cannot block it.

The first part, Identification, is actually pretty easy, all told. This is fairly simple data entry process. We’ll want to do some checkups on the data, such as that the id number is valid or to check the id against the name, etc. But we basically have to have some level of trust in the documents that we have. You usually don’t have an arrest warrant for “tall guy in brown shirt”. If we find any problems there, we can Flag the Dossier as a potentially fraudulent name. This is also the stage where we want to check if the Inmate is a returned visit, and bring the life the old Dossier.

The second part is more complex, because there are many different types of Warrants, each with their own implications. Arrest Warrant is valid for 24 hours, Remand Warrant is good until sentencing, etc. We need to input all of those Warrants, ensure that they are consistent, valid and continuous. If there is a problem with that, we need to Flag the Dossier, but we can’t reject it. We will discuss this in more detail in the next post.

The third part is basically external to Macto, we may need to provide the Inmate ID, for correlation purposes, but nothing beyond that. We do need to get approval from the doctor that the Inmate is in an OK condition to be held in the prison. That does get recorded in Macto.

The forth part is again, external to us. Usually any information is classified and wouldn’t appear in Macto. We may get some intelligence brief about the guy, but usually we won’t.

The fifth part is important, this is where we actually take legal and physical ownership for the Inmate. Up until that point, we had him in our hands, but we weren’t responsible for him. Accepting the Inmate is a simple matter if everything is good, but if the Dossier was Flagged, we might need approval from the officer in charge. Accepting an Inmate means that he is added to the prison’s Roster.

The sixth part is pretty much “where do I have a spare bed”, after which he is added to the Roster of the cell block he is now in care of.

It is important to note that Placement always happens. Even if immediately after Accepting an Inmate you rushed him to the hospital, that Inmate still has to be assigned to a cell block, because that assignment means that the cell block commander is in charge of him. That way we avoid potential mishaps when an Inmate is assigned to no one, doesn’t get Counted.

Okay, I think that this is enough for now, in the next post, we will discuss what exactly goes on in the second part, it is a pretty complex piece, and it deserve its own post.

More posts in "Macto" series:

  1. (17 Aug 2011) Looking at warrants
  2. (15 Aug 2011) Talking to nasty people
  3. (11 Aug 2011) Counting is The Holy Grail
  4. (10 Aug 2011) Getting Started, you never forget your first Inmate
  5. (08 Aug 2011) The Main Screen
  6. (03 Aug 2011) Warrants are for fools
  7. (01 Aug 2011) Non functional concerns, you are a legal system
  8. (28 Jul 2011) And it goes on your permanent record, too!
  9. (27 Jul 2011) Once more from the top, I swear I had a few more over there
  10. (26 Jul 2011) Day to day life
  11. (22 Jul 2011) Where is the Inmate anyway?
  12. (19 Jul 2011) Let’s CREATE an Inmate
  13. (12 Jul 2011) Creating The Model
  14. (05 Jul 2011) The boundaries of a prison
  15. (25 Jul 2009) An end to end sample


Paul Cox

Are there cases when you get to stage 5 and then don't accept the Inmate? If so, does that Inmate's Dossier still need to be recorded in Macto?

Ayende Rahien

Paul, Sure, it may be a murderer, and you are a minimum security prison. Or a problem with the Warrants, or a sick Inmate that we can't hold, etc. It is fairly common. We need to record that in Macto, because the way it usually works, I reject the guy, and then someone from above a day later says: "You'll do it anyway."


So starting with step 1.

Do we want to track how the Inmate was identified? ie. passport vs. ID-card vs. Court papers? If so do we want to track the number of the passport/ID-card?

Names, are these similar to that of a passport, where we have middle name surname, first name and last name?

Ayende Rahien

Morten, Yes, we track additional identification information for the Inmate. You can see it in the screen shots that I posted. We usually hold to any id that he has (goes into his "checked baggage" :-) ), and in the Dossier, we record the details that we care about and also keep a scan of that.

As for names, that is a bit complex, depending on the prison. In some prisons, you track "First Name, Last Name", in another, you track: "First Name, Father Name, Grandfather Name, Last Name"


Is the process of accepting an inmate as a sequential checklist to go through or can these things occur in parallel, such as for example intelligence gathering and placement?

Ayende Rahien

Morten, They can happen in parallel, mostly. For example, the first part of the Inmate identification requires him, but afterward he can go to Medical while we go through the Warrants

SSII à Lyon

What kind of trackability do we need along the way, for instance - who brought in the entrance paperwork - who was the doctor who did the physical exam and so on.

I mean, is it useful/required to track every personnel who interacted with the inmate during the process? Or is that overkill?

Ayende Rahien

SSII, Yes, tracking who did what is important

Matthew Shapiro

If some of these steps are done by external entities (e.g. intelligence) and others can take time (sorting out warrants) at what point is an inmate considered "Accepted"? What is an inmate considered if he is being held but the warrants aren't sorted out yet (waiting for paperwork to arrive)?


Is "searching" whether the Inmate was previously held typically part of the process of accepting the inmate?

Ayende Rahien

Matthew, Those steps are done as part of the acceptance cycle. Basically, there is a big building with a U shape corridors, that has stations for different parts of the process

Ayende Rahien

JeroenH, Yes, that is part of the initial check.

No Code

You guys will never get this thing coded. I've been following along and the ditch is getting exponentially deeper by the day. You're to the point now that 1 question is leading to 10+ new questions. This project is beginning to look like a normal corporate project now.

Wait, didn't I already say you guys will never get this thing coded?

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats