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!!

Monday, 2 June 2014

Pilgrimage To Mt Kailash & Manasarovar

This is a guest post by D.V. Kulkarni, who had visited Kailash Manasarovar once in 2011 and is visiting the same in August 2014 via Uttarakhand through MEA conducted tour.




OM NAMAH SHIVAYA

In Sep 2009, I attended a talk about yatra to Mt Kailash & Manasarovar. Somewhere deep within me, I had the desire to undertake this yatra but this desire had been castled in the hustle-bustle of this mayic world. This talk ignited the spark in me and I decided to go on this pilgrimage. In 2010, somehow, my plan of visiting this holy place fizzled out. Finally in 2011, my dream materialized. I booked for yatra through one of the Tours & Travels. 

I started preparation for the yatra in earnest. I had developed many irritating & pain-giving problems due to the hectic and over-stressed life after retirement. As the due date- 08 Jun 2011- of departure started approaching, I started having different acute problems. Probably, these were the tests to judge my resolve. Anyway, I remained undeterred. I did not have to make many purchases, but to take out the things which were not being used. One of the items was my pair of old leather hand-gloves which was purchased in 1980 for the MC-ride to McLeodganj in HP. This area is inhabitated by Tibetans. Now I was going to use the same gloves for visiting Tibet!

We, 12 pilgrims, left Nashik on 08th Jun and reached Tribhuvan International Airport of Kathmandu at 1500 h on 09th. We were accommodated in the hotel Marshyangdi (It is the name of a river in Nepal.) in Thamel- a popular tourist hub. In the evening we had detailed briefing by the proprietor of Samrat Tours & Travels Pvt Ltd who was associate travel agent to organize the yatra. The other group of 30 pilgrims from Bangalore also joined Samrat Tours. So ours was the group of total 42 pilgrims.

10th Jun was free for us. I took this opportunity to take one-hour ‘Mountain Flight’, in the morning, in 19-seater aircraft of Buddha Air. Every passenger was called in the cockpit, turn by turn, and was shown different mountain peaks including Mt Everest, Gaurishanker & Shisha Pangma. One gets to see the Himalayan landscape and glaciers during the flight and, of course, a beautiful aerial view of Kathmandu. Buddha Air gave us a photograph of Mt Everest which had the slogan: “I did not climb Mt Everest… but touched it with my heart!”

Later we visited different temples of Kathmandu- Pashupatinath, Budhanilkantha (Sleeping Vishnu) & Swoyambhunath Stupa. Lastly we made last-minute purchases for the trip. I purchased ‘paanchhu’- a type of rain-coat- which proved its immense utility in this trip.

On 11th Jun at 0400 h, we had bath and then assembled for prayer. In fact from now onwards wherever we stopped overnight, we always had prayer meetings every morning before embarking on further journey. We got into buses which took us to border town Kodari through the university town of Dhulikhel. After crossing ‘Friendship Bridge’ we were in Tibet (Controlled by China) where we had to undergo security checks & immigration formalities. One peculiar aspect is that, Chinese do not stamp or sign on the passport! Here we got Chinese currency- 1Yuan for Rs 7.3! Here Shanghai Standard Time is in force which is 2 h 45 min ahead of IST. We were allotted vehicles- Toyota Land Cruisers 4500, 4-wheel drive- for onward journey. These allotted vehicles were to remain with us throughout our trip. These vehicles and drivers belonged to some company in Lhasa. Our driver was a happy-go-lucky, energetic, any-music-loving Tibetan whose understanding of Hindi was restricted to “chalo, chalo!” Each vehicle would carry four pilgrims along with back-packs and a Sherpa. These Sherpas were arranged by Samrat Tours & Travels Pvt Ltd. These Sherpas are extraordinary hard workers who never seem to get tired even at high altitudes. As soon as we would reach a place, while we were recouping, these Sherpas would go about putting up kitchen tent, preparing tea and meals. Without them this expedition would have been impossible. We were given one Chinese guide for our convoy. In the evening we reached Nyalam, 12375 ft. Beyond this place one does not see the tree. In pre-yatra briefing, we were told to avoid getting cut or bruised which might not heal quickly & cause discomfort. I kept on brooding over this piece of advice. And lo! My finger was cut seriously while doing shaving in Nyalam. Law of Attraction!

From here onwards we were given half a Diamox tablet twice daily to prevent HAPE. These tablets make urinate more. Also diabetic patients have to be careful as these reduce sugar level. Next day, i.e. 12th Jun was spent in acclimatization. I kept myself busy in walking & hill-climbing. This was the first place where people started losing tempers on flimsy grounds- high altitude effect! From here onwards, numerous other effects of high altitude started manifesting- insomnia, lack of appetite, headache, breathlessness, stomach-ache, loose motions, vomiting & high BP. I was lucky enough not to have any of these effects- thanks to my training! On 13th Jun we reached New Dongba. During our journey, we saw yaks grazing here & there. Yak is the kamdhenu of these people. I saw people playing snooker in cold windy conditions. It is mystery as to how this game took roots in this part of world! 

On 14th we reached Harshu on the bank of Manasarovar, 14950 ft. As per earlier plan we were supposed to have two overnight halts at Saga & Paryang. Change in travel plan gave us two-day stopover at Manasarovar! Blessing in disguise!! This was the place where we got first darshan of Mt Kailash. Fulfillment of long-cherished desire! Unbelievable!! Words fail to describe emotions. Some were prostrated, some were awe-struck, and some were mesmerized. I had tears in my eyes- tears of peace & bliss. Most of us took holy dip in the lake. After taking holy dip, I offered oblation to my ancestors. With the dip in lake, I developed cough which remained with me throughout the rest of my yatra!

Manasarovar is the highest freshwater lake in the world. It is relatively round in shape with a circumference of 88 km. Its depth is 90 m (300 ft) and its surface area is 320 sq km. To the West of Lake Manasarovar is Lake Rakshas Tal. Four legendary rivers originate from this region: (i) Indus also called ‘Sindhu’; (ii) Brahmaputra, Yarlung Tsang-po; (iii) Sutlej; and (iv) Karnali- Ghaghara- largest tributary to the Ganges. So this region is the hydrographic nexus of the Himalaya. As per Hindu theology, Lake Manasarovar is a personification of purity, and one who drinks water from the lake will go to the Abode of Lord Shiva after death. Bathing in the Manasarovar is believed to cleanse all sins committed over even a hundred lifetimes. The lake has a few monasteries on its shores. Gurla Mandhata mountain range nearby gives majestic view.

We stayed in tents. At midnight I came out of tent to urinate and saw that the sky was absolutely clear with moon & stars shining to their glory. Again after a few hours I was compelled to come out of the tent. Now the sky was full of black clouds. High up on the horizon, in the direction of lake, I saw a series of 8-10 bright lights. I tried to analyze the scene; but was beyond my comprehension. Shivering cold forced me to return back to the tent. Next day, i.e. on 15th Jun, I decided to have ‘fast’. I got ready; informed other members and went for walk along the bank of Sarovar. Weather was extremely cold. Walking kept me warm. Weather started to change; sky was getting clear. I sat on a mound for meditation. Experienced absolute peace! Tranquility!! Now it was pretty hot. I collected stones as souvenirs from the bank of Sarovar and returned back to our camping area where havan was going on. In the afternoon, I took all my rudraksha (Rudra means Lord Shiva & Aksha means eye) malas- prayer rosaries- and went to the Lake. I sanctified them by dipping them in the Lake.


Next day, i.e. on 16th Jun, we left for Darchen, 15100 ft. On the way, our group did puja on the bank of Manasarovar. We collected holy water from the Lake. Later, when on move to Darchen, we had close look at Rakshas Tal. The water of this lake is never drunk as it is considered inauspicious. We reached Darchen at 1500 h. Immediately we all went to Ashtapad, meaning eight steps, the place where first Jain Tirthankara Rishabhadev attained nirvana. This place gives a beautiful close view of Mt Kailash. One of our vehicles got stuck in the snow and it took 3 h to clear it. So we could not spend much time here.

On 17th Jun, after having breakfast, we were taken to Yama Dwar by our allotted vehicles. Yama Dwar is a stupa with a doorway in between. Passing through this Dwar, it is believed, is passing from one world to another- a sort of rebirth. Also, going through this Dwar is supposed to remove fear of death. Here we were given walking-sticks which are pretty useful in mountains. This is the start point for trekking around Mt Kailash- known by Buddhists as kora, or outer parikrama. After completing 13 koras one is eligible for inner parikrama called nangkor. Pilgrims of several religions believe that circumambulating Mt Kailash on foot is a holy ritual that will bring good fortune. Parikrama around the holy mountain can also be done on pony or yak. One can engage porter to carry back-pack. I decided to do the kora on foot without a porter. I saw some perform the circumambulation by making full body prostrations (Kyangcha) the entire way. It takes at least four weeks of physical endurance to complete the parikrama. Amazing faith & devotion!    
     
First stretch of about 10 km, takes one to Dirapuk Gompa, 16236 ft where we had night halt. The second stretch of trek of about 22 km is the toughest one. The track passes through the highest point, Dolma La, 18600 ft. Just before the pass, is the Ganesh Kund. Dolma La belongs to Devi Parvati and is an important point of worship. Many a pilgrims sacrifice their prized possessions here. This point is considered as the point of spiritual renaissance. After the pass, is Gauri Kund- bathing place for Goddess Gauri. This is the setting for Lord Ganesha acquiring elephant head. On this leg of our parikrama, we encountered rains & snow.The stretch took us to Zutulpuk Gompa, 15825 ft, for night halt. The last stretch of parikrama of three hours is the easiest one in which one returns back to Darchen. After having lunch here, we immediately embarked on return trip in which we had night halts at Saga & Zangmu. Zangmu, on Tibetan side, 7 km from Friendship Bridge, reminded me of Gangtok. On 22 Jun, we returned back to Kathmandu.

On 23rd Jun, we visited temple of Manakamana Devi, believed to bless her devotees by fulfilling their wishes. It is located on the banks of Trishuli river, 105 km from Kathmandu. One reaches the temple by Cable Car. During the journey & at the Temple, one gets spectacular views of deep valleys, terraced fields and snow-capped mountain ranges.  On return journey to Kathmandu, we encountered landslide which blocked and delayed us by about three hours. As such we could not go to Pashupatinath Temple for Thanks Giving, as was planned earlier. I was feeling extremely upset for missing the last darshan  of Pashupatinath. But lo! Next day- the day of leaving Kathmandu- our flight to Mumbai was delayed by two hours. And  so we could fulfill our desire of visiting Pashupatinath! 


Before the commencement of yatra I had pondered a lot as to what important thing, which affects my life the most, be sacrificed on this pilgrimage! I could not come to any conclusion. So I left this thought. On the last day of the trip, while on visit to Manakamana Temple, I lost my specks. Without specks my activities become restricted. I was upset with my forgetfulness. It struck me that it was the most indispensable thing in my life! I was forced to sacrifice it on this pilgrimage!


Throughout the vehicular journey, road is smooth, black-topped except a few km stretch between Nyalam & Saga. Everywhere the living accommodation was good but toilet-facilities were very primitive. Hotel accommodation in Zangmu was the best in the entire tour.

Pilgrimage to the great sacred Mt Kailash & Manasarovar is a life-changing experience and an opportunity to view some of the most magical scenery. It is a place of Himalayan utopia- SHANGRI-LA. The entire area echoes with spiritual vibrations. Even the agnostics shall change their beliefs amidst that fathomless serenity. One has to experience it. Mt Kailash is treated as a place of eternal bliss. Shiva is the Lord of Yoga. Here He is sitting in a state of perpetual meditation along with his wife, Parvati. I saw people always helping others. Here one realizes that ‘love’ is the essence of life. Though terrain and weather are treacherous; the effect of low temperature is worsened by wind-chill factor; still it is worth visiting this venerated place. What is required is strong desire & bit of willpower !

***