CRIME MACULATION (Crime Geo Mapping) A NEW WAY TO REPORT CRIMES
Trang 1CRIME MACULATION (Crime Geo Mapping)
A NEW WAY TO REPORT CRIMES
Balochistan University of Information Technology
Engineering & Management Sciences
Trang 2Dedicated to our family members and especially to our parents who made
us too able with confidence and patience in completing and achieving the
goal of this manuscript.
Acknowledgement
Trang 3By spending each and every moment of life in offering the prayers of almightyAllah, even then it is impossible for us to repay the numerous blessings like intellect,and acknowledge with whom man makes rather spending his life All the praises befor the Holly Prophet “Hazrat Muhammad (P.B.U.H), who is the most perfect andideal of humanity and is forever the model of guidance and knowledge for humanity
as a whole
We acknowledge with a deep sense of gratitude, the encouragement andinspiration received from our supervisor Engr Adil Siddique for his guidance andconstant supervision as well as for providing necessary information regarding theproject and also for his support in completing the project
We are highly thankful to dean faculty of ICT Dr Fasial khan and chairperson
of computer engineering department Dr Faizullah khan for their help and supportthroughout our course of study
We also appreciate technical help and guidance of Prof Dr M NaeemShahwani, Director ORIC and Engr Dr Jan Muhammad, Dean Faculty of Arts andBasic Sciences in research and write up
We extend special thanks to our parents for their continuous encouragement,financial, moral support and sincere prayers for our health and success
With Regards
Behzad Ahmed
Ruzzatullah M.Riaz
M.Ali Awan
Table of Contents
Trang 4WHAT INVOKED US…? 6
My story: 6
Crime reporting system: 7
Crime reporting process: 7
Going to Police station: 7
Wait for your turn/time: 7
Reporting on paper: 7
Record/database of Crimes: 8
Non-location orientation: 9
Crime reports (In case of most crimes): 10
Crime Occurrence area: 11
Crime zones: 12
Case of densely populated areas: 12
Increasing crime rate: 12
Chapter.2 14
INTRODUCTION 14
Objectives: 16
Chapter.3 17
HOW WILL IT WORK? 17
Unregistered users: 17
Registered users: 18
Chapter.4 21
CRIME MACULATION IMPACTS ON SOCITY 21
Increasing the number of reported crime/Decreasing the number of unreported crimes and thus controlling it: 21
Fending yourself/Self-Help through reporting crimes: 23
Increasing awareness in the society through a centralized Database: 23
Don’t tell story to everyone, just update your status: 24
Decreasing Fabrication: 24
Distinguishing peaceful and crime affected zone: 25
Web-based application available for everyone: 26
Computerizing currently available records: 26
Easy Police deployment decision: 26
Beneficiaries: 26
Chapter.5 28
MEAN STACK 28
Trang 5Why use Mongo DB instead of My SQL: 28
Features of mongo DB: 29
Architecture of mongo db: 30
Query processing: 30
Data updating and transaction: 32
Map reduced execution: 34
Advantages of Mongo DB: 35
Where to Use Mongo DB: 36
Chapter.6 37
ANGULAR JS AND MVC 37
Definition: 37
Characteristics: 37
Fundamental Features: 37
Concepts of Angular JS: 39
Advantages and Disadvantages of Angular JS 39
The Angular JS Components: 40
Angular JS MVC structure/Architecture: 40
Angular JS MVC: 41
Chapter.7 42
NODE.JS AND FUNDAMENTAL FUNCTIONS OF NODE.JS 42
Definition: 42
Installing Node JS: 42
After installing Node: 42
Hello JavaScript file: 43
I/O File: 43
example_log.txt file: 43
my_parser.js package: 44
Another my_parser.js file: 44
Asynchronous callback in Node.js…A fundamental function of Node.Js: 45
Playing with HTTP server: 46
My_web_server.js files for importing http server: 46
Node package manager (NPM): 47
Package.json files: 47
Chapter.8 49
Trang 6Install Express.js: 50
Express.js – Hello world: 51
Run the app with following command: 55
Express application generator: 56
Advantages of express.js: 58
The coding of Home client view: 59
The coding of the Reporters view: 62
The coding of the Crime Map: 64
The coding for Authentication: 65
Coding for Reporter: 67
Coding for Contact server controller: 67
Conclusion: 70
References: 72
Chapter.1
WHAT INVOKED US…?
My story:
Once I was travelling in Karachi, suddenly some thieves came in my way, stopped me and snatched my mobile phone (Nokia 3310) So, I thought of registering
an FIR against the thieves For the sake I went to Thana (Police station) Now, when I reach the Thana and ask for registration of FIR, they are considering it as a joke or something very amusing when someone is registering FIR of Nokia 3310 (the cheapest mobile of that time)
Trang 7The amazing thing was that the same happened to my friend at the same placeand the same treatment he got at Thana as me.
To me it has become a serious issue not mainly because of the mobile but
because of that a “crime report” was being ignored
“Ignoring a crime’s report means encouraging the criminal”—Anonymous
In hindsight, I obsessed about it, presuming that it is not only me or my friendwhose FIR is being rejected or being registered but in fact there will be hundreds andthousands cases that will ignored I also perceived that a lot of people will even haveleft off going Thana for registering such and even bigger cases Thana culture hasalmost become useless for such cases People don’t even want to go to Thana because
of the culture being adopted there People think it is just a waste of time if you go toThana for reporting such a minor crime or even serious crimes
If someone wants to report a crime and the Thana culture concur with him/herand he/she get it reported No further action is being taken; FIR is being thrown intotreasures to be discovered by archeologist This make person not to come next time tothe station as it is useless even if a crime gets reported
I’ll embark on few reasons/things that made us develop this project
Crime reporting system:
The crime reporting system of our country has gone ineffective It is notproducing the results the way it was supposed People should willingly have gonethere but because of its ineffectiveness no one ever wants to go to Station to report acrime Policemen will demand bribery if you want to report an incident They willsend you to another station saying that you belong to that station not this They willmake lame excuses to make you not come again They take these things slack anddon’t go for the solution
Once I lost my wallet and I gone to police station for the sake to report it.When I reached the station and asked policemen for FIR, they shuffled me off bysending me to another station saying that I didn’t belong to this one but fact of the
Trang 8Crime reporting process:
The process of reporting crime is so lengthy that no one ever wants to report acrime It is lengthy because of given few reasons
Going to Police station:
One should go to police station if he/she has to register an FIR You will have
to go to police station for reporting a crime, if whether you are in mood to go there ornot, whether your condition is suitable for going there or not You may have hadthreats from someone but you’ll have to go to police station for reporting a crime andeven you can’t report about these threats without catching the route of police station
Wait for your turn/time:
There is only one diarist/clerk present in a police station and it always happenwhenever someone go to a police station that he/she will have to wait for his/her turn
or for the time to come Policeperson may be busy in reporting other crimes or maybehe/she is busy in gossiping with his some friend or colleague
Reporting on paper:
countries are not even depending on type-writing Because there is only one diarist,
so, it is one man show The only diarist will write down FIR, put it forward to highauthorities and also register it in the record of the station
All these factors add up to resist one from reporting a crime Knowing thelengthiness and the tiresomeness of no one should easily say yes to go to a policestation and report a crime Incident of the similar type happened in our area thismonth
It was month Ramadan when some thieves came and made an attempt to steal
a villager’s motorbike Fortunately (for owner but unfortunate for thieves: D), theywere being caught The villagers didn’t take them to police station and opted to settledown the situation themselves by reaching a compromise
After inquiry about why the thieves weren’t being taken to the station, notreporting crime and settling down everything locally It is pathetic to know that I was
Trang 9being told that it is useless to go to police station, nothing is going to make out of it It
is a total waste of time We’ll be asked for bribery No actions are going to be takenagainst the criminals The incident will be mince mattered if we opted to go for policestation
These are the things and reasons that aid and abet criminals and increase thecrime rate The increasing crime rate is mainly because of not reporting crimesanything else According to a rough survey 30% of the crimes in Pakistan gounreported and many surveys has also shown that why they didn’t police station andreport a crime People instead say that they would like to leave it unreported, knowingthat how harmful and disloyal it is and it would be
Moreover, all these things aspects join forces to make the crime reportingsystem ineffective One it has gone ineffective then introduction of a new system isfelt which is effective People would love to work with the newly introduced system
in order to solve their problems and make their lives easy and keep the new systemeffective
Record/database of Crimes:
The record of the reported crimes is scattered all over the country There is nocentralized database for the crimes being reported where you can access the record ofthe crime you want A person who is resident of KP has no instant access to the record
of the crimes in Punjab or any other province Even people living in one city/districtcan’t access records of the crimes in another city/district or even people living in aspecific area within the premises of a certain police station don’t have access to therecord another nearby police station Public is totally unaware of whether the crimehas taken place or not What is the fact of the matter? People don’t know An incident
is being buried/stuck in the police station
People don’t know if whether any crime has taken place or not? Where has thecrime taken place? When has crime occurred? What is the prerogative about all thesethings totally, no one does know Crime reports are of no use of public Public istotally unaware of crime occurrence For the reason public is living in the same wayopenly as they used to be without changing (in fact increasing) there self-defense
Trang 10No one can best the criminals because they don’t know about him/her, thatwhatever crimes have been committed by him/her While it is just like plunder forthem because the criminal knows that not more than half a dozen people know aboutprevious/recent crime(S) that took place The record/database of reported crimes is of
no use f public
There is no organized system for the reported crimes Its record is distributedall over the country You can’t make any sketch for all the record Number of crimesreported can’t easily be calculated because of decentralization of the record Peopleare not intimated about the crimes
This decentralization also weakens control on crimes in a way that nocentralized strategy can be made for each sort of crime because of the dispersion ofthe system Every strategy made for controlling the crimes fails with the passage oftime because these strategies are sort of local and can’t last forever
Non-location orientation:
Currently implemented is not on the basis of location It is no locationoriented No exact location of the reported crime is known Even the diarist (the onewho is writing down the report in the police station) doesn’t exactly know that wherehas the incident taken place If the diarist or any other Police-person tended to knowabout the exact spot, he/she should return frustrated because of the communicationbarrier (the affected person will be unable to tell the exact point/spot and every human
is expected to do so) The person can only tell/explain co-ordinates of where theincident has taken place
There are some online crime reporting systems implemented in different areasincluding KP Pakistan but these systems don’t use exact pin point location which isone of their drawbacks joining the list of others
Exact/pin point is important in so many ways like,
Making decisions about an area that what is the rate of the crimes in thisarea Which type of crime is mostly committed over here? At what time of day andnight mostly crimes occur?
Trang 11Representing the collected data on charts/graphs
Deploying police in different areas according to their crime rate Etc
Increase self-defense area-wise
These factors were knocking our heads and compelled us to get serious aboutthis issue and go and plunge into further study about this We thought of studyingmore about what we’ve observed so far, for the reason that what we’ve observed is areality or a false fiction? Now we are solemnly looking after all reported andunreported crimes
After carrying out a punctilious study we were then completely motivated tocurb this huge disaster Studies have shown some motivational results Amazing thing
is that all of the results are concomitant of others Following is the discussion ofcarried study and its results
Crime reports (In case of most crimes):
We started looking after crimes if whether these are being reported or not Theresult of most areas was almost the same
“Most of the crimes go unreported”, we studied.
We sought out different reasons for this case; some of those had already beenmentioned in observations along with few others Likewise,
Ineffective crime reporting system
Lengthy and tiresome process of crime reporting
Poor/cultural/political type of behavior and FIR system
Traditional Thana (police station) culture
No centralized database
No location and time oriented database
Trang 12Crime Occurrence area:
It was time to study about the areas where crimes do occur We wereconsidering crimes not only of a single area but in fact of different areas and also notcrimes of only one type but of different types
On an occasion our friend’s cell was snatched and when he tried to register anFIR but his FIR was rejected for mobile lost being of low price This resulted intoanother mobile snatching incident at the same spot and at the same time from anotherfriend of us
This indicated that the areas of crime occurrence reside very near to eachother Observation of different areas shown that crimes occur on nearly same area andsame time But had no tool to report these crimes location-wise so that we have asketch of what is going on
So, in short we can say that,
“Crime occurrence area is repeated”.
The reason for this is non-location orientation of crime reporting system Insuch situation a system is needed through which we can report our crimes using thespecific pin point location or at least co-ordinates are known
Crime zones:
Most of the zones (where crimes are occurring) are used for these since verylong Most of the criminals use specific zones for committing crimes Area/zone is notbeing changed very often Criminals are found and crimes occur at the same spotsmore than often
We can instead say that there are
“Crime specific zones”
These are in fact crime hotspots This is mainly because of that there is noidentification of those specific zones Police is unaware of where has been crimesoccurring At which time which area is dangerous?
Trang 13Case of densely populated areas:
It is very easy to commit a crime in an area that has high population because it
is easy to abscond from the spot All high populated areas in the whole world hasdefinitely high crime rate We found out that
“Higher crime rate in densely populated areas”
This is all because of easy escape from the spot But we also noticed that theattention given to the densely populated areas is as normal as other areas
Increasing crime rate:
All these factors combine to result increasing crime rate The crime rate isincreasing day by day Neither government nor the public is taking the issue seriousbecause of that there is no target in front of them They don’t know about the exactsituation
Main factor of increasing crime rate is not reporting crimes The followinggiven figure(fig.1) illustrates and explains the whole matter
Trang 14The given figure is showing that if a crime report is being ignored then an increase incrime rate occurs It also illuminates the behavior of our police, how do they think?They think if you make it hard and difficult to report a crime then no one will report itand increase in crime rate will not happen
There is nothing crimes to be visualized with Crime rate in some areas hasincreased more than twice and thrice It is also apparent that there is no area of whichcrime rate has not been increased in nearby time Densely populated areas likeKarachi’s crime rate has abruptly been increased and this will go very high if thesame way is being adopted in future as well Increasing crime rate is the result of allthe above stated reasons and factors There is no try to overcome these factors or even
an attempt being made to overcome or even reduce
Chapter.2
INTRODUCTION
While being in state of war, lack of education & lack of a proper system tofight crime is turning our society into hub of criminal activities Poverty and illiteracyboth are giving birth to different crimes and deteriorating law and order day by day.War on terror in result of ineffective police system is also giving birth to differenttypes of crimes and criminals Sometimes it seems like as if there is even no attempt
to control the crimes
The Crime controlling system being lengthy, manual, and tiresome anddisturbed has completely failed, resulting in an ineffective system The current system
is totally decentralized All these and some other non-mentioned factors add up to:
1 Make it hard and difficult to report crime(s), and
2 Allow criminals to commit crimes
So, in such a situation we were really craving a change on egalitarian basis The onlypossible change we thought can be is,
Trang 15“Crime Maculation (Crime Geo Mapping)”
The only solution is executing all those factors which are making our crime reportingsystem ineffective
A centralized, semi-automatic (some tasks will belong to user like, reporting acrime, viewing crime map etc while other tasks like leading to pin point location,making of cluster will belong to machine That’s why it’s being called semi-automatic) and 'on-go' (you can use it anywhere you have access to internet if whetheryou are at home, office, university or anywhere) system would be much better & moreeffective and will overcome the problem we are currently facing
Development of a web-app that can be used to control crimes by mappingcrime data can overcome the dilemma This app is using interactive Google map andleaflet API combination to spot/identify crime location, exact time and type App will
be made responsive so that it can be used on every platform like, Windows, Linux,Mac, IOS and Android etc It will use different icons to identify the type of crime,example, for a crime reported in bike snatching category; a bike icon will be used onGoogle map instead of default Google marker, so on and so forth
A message will also be sent in one of the two cases:
a When someone signs up (a verification code will be sent to the user thathe/she will have to enter into the verification code field in the sign upform), or
b A crime is being reported in specific category (User could subscribe forintimation through SMS in many ways like, date and time wise, crime-typewise and area wise etc.)
As the users will increase, more crimes will be reported As the number of crimesreport will increase a cluster will start developing, with time and increasing crimesreports will change the color of the zones It will be in the following stages
a Initially it will be green when the crime rate will be normal
Trang 16b It will then go yellow when the crime rate will start deviating from thenormal Yellow color will point to that the crime rate has startedincreasing.
c It will turn red when more crimes will be reported and the crime rate will
go high Red color will be indication for that
Any smartphone user will be given access to this app and also PC users will beable to access the application But registered users will be given more privileges thanthose of non-registered users like, only registered user be able to report a crime whilenon-registered user will only be having access to view the crimes map PC users canalso access it via a website but with some less option in terms interactivity only
A user will also be informed (via email or SMS or both) whenever a newcrime is reported in their respective area
JavaScript (ECMAScript) will be used for front end design along with HTMLand CSS JavaScript (MEAN stack; Mongo DB, Express.JS, Angular.JS, Node.js) will
be used for backend development Also some libraries of JavaScript will also be used
An SMS subscription of Twilio and its API will also be used for SMS updates.Twilio will automatically send SMS to the user on database update (i-e new crimereport or sign up)
Objectives:
*An interactive application
*Multi-platform
*Centralized database
*public use, and
*law enforcement agencies use
Trang 17Chapter.3
HOW WILL IT WORK?
This app is an open source application available for everyone free of cost Ithas been made as much interactive as much we thought is possible It has differenttypes of privileges for both registered and unregistered users
Unregistered users:
Unregistered users or visitors will be given privileges of viewing an alreadyreported crime A visitor without registration will also be allowed to inform a friendvia mail
Unregistered users will not be allowed to report a crime or update an alreadyreported crime They can only view crime map with a little more access The bestpossible option available for unregistered users is to click on sign up option
The sign up process doesn’t take too long It’s a form to be filled In the formfollowing are the fields to be filled:
First name
Trang 19 They can subscribe via mail or SMS whichever they want or they can even optboth.
They can report a new crime and let people know if the reporter is victimhimself, eye-witness or any relative or friend of victim
An already reported crime can also be updates If someone gets moreinformation about a crime reported or comes to know some facts, he /she canupdate the crime they’ve reported
There will also be option for registered users to inform a friend of him Friendcan be informed via email
If user’s requirement (S) is being fulfilled what he/she was looking for thenhe/she could logout
This is how one can login,
Fig.2
Trang 20Following figure explains how it will work.
Fig.3
Whenever a user requests something, the request goes to the server and this how server severs the client/user/front-end shown in the figure 4
Trang 21Chapter.4
CRIME MACULATION IMPACTS ON SOCITY
Imagine if you have been given such ease of access to the just system that youcan report an injustice where it happened, you can bring law enforcement agenciesagainst a crime when you observed it then got to a haven and public can be informedwhile setting at home “Informing friends and Family members if whether you are avictim witness or just saw an update on the map using an online platform settinghome, shop, office or anywhere”, all this is will be made easy Even beyond thissecurity get autonomous configuration All the crimes related risks can be handledwith such a managed and self-decisive system “Crime Maculation (Crime GeoMapping)”
Trang 22Implementing it will bring about the following revolutionary and humongouschanges in the society.
Increasing the number of reported crime/Decreasing the number of unreported crimes and thus controlling it:
It all depends upon how easy and simple is something made for publicinteraction If something is easily accessible it gets a lot of public interactivity while
on the other hand if something is made in a way that it is complex and hard to accessthen it gets very less interactivity of public So, this is the main idea behind CrimeMaculation, crime reporting has been made easy, complexities and unfriendliness hasbeen pulled out, simplicity and easy reporting has got fame People are made to reportcrimes and not to compel them to stay away
A similar system named “SpotCrime” deployed in U.S, despite a
well-managed system against crime in U.S has over 6 million visitors and it has over 3-lacsubscribers It has also affected the increasing crime rate which is an indication of hoenecessary it is to deploy such a system which even decrease crime rate in U.S
“If you root out the germ, the disease will automatically relieve but if you don’t work on the root-germ it might only get a temporary relief” Unknown writer.
The problem because of which people are scared to report crimes aretiresomeness, political influence etc So, as the hectic crime reporting system will
improve, the “tiresomeness” will become a “lame excuse” The current in air
missing crime reports can made on air All the reports that were not being reportedshould now get on record Thus, the number of reported crimes will increase whichwill result into awareness among the people A real sketch or map of crimes will beobserved
As the people will start reporting crimes and thus an increasing crimereporting rate will concomitantly decrease the number unreported crimes People will
be no more scared of the button-down crime reporting system The whole Thanaculture and crime reporting system will be brought at the indoor access Even therewill be no need to wander at door step This will bring a dramatic decrease in thenumber of unreported crimes
Trang 23In this way people crime it will become an easy job to know if whether the crimes
rate is increasing or decreasing For government, if it is increasing, get frightened, if
decreasing, regime is going well and dedicated In short, the increasing reportedcrimes and decreasing unreported crimes will help in controlling of crimes and thusmaking the country a happy and prosper which means that crime reporting systemplays a big role in the prosperity of public Following is an image describing the story
Fig.1
The image above shows that reporting crimes will decrease in the crime rate
Fending yourself/Self-Help through reporting crimes:
Almost everyone has heard the proverb “God helps those who helps
themselves” It’s also applied on crime related matters but in fact it is often said about
curbing crimes So, Crime Maculation will make the society able to help their selves
in a better way This will equip them enough to invoke actions against crimes andcriminals with their soft hands
Law enforcement agencies can’t take any action in your favor until and unlessyou report a crime and it is quite difficult to report a crime in such arduous reportingsystem So, if the current system lasted for an era, people will return in more thanfrustration Crime Maculation will provide a platform for such ease of access for
Trang 24reporting of crimes and thus laying a foundation and going a step further toward aprosperous society
Crime Maculation is making crimes easy-peasy to be reported which in turn
will mould law enforcement agencies actions in your favor As law enforcementagencies (Police, Army and F.C etc.) take actions in your favor, it will improve andincrease your security and will help you in a better way In this way you in fact madeway-through for your self-help and self-security and fended yourself in a better way
Increasing awareness in the society through a centralized Database:
Crime Maculation increases awareness in the society through sharing acentralized Database system for the whole country Current system has no centralizedrecord which results in no centralized information distribution The system we havemade will give people access to a centralized record of crime reporting
A crime which took place in Karachi can be checked in Quetta I want to seewhat is happening in Lahore, I can just open Crime Maculation and see it All thedetails (drop seen, date, time location etc.) are available over there This way thewhole society is being informed of all the current crime happenings which will result
in increasing self-security f the public
Don’t tell story to everyone, just update your status:
After a crime has taken place everyone is going to ask you about the details ofthe incident It can be very vexing and annoying and even beyond this being a human
no one has capability and stamina to tell it to everyone Also it is very unjust everyone
to ask personally about the happening instead of expressing grievance and to light thewoe he/she is facing
To curb this boredom Crime Maculation provides platform where the victim
or eye-witness can just report a crime and add all the details Now everyone can justvisit and check the details of the whole drop seen
Victim has now totally gotten rid of all this headache/tiresomeness throughupdating Crime Maculation The whole story/detail is available for everyone online
Trang 25Now the victim is relax while people who want get aware of the incident are gettingaware Both the sides are running happily.
Decreasing Fabrication:
In the current developed system of spreading of crimes there is a lot of
fabrication of details Incident happened in let say A way, it starts propagating with
some noise (that of Wireless and Wired Communication) being added to it, when it
reaches the last person then according to A (the way it started) it is in the form Z (Upside down or totally different), if not Z, T is for sure A similar incident happened
in my area in the last few days when young man was being murdered Seven differentpeople told us seven different stories and yet I’m searching for the truth I can’t decidewhich one is telling a truth Only his family members should be aware of what is trueand what is lie?
Using Crime Maculation all this can be controlled Once the victimhimself/herself or someone from his/her friends or from his/her family has reportedthe crime and added the details; it will considered to be authentic and final Now there
is no point to make a fabrication or to fall for a fabrication Fabrication of fake newsshould abruptly stop here because everyone knows what the official news is or whatare the news from the victim himself/herself or his/her friends or his/her or what thenews from the eye-witness is
In case of frequent repeating of incident details can often induce slip of tonguewhich will spread fake/wrong news While in case of Crime Maculation once user hassubmitted the crime report it is fix Now there is no chance of slip of tongue oranything that because of which false news can propagate
Distinguishing peaceful and crime affected zone:
As Crime Maculation will report on exact pin location using map (leaflet) and an algorithm will also be used to indicate the crime hotspots So, this way it will be easy for the people to know about the high crime affected zones
A cluster will made on those areas which are highly crime affected zones onmap whilst the other less affected areas will also indicated the same way Following
Trang 26
Fig.2
The image given above is showing that which area is high crime affected one
A cluster/hotspot is being made on the area in which there are a high number ofcrimes being reported
Web-based application available for everyone:
As it will be a web-based application and will be available for free foreveryone so it be out of hesitation for everyone to download it and install it Everyonewho does use internet can use Crime Maculation as well without the cost of a singlepenny
People living in our region esp that of south Asia cares a lot about that if something isavailable for free or will cost If something is of low cost or free of cost then it isapplauded a lot
Computerizing currently available records:
All the records that are not being computerizing and having been written down
on the white papers can now be computerized Every crime will go on air It will
Trang 27result in ease of access to the knowledge, information and some historical background
of some crime or crimes or a criminal
Easy Police deployment decision:
As we will come to know that which area is most crime affected and whicharea is least then it will be easy to take decision about the deployment of police.Crime Maculation will be available for both public and law enforcement agencies—neither only for public nor for law enforcement agencies So, it will be an easy job todeploy police
Beneficiaries:
There are already developed systems but they had some lack of access Somehave only given privileges to Public while others are accessible only by lawenforcement agencies Crime Maculation is unique in this regard; it has two types ofbeneficiaries:
i Public:
Public will take benefit of it in a way that they could report, update,view a crime
ii Law enforcement agencies:
Law enforcement agencies can use it in way to view crimes, crimeaffected zones, crime hotspot and then easy Police deploymentdecision
Trang 28“M” stands for Mongo db
“E” stands for Express.js
“A” stands for Angular.js
Trang 29“N” stands for Node.js
Let’s we take start from the mongo database that, what is “MONGO DATABASE”:
Definition:
Mongo DB is cross-platform and open source document oriented database, akind of NO SQL database As a NO SQL database ,Mongo db rejects the relationaldatabase and is a table-base structure to adopt JSON like document that have activeschemas which it call BSON
This makes data integration for certain types of applications faster and easier.Mongo DB is built for scalability, high availability and performance from a singleserver deployment to large and complex multi-site infrastructures
Mongo DB was first developed by Mongo DB Inc., known then as 10gen, inOctober 2007 originally as a major part in a PAAS (Platform as a Service) productsimilar to Windows Azure and Google App Engine The development was shifted toopen source in 2009
Why use Mongo DB instead of My SQL:
Organization of all sizes is adopting mongo db because it enables them tobuild applications faster Handle highly diverse data types and manage applicationmore efficiently at scale
Development is simplified as Mongo DB documents map naturally to modern,object-oriented programming languages Using Mongo DB removes the complexobject-relational mapping (ORM) layer that translates objects in code to relationaltables
Mongo DB can also be scaled within and across multiple distributed datacenters, providing new levels of availability and scalability previously unachievablewith relational databases like MySQL As your deployments grow in terms of datavolume and throughput, Mongo DB scales easily with no downtime, and withoutchanging your application In contrast, to achieve scale with MySQL often requiressignificant, custom engineering work
Trang 30Mongo db is a general purpose database that is used for variety of use cases.The most common use cases of mongo db are single view, Mobile, real-timeanalytics, personalization, catalog and general management.
Below some features of Mongo db are given
1 Mongo db support map reduce and aggregation tools
2 Java script is used instead of procedures
3 Mongo db is scheme less database
4 Most importantly mongo db supports secondary indexes and geospatialindexes
5 Simple to administer the mongo db in case of failure
6 Mongo db designed to provide high performance
7 Mongo db stores files of any size without complicating your stack
Trang 31/bin/mongod # data stored in /data/db
# Start the command shell
Mongo DB belongs to the type of document-oriented DB In this model, data
is organized as JSON document, and store into a collection Collection can be thoughtfor equivalent to Table and Document is equivalent to records in RDBMS world Heresome codes are given
# create a doc and save into a collection
Trang 32# Iterate result using cursor
Trang 33happened in the collection, then the system repeats the process to figure out what isthe best index at that time.
Data updating and transaction:
To update an existing document, we can do the following steps:
Under this scheme, a “modification” is attached along with the modificationrequest so that the database server can validate the condition before applying themodification (of course, the condition checking and modification must be automatic,
so no update can happen in between).In Mongo DB ,this can be done by the “find andmodification” call
var account = db.bank.findone({id:1234})
Trang 34var old_bal = account['balance']
var new_bal = old_bal + fund
# Pre-condition is specified in search criteria
db.bank.findAndModify({id:1234, balance:old_bal},
{$set: {balance: new_bal}})
# Check if the prev command successfully
Map reduced execution:
1 Client defines a map function, reduce function, query that scope the input data,and an output collection that store the output result
2 Client sends the request to the mongS routing server
3 MongoS forward the request to the appropriated shards (route or scatterdepends on whether partition key appears in the query) Notice that mongoSwill pick one member of each shard currently always send to the primarydatabase
4 Primary database of each shard executes the query and pipe output to theuser-defined map function which emit bunch of key value pairs stored in
Trang 35memory buffer When the memory buffer is full, a user-defined reducerfunction will be invoked that partially reduce the key values pairs in thememory buffer result stored in the local collection.
5 When step (4) completes, the reduce function will be executed on all previouspartially reduced result to merge a single reduced result on this server
6 When step (5) finishes, mongos notifies the corresponding shard servers thatwill store the output collection (If the output collection is non-partitioned only
a single shard will be notified, otherwise all shards will be notified)
7 The primary database of shard storing the final collection will call for everyshard to collect the partially reduced data previously done It will only ask forthe result based on its corresponding key range
8 The primary database run the reduced() function again on the list of partiallyreduced result then store the final reduced result if the user provide a finalizefunction, it will be invoked as well
Here is a simple example to build an inverted index from document to topicsdb.book.insert({title:"NOSQL",
Trang 36documents Number of fields, content and size of the document can differfrom one document to another.
ii. Structure of a single object is clear
a document-based query language that's nearly as powerful as SQL
2 Ease of scale-out:
faster access of data
Where to Use Mongo DB:
Trang 372. Content Management and Delivery