DEV Community

Cover image for A Dating Tool for Returning Inmates
femolacaster
femolacaster

Posted on • Edited on

A Dating Tool for Returning Inmates

This would be the first blog post of this series that teaches how to build a dating tool for returning inmates using RedisJSON and RediSearch. This first part of the series talks about the various data dimensions in matchmaking returning inmates, and how to collect some of this data and store these data in RedisJSON.

And I hope that by the end of this tutorial, you have developed the capacity to store JSON documents using RedisJSON, be familiar with Redis Cloud and Redis Stack, and achieve the first part of a tool to help the returning inmates fit into the society better.

Let us Begin!

The pain of ex-inmates returning to society cannot be underestimated. As seen in the movie, the Shawshank Redemption, getting out of the system (the now usual way of life in prison) into the society is not that easy, especially for ex-inmates who stayed for a long while. Still, this remains a neglected problem in most societies.

So that we don’t give an ex-inmate the option of crime, let’s get them reintegrated into society faster. Dating a person who has also been in the system could be a faster way to achieve that. To matchmake both entities, we need to consider their peculiar dating interests. The more data we have for these interests, the more we can give the perfect match. Usually, when building a social tool that involves complex relationships amongst entities, it is recommended to use a graph database such as RedisGraph. We may explore this later as we progress. But not to complicate things, for now, we would rather store these interests coming from various Omni-channels such as social media, sms, online forms, text, etc. in JSON. Often, this is the first step of the data analysis process known as data collection.

In data analysis, the data collection phase involves collecting data from various channels as unrestrictive as possible to be able to make inferences and visualize data patterns. We would be studying these data collected in JSON to detect patterns which would then inform our functional requirements for our dating tool. You don’t want to build what is not going to be useful, you know. A beautiful way in collecting this kind of data across manual, automated, and semi-automated systems is by using JSON.

What is JSON and Why Store data in JSON?

The JavaScript Object Notation (JSON) standard is a standard for transferring multiple data structures among applications and systems. And it is very popular among developers. The name “Jason” is not even half as popular with this group of people. While you are thinking about what made this JSON data representation standard so common, and why it is known to be the de-facto standard for REST API and many other API standard alternatives, let’s try to see for ourselves with our dating use case.

A Perfect Data Store for Our Use-Case

The various data sources of interest for the matchmaking app may include gender, race, sexual orientation, date of birth, correctional center, years served and because of more peculiar needs, this data may not have to follow a strict schema. For instance, some data dimensions such as social media handles may be compulsory if ingesting this data from social media but not compulsory for someone trying to matchmake via a text platform.

Therefore, a database that does not force schema on us is suitable. And a data format that would suit well and be fast in transferability of data across systems would be useful. And JSON fits well for that use-case with little complexities. Asides from this, the data format is great for adding metadata to each data item as in the case of dating. For extra information on each data component, metadata could be added for more granularity of the interests. Storing data as JSON is not only great for temporary needs, but we can also have a much more permanent store of this JSON data. This is one type of document database. There are 2 types of document databases (non-relational databases that store data as a collection of documents). NoSQL databases are the first types that are non-relational, but the documents can be queried in a declarative manner, and the second type are JSON document databases which stores data non-relationally as JSON. And since we have seen how awesome JSON is, we sure are adopting the JSON document database.

RedisJSON

By far, RedisJSON is the best JSON document database out there. Yeah! RedisJSON is fast as a bolt! On storing JSON data, it is super easy. In querying JSON data, it provides a myriad of opportunities for complex queries. The whole setup is a breeze and follows some of the best DevOps standards. With docker, you can get it up and running in seconds. You can have it on-premise or even on the most popular cloud platforms including RedisCloud. Faster writes! Master might! Low latency!

Store Data in RedisJSON

At this point, we have our data being collated from various sources into JSON. An online form has been advertised to returning inmates and the filled form gets the data in JSON, some are sending text messages, others are communicating via social media, and all are being converted to JSON data. Even the Prison Warden is waiting to be hooked up with one of the returnees that share interests from the received text.

How do we then store these JSON documents to RedisJSON? For me, I love the fastest route. I create a free Redis Enterprise Cloud account. Once you click on “Get Started”, you will receive an email with a link to activate your account and complete your signup process. I select my preferred cloud Vendor, and then a database is created for my enterprise automatically as seen below.

Olufemi Redis Database

Guess what? I also have RedisJSON coming out of the box. As you can see, RedisJSON is one module out of the several extensions of Redis known as Redis Stack. For a list of other services provided by Redis Stack, visit Redis Stack. You can also check the installation guide on other methods asides the RedisCloud.

Redis Extensions

To be honest, how fast was that? Why don’t we add some comfort to the speed? You would need to interact and see visualizations of your newly created database even from your local computer. Provisions of that and more are made available via RedisInsight.

Download RedisInsight v2 on your local system from this link and you should have the below. Add the database with your cloud details:

Redis Insight

Worked! We can see our database setup.

Redis Insight Database Showcase

Click on the database. And on the left-side bar of the next page, click the pencil icon for workbench. Let’s run some commands:

Let’s assume we are ingesting a returning inmate’s interest from a text message converter that says specify height, sexual orientation, body size and correctional center separated by whitespaces. We can decide to store it like this:

JSON.SET criteria .  ' "6ft Bi Muscular Michigan" '
Enter fullscreen mode Exit fullscreen mode

And if we get OK as the result as seen below, it has been stored.

Result:

OK
Enter fullscreen mode Exit fullscreen mode

This is called a Scalar storage, which simply means what is being stored is a string of characters.

To insert the data by Object Storage which rather takes it as a JSON object, we write this command:

JSON.SET criteria_object $ '{ "criteria": { "height": "6ft", "sexual_orientation": Bi,"body_size": muscular,  ,"correctional_center": Michigan }  } '
Enter fullscreen mode Exit fullscreen mode

And if we get OK as the result as seen below, we are good to go.

Result:

OK
Enter fullscreen mode Exit fullscreen mode

Another kind of storage, stores an array of JSON objects(multiple information):

JSON.SET criteria_array .  '{"criteria":[         {"height":"6ft", "sexual_orientation":"asexual", "age":20},         
{"height":"4ft", "sexual_orientation":":"straight", "age":28},       
{"height":"3ft", "sexual_orientation":":"lesbian", "age":63},         
{"height":"5ft", "sexual_orientation":":"bi", "age":41}    ]}   '
Enter fullscreen mode Exit fullscreen mode

And if we get OK as the result as seen below, we are good to go.

Result:

OK
Enter fullscreen mode Exit fullscreen mode

And if we go to our RedisInsight dashboard, we can see that we have this data stored up for our use.

For the next tutorials, we would see how we can set this data into RedisJSON by building an online form, querying the data dimensions for the different sets of match criteria, and probably prepping up for another brilliant tool- RediSearch!

Let’s get this project interesting!!!! Suggest contents for datasets on the comment box below and criteria for matching.

This post is in collaboration with Redis.

You can check the following references for ideas:

Top comments (12)

Collapse
 
alexjohnson90 profile image
alexjohnson90

I recently read an eye-opening article that truly changed my perspective on online dating. It was about the victoria club dating site and how it helps people find meaningful connections. The article, Victoriyaclub Review: How Can You Find Love Online?, gave me a new understanding of how dating platforms can bring people together in profound ways.

This resonates with the idea behind your post about a dating tool for returning inmates. Just as the Victoria Club dating site helps individuals navigate the complexities of finding love online, a specialized tool for returning inmates could provide much-needed support and hope for building new relationships and reintegrating into society. It's incredible how the right resources and guidance can make such a significant impact on people's lives. Keep up the great work—it's inspiring to see such innovative solutions being developed to help others!

Collapse
 
femolacaster profile image
femolacaster

Hi @alexjohnson90 ,

The medium link to the Victoria Club Dating is broken.

And yes I agree with you. It's a hard time for that niche of people to find love. Funny how something as simple as dating can prevent them from going back to crime.

Check out my new article: dev.to/femolacaster/the-beans-pick...

Collapse
 
erinposting profile image
Erin Bensinger

The JavaScript Object Notation (JSON) standard is a standard for transferring multiple data structures among applications and systems. And it is very popular among developers. The name “Jason” is not even half as popular with this group of people.

Very funny and insightful point! Great post, keep up the good work ✨

Collapse
 
femolacaster profile image
femolacaster

Thank you, Erin.

Collapse
 
mfolarin profile image
Folarin Martins

An interesting read, and nice use case too. Can we look into writing queries on the JSON documents especially complex ones in the next tutorial? I think I'd give this a try.

Collapse
 
femolacaster profile image
femolacaster

Thank you. Yes. Sure.

Collapse
 
dachid profile image
dachid

Interesting Use Case. Great post!

Collapse
 
femolacaster profile image
femolacaster

Thank you, Dachid.

Collapse
 
akoladesam profile image
Akolade Ayeni

I never knew Redis had a JSON document data store. Great thread! I am following.

Collapse
 
femolacaster profile image
femolacaster

Yes. RedisJSON is a powerful data store. You should check it out. Thank you, Akolade.

Collapse
 
claudejeandarm profile image
ClaudeJeanDarm

Thank you for this explanation of how returning customers on dating apps work. I remember that in my earlier days I even wanted to create such an app for myself. Just because I was single and all the existing websites just didn't meet my expectations! A while later, one of my colleagues in the office dropped the word about Together dating site and that she found her soulmate exactly on that platform. So I registered there and stayed. And eventually forgot this idea of building my own app, that I was obsessed with.

Collapse
 
alexjohnson90 profile image
alexjohnson90

I recently read an eye-opening article that truly changed my perspective on online dating. It was about the victoria club dating site and how it helps people find meaningful connections. The article, Victoriyaclub Review: How Can You Find Love Online?, gave me a new understanding of how dating platforms can bring people together in profound ways.

This resonates with the idea behind your post about a dating tool for returning inmates. Just as the Victoria Club dating site helps individuals navigate the complexities of finding love online, a specialized tool for returning inmates could provide much-needed support and hope for building new relationships and reintegrating into society. It's incredible how the right resources and guidance can make such a significant impact on people's lives. Keep up the great work—it's inspiring to see such innovative solutions being developed to help others!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.