Thursday, 2 April 2015

Design of Commenting System

This blog describes the design of commenting functionality in an application, through which clinicians can communicate and store notes/comments about a wound/ patient. This includes database design as well as REST API documentation for commenting feature.

Database Design/ER diagram to store data related to comments:
 

Tables Schemas

  • Wound Table: This table has data related to wound/patient.
  • Conversation Table: This table stores the comment thread for a wound.
  • Conversation_message Table: This table stores the individual comment in any comment's thread.
  • User Table: This table contains information about the users who can access the system e.g. Doctor, nurse.
  • Conversation_has_user Table: This is a mapping table between conversation and user.
  • Notification Table: This table contains notifications for a user. Flag is_read is used to indicate whether a notification is read or unread.

Tagging of users in a comment:

This commenting application supports tagging/inviting users in a comment. We can store the message containing user_id in the following form:
some text {{user_id}} more text.
The application logic can resolve {{user_id}} and send notifications accordingly.

Using Links in a comment:

Users can send YouTube links or search results in the comment.

We can handle it in the same way we embed users in the message using expression language - {{youtube_link}} or {{search_link}}

UI layer should have the logic to resolve these expressions and create a preview wherever possible.
 
REST API Documentation

REST APIs provide access to resources (data entities) via URI paths using JSON as its communication format, and the standard HTTP methods.

APIs for Comments

GET /wounds/{wound_id}/comments
Request

Meaning
To get comments for a Wound
HTTP Method
GET
URI
/wounds/{wound_id}/comments

Path Params

Name
Required
Default
Type
wound_id
Y

int

Response
Status
Response
200
application/json (list of comments)
404
{“error” : “Comment doesn’t exist.”}

POST /wounds/{wound_id}/comments
Request

Meaning
To post comment for a Wound
HTTP Method
POST
URI
/wounds/{wound_id}/comments

Path Params
Name
Required
Default
Type
wound_id
Y

int


Message Body
{
“comment” : “message typed by the user”
}

Response

Status
Response
200
application/json (comment posted successfully.)
400
{“error” : “Failed to post the comment.”}


PUT /wounds/{wound_id}/comments/{comment_id}
Request
Meaning
To edit/update comment for a Wound
HTTP Method
PUT
URI
/wounds/{wound_id}/comments/{comment_id}

Path Params

Name
Required
Default
Type
wound_id
Y

int
comment_id
Y

int

Message Body
{
“comment” : “message typed by the user”
}

Response

Status
Response
200
application/json (comment updated successfully.)
400
{“error” : “Failed to update the comment.”}


APIs for notifications

GET /users/{user_id}/notifications
Request
Meaning
To get notifications for a user
HTTP Method
GET
URI
/users/{user_id}/notifications
 
Path Params
Name
Required
Default
Type
user_id
Y

int

Response

Status
Response
200
application/json (list of notifications for a user with each notification containing read/unread flag)
404
{“error” : “Notifications do not exist.”}


POST /users/{user_id}/notifications
Request

Meaning
To  create notification for a user.
HTTP Method
POST
URI
/users/{user_id}/notifications

Path Params

Name
Required
Default
Type
user_id
Y

int

Response
Status
Response
200
application/json (notification created successfully.)
400
{“error” : “Failed to create the notification.”}


Note : Message containing user_id is stored in the following form: “some text {{user_id}} more text”. The application logic can resolve {{user_id}} and send notifications accordingly.


PUT /users/{user_id}/notifications/{notification_id}
Request

Meaning
To mark a notification as read or unread.
HTTP Method
PUT
URI
/users/{user_id}/notifications/{notification_id}

Path Params
 
Name
Required
Default
Type
user_id
Y

int
notification_id
Y

int

Message Body
{
“is_read” : true
}


Response

Status
Response
200
application/json (notification marked read successfully.)
400
{“error” : “Failed to mark the notification as read.”}

Wednesday, 14 January 2015

[RESTFiddle] 100+ Weekly Downloads

We are proud to announce that RESTFiddle is having 100+ downloads per week. 
We are striving hard to give you better user experience and more functionality. We are about to release the next version of RESTFiddle. We would like to thank all the RESTFiddle enthusiasts to keep us motivated in improving this platform. 
Stay tuned...

Wednesday, 7 January 2015

Introducing API Builder

Create API with a click and run it on the fly.

You can create an entity by clicking on New Entity option in the second column. id, createdDate and lastModifiedDate are the fields created by the system.


Once the entity gets created, its services are generated and populated in the tree as shown:


Click on the Create service to add new data of the entity.



You can fetch all the data created by running the Get List service of the entity.


Monday, 5 January 2015

Friday, 2 January 2015

WebSocket support in RESTFiddle



For more details visit : http://www.restfiddle.com/

Tuesday, 30 December 2014

Tuesday, 19 August 2014

Do Analog Input Devices Really Need Replacement?

I wanted to watch TED talks on my TV instead of laptop. The only way I knew was by downloading the youtube video, copying it in a USB drive and inserting that drive in USB/CD player. I was not ready to take the extra steps- time consuming and tedious! When I inquired about laptop to TV converter, most of the folks suggested me to change TV. "No one uses CRT TV these days. Change your TV. New models can directly connect to laptop." Technology will keep evolving, so there must be some way out I assumed. Also the output ports of laptops keep changing every few years.

I started on the mission to connect my laptop's HDMI port to TV's RCA input despite the fact that I'm not a hardware person or a technician. When I searched on online stores I got HDMI to RCA cable. Happiness unlimited! Just when I was about to order the cable I thought of checking out what these input/output types are. Here is what wikipedia gave me-

HDMI:
HDMI (High-Definition Multimedia Interface) is a compact audio/video interface for transferring uncompressed video data and compressed or uncompressed digital audio data from an HDMI-compliant source device.

RCA:
RCA plugs for composite analog video (yellow) and analog audio (white and red).

Logically speaking- how can a simple cable convert digital output into analog input? Clearly I needed a converter. I searched for converters in online stores and in shops. What I got was disappointment! I learnt about an electronics market at a distance. I went and started asking for converter. Finally one shopkeeper showed me a converter box. But there was no way to test it. None of those shops had laptops! Yes, they did have CRT TVs. This was what was written on the box:
So I got a HDMI cable and a RCA cable to complete the setup....everything without guarantee, warranty and no-return policy! I was investing INR 1600 without testing. Risk. I returned home and completed the connection setup. 


All I could see was multi-coloured strips on TV. Switching off the converter blanked out the TV screen- the only means which indicated that TV is taking the converter as its input. Couple of days passed by with no luck. Finally one morning I made the connections first and then started my laptop. Voila! Laptop screen was getting replicated on TV. However I could hear audio only from laptop. Tried with Mac. Again only video, no audio from TV.

Again couple of days passed by. And I discovered Win + P shortcut for projecting. Choose "Second screen only".....And there you hear audio from your television.

Hoping to know Win + P magic for Mac, so that I can connect Mac to TV!!

Saturday, 24 May 2014

Top open source projects in Java

Here is what GitHub says (I am surprised to see Spring at #10):
https://github.com/search?l=Java&o=desc&q=stars%3A%3E0&ref=advsearch&s=&type=Repositories