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,128 | Comments: 45,550

filter by tags archive

MactoCounting is The Holy Grail

time to read 2 min | 263 words

I might have mentioned before that Counting is somewhat important in prison. That is about as accurate as saying that you would somewhat prefer it to keep breathing. Counting is the heartbeat of the prison, the thing that the entire operation revolves around.

Here we can see the counting screen:


You can see that we have an Open Count here, that is a count that is still in progress. Some cell blocks have reported their counts, and some are still in the process of making the count.

A Count is Closed when we know where are the Inmates are. (When the two numbers line up properly). You probably noticed that there are two ways to report a count, the first is for Inmates who are outside the prison (court, hospital, etc). Because they are outside the prison, we track them by name. For internal counts, we don’t really care about names, just the numbers.

There is another type of a Count, a Named Count, which is a process that happen very rarely, but is usually used to reconcile what is in the computer and what is actually in the cells.

It is important to understand the “Officer in charge” field, basically, it is the guy who has the legal responsibility and is signing off on those numbers. In other words, if there is something wrong, that guy is going to take a hard fall.

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



With the Internal count.. is there a chance of a person being counted twice?

It seems the area counts are not counted at the same time so maybe (I'm just guessing not really sure from a practical point of view) a person could move from open place to another and be counted at both? or is there a lockdown between areas when the count is in progress?

Ayende Rahien

Luis, Yes, areas are being counted concurrently, but not immediately. In general, there is a moratorium of movements during Counting, but not always. It is possible that someone would be counted in two places, but unlikely. That is why there is also the "Out" column. The is actually also an "In" column, but I didn't show that. All of those numbers must line up properly.


If the possibility exists.. then there could arise a situation where one person is counted twice and another is 'missing' but the numbers would line up (Again this is probably even more unlikely but it does seem to be an assumption)..

Is this something we'd need handle in the system?

Oh wait.. I'm guessing the Out and In column would be used to detect this situation. Wasn't 100% sure what the exact meaning of the Out column was.

Hyojung Kwon

I guess that OUT column represents the number of inmates who are not in the specific Block.

Ayende Rahien

Luis, That is why you are marking the Out/In as well, it tells you have many Inmate you have beyond/beneath the Rooster. In practice, it tends to sorts itself out.

Chris Sainty

How are counts actually performed on the ground, and do you see macto being something you use to help you count, or just something you use to record and validate the count results?

In my mind I see a guard walking down the cell block calling out names and checking the person who responds is the prisoner called. I would think Macto could aid in this by showing the guard which prisoners are expected to be in a certain cell / location (hospital, court van etc) and giving them the list of names to call then check off. But that could just be Hollywood prisons.

Mike Minutillo

Who is the intended user of this screen? Will each area report their own count on this screen or is this screen being used to collate counts as they come in? Is a Counting considered complete when counts have been provided for each location, when the numbers all add up or something else?

I would guess that counting too many Inmates is just as bad as counting too few. Is that correct? If a count does NOT add up what happens? I guess that a re-count occurs but is that a separate new Counting or part of the current Counting? What if a cell block discovers they have made a mistake? Can they update their count or does that require a complete re-recount?

Presumably a single Counting can be in progress at any time. Is that correct?

The External Count screen seems to indicate that we keep track of which Court the Inmate is currently at but the Counting table aggregates those Inmates as being at "Court". Is this true for Hospital as well? What about any other external locations. Will they be aggregated too?

The main screen had Kitchen listed as a location. Is that considered an external location or an internal one?

The external count panel also seems to indicate that each external location will have a single officer in charge. Is that correct?

Ayende Rahien

Chris, A typical prison like the one I served on has about 120 - 240 inmates per block. You couldn't really do a Named Count 3 times a day, it takes too long. Counts are usually done by lining up all the Inmates and Counting how many are physically present, at which point we consult the gate records to show how many Inmates are in/out of this block.

Ayende Rahien

Mike, The user is the Legal dept and Ops Room, usually. The officers doing the counting will report to the Ops Room, which usually record things. A Counting is considered Closed when all the numbers lined up AND all cell blocks have reported in.

Counting too many Inmates is a problem, yes. It isn't as big a problem as Counting too few, but it will also trigger a Recount. That usually does not get recorded as a different Count, it is just a physical Recount that updates the current Count. So yes, they can update their count.

Only a single Counting can go on at any given point, yes.

As for the External Count. We need to track external Inmates at a very granular level. But for Count Summary, we can just show the higher level information. As long as the numbers line up, we don't care. But, the Count Summary would show each Court as a different line, because each Court is located in a different place, and it impacts how soon those Inmates will go back. Same goes for Hospitals, by the way.

Kitchen is an internal location. For External, there is always a single officer who is in command. That doesn't mean that there is only a single officer there, there are always more than that. But there is only one in command, and that is who we care about.

Mark Lee

"A Counting is considered Closed when all the numbers lined up AND all cell blocks have reported in."

What happens if a prisoner has escaped? Does the count remain open indefinitely?

Ayende Rahien

Mark, In that case, you have worse problems. But to close the count, you do an External Count with location "Escaped!!!" and the Officer in Charge need to fill in for the Inmate :-)


I assume the "Report" button should be named "Submit Count" because at first glance it looked to me like it would open a report screen. Also, it's not "Inamte id" but "Inmate id"

Harry Steinhilber

@Manu, Actually, I think "Report" is correct for this situation. The users are "reporting" their counts. And that is the mentality I think the actual user will look at the screen with.

Ayende Rahien

Manu, No, it is report, that is the terminology used. I am reporting on the state of my inmates. And I think we will live with the typo in the mock up for now.

Comment preview

Comments have been closed on this topic.


  1. The worker pattern - about one day from now

There are posts all the way to May 30, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats