It is an authorization service used by users to request access(read permissions) on resources owned by other users. It is a grpc service instead of an api-only rails app.
Use these commands to setup environment for raseed.
rvm install 2.3.2
rvm gemset create stamp
rvm use 2.3.2@stamp
git clone git@github.com:ravilakhotia2006/stamp.git
cd stamp && bundle install
We are using protocol buffer message format to create grpc service interface. Protocol buffers have strict type bindings and are backward compatible.
Request and response of respective rpc methods can be seen in proto file
- User has many medical records and a medical record can have many precriptions
- ResourMapping maintains accessing user id, resource owner id , medical record ids and the current status
Individual Api documentation is in the respective service files.
Flow for user requesting access for records:
- Api from app/web to monolith webapp requesting access
- monolith app to service(delegating the task to micro service)
- check if user(resource owner) has already given permission to read to the accessing_user (via some pre defined settings on the app itself)
- if already given access then return ‘access granted’ or return ‘access has been requested from user’
- send async call to user(resource_owner) via push notification / sms / email requesting access.
- user(resource_owner) responds to the request - api to monolith app
- response delegated to service
- response is saved and acknowledgment to user(resource_owner) is sent
- async event from service is triggered for intimation to user(accessing_user) regarding user response.
apart from setup, you only need to set DATABASE_URL for the the service to work.
export DATABASE_URL=postgres://user:password@host:port/database_name
bundle exec ruby lib/grpc_server.rb
This will start the server at 0.0.0.0:50052 and will be ready to accept request
grpc_tools_ruby_protoc -I lib/proto --ruby_out=lib/ --grpc_out=lib/ lib/proto/resource.proto
will be updating...