SlideShare a Scribd company logo
AngularJS & REST Web Services
#OMRS15
Darius Jazayeri
darius@openmrs.org
djazayeri@thoughtworks.com
Download this...
● Download the Postman Chrome app
● https://www.getpostman.com/
● We'll use it shortly
REST
● REST = Representational State Transfer
● the software architectural style of the World Wide Web
● Levels of maturity
– “just add a REST API on top of it”
– Hypermedia as the engine of application state (HATEOAS)
– http://martinfowler.com/articles/richardsonMaturityModel.html
● Using HTTP to interact with the server in a constrained
machine-friendly way
● Constraints allow for scalability via standard web
technologies (stateless, cacheable, layered)
REST concepts
● Resource
– URI that addresses a collection or item in the system
– e.g. http://…/patient or http://…/patient/abc123
● Representation
– Specific state of the application. Based on one of these a client
can change application state
– Typically JSON or XML
● Hyperlinks
– what client can do from a given state
– e.g. {"rel": "next", "uri": "http://.../concept?startIndex=50"}
REST in OpenMRS
● Started in 2011
● Level 2 on the Richardson Maturity Model
– http://martinfowler.com/articles/richardsonMaturityModel.html
● RESTful CRUD access to the OpenMRS
platform data model
● We would like to be REST-first, but we're not
there yet. This is still second-class to our Java
API
REST in OpenMRS
● Documentation on the wiki at “REST Web Services
API For Clients”
– https://wiki.openmrs.org/x/P4IaAQ
– Big refresh coming in the next OpenMRS Platform release
(Swagger!)
● Basic Authentication
● Paging
● Different sized representations (ref, default, full)
– Also, custom representations
REST in OpenMRS: Let's play
● Use the Postman Chrome app (or something
else)
● http://demo.openmrs.org/openmrs/ws/rest/v1/concept
● .../concept?startIndex=50
● .../concept?q=malaria
● .../concept/CIEL:160152
● Add header… Accept: application/xml
● .../location?v=default
REST in OpenMRS: Exercise
● Create an encounter for an existing patient that
records their weight
– You will need to find a patient, look up some other
metadata, and figure out the encounter POST
format
AngularJS
●
https://angularjs.org/ (by Google)
– “HTML is great for declaring static documents, but it falters when we try to use it for declaring dynamic
views in web-applications. AngularJS lets you extend HTML vocabulary for your application. The resulting
environment is extraordinarily expressive, readable, and quick to develop.”
● Great framework for building client-side web applications
● Normally, one would build a complete app in AngularJS
– Bahmni
– OpenMRS Ebola Tablet App
● In the OpenMRS Reference Application we embed smaller AngularJS apps in a primarily-
server-side application
– but we're using AngularJS more and more
●
Clone: https://github.com/djazayeri/openmrs-module-angulartutorial
openmrs-core version 1.11.x
modules: appui, uiframework, appframework, uicommons, webservices.rest
AngularJS Concepts
● Directives
– Think of this as an “HTML tag/attribute handler”
– AngularJS code that is applied
– Built-in directives; Also write your own
● Scopes
– The dynamic thing that connects controller to view
– Directives have a $scope (sometimes inherited from a
parent, sometimes isolated)
– $rootScope
AngularJS Concepts
● Two-way data binding
– <input ng-model="myVariable" type="text"/>
– Editing the text box will update $scope.myVariable
– Setting $scope.myVariable will update the text box
● Templates
– with {{ interpolation }}
● Functions in the $scope
– <button ng-click="doSomething()">...</button>
● See example1 in the tutorial module
AngularJS Docs
● Developer Guide
– https://docs.angularjs.org/guide
● API Reference
– https://docs.angularjs.org/api
● More sophisticated: tutorial example2
AngularJS Magic
● Tutorial example3
AngularJS +/- GSP
● OpenMRS Reference Application includes a
non-standard mix of server-side GSP and
client-side AngularJS code
● Filters
– {{ visit.startDate | date }}
● tutorial example4
AngularJS + REST in OpenMRS
● Using raw $http
– Tutorial example5
● Using ngResource
– Tutorial example6
● Services in uicommons module

More Related Content

What's hot

Designing REST services with Spring MVC
Designing REST services with Spring MVCDesigning REST services with Spring MVC
Designing REST services with Spring MVC
Serhii Kartashov
 
RESTful Web Services with Spring MVC
RESTful Web Services with Spring MVCRESTful Web Services with Spring MVC
RESTful Web Services with Spring MVC
digitalsonic
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
IndicThreads
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
Munir Hoque
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Shyjal Raazi
 
Laravel + Restangular Introduction
Laravel + Restangular IntroductionLaravel + Restangular Introduction
Laravel + Restangular Introduction
Andrew Del Prete
 
Introduction to Angular JS
Introduction to Angular JSIntroduction to Angular JS
Introduction to Angular JS
Santhosh Kumar Srinivasan
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 Slides
Suraj Gupta
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
Daiwei Lu
 
Angular introduction basic
Angular introduction basicAngular introduction basic
Angular introduction basic
jagriti srivastava
 
Introduction to AJAX In WordPress
Introduction to AJAX In WordPressIntroduction to AJAX In WordPress
Introduction to AJAX In WordPress
Caldera Labs
 
Single Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJSSingle Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJS
M R Rony
 
ASP.NET MVC and ajax
ASP.NET MVC and ajax ASP.NET MVC and ajax
ASP.NET MVC and ajax
Brij Mishra
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
Amit Baghel
 
Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
samhelman
 
Ch. 11 deploying
Ch. 11 deployingCh. 11 deploying
Ch. 11 deploying
Manolis Vavalis
 
Ise312 Ec Presentation Jquery
Ise312 Ec Presentation JqueryIse312 Ec Presentation Jquery
Ise312 Ec Presentation Jquery
duygut
 
RoR 101: Session 6
RoR 101: Session 6RoR 101: Session 6
RoR 101: Session 6
Rory Gianni
 
Spring Mvc Rest
Spring Mvc RestSpring Mvc Rest
Spring Mvc Rest
Craig Walls
 

What's hot (19)

Designing REST services with Spring MVC
Designing REST services with Spring MVCDesigning REST services with Spring MVC
Designing REST services with Spring MVC
 
RESTful Web Services with Spring MVC
RESTful Web Services with Spring MVCRESTful Web Services with Spring MVC
RESTful Web Services with Spring MVC
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
 
Angular js for beginners
Angular js for beginnersAngular js for beginners
Angular js for beginners
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Laravel + Restangular Introduction
Laravel + Restangular IntroductionLaravel + Restangular Introduction
Laravel + Restangular Introduction
 
Introduction to Angular JS
Introduction to Angular JSIntroduction to Angular JS
Introduction to Angular JS
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 Slides
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
 
Angular introduction basic
Angular introduction basicAngular introduction basic
Angular introduction basic
 
Introduction to AJAX In WordPress
Introduction to AJAX In WordPressIntroduction to AJAX In WordPress
Introduction to AJAX In WordPress
 
Single Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJSSingle Page Application (SPA) using AngularJS
Single Page Application (SPA) using AngularJS
 
ASP.NET MVC and ajax
ASP.NET MVC and ajax ASP.NET MVC and ajax
ASP.NET MVC and ajax
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
 
Ch. 11 deploying
Ch. 11 deployingCh. 11 deploying
Ch. 11 deploying
 
Ise312 Ec Presentation Jquery
Ise312 Ec Presentation JqueryIse312 Ec Presentation Jquery
Ise312 Ec Presentation Jquery
 
RoR 101: Session 6
RoR 101: Session 6RoR 101: Session 6
RoR 101: Session 6
 
Spring Mvc Rest
Spring Mvc RestSpring Mvc Rest
Spring Mvc Rest
 

Viewers also liked

OpenMRS: htmlforms
OpenMRS: htmlformsOpenMRS: htmlforms
OpenMRS: htmlforms
lnball
 
What Is Open M R S
What Is  Open M R SWhat Is  Open M R S
What Is Open M R S
hamishfraser
 
OpenMRS Reference Application, Getting Started
OpenMRS Reference Application, Getting StartedOpenMRS Reference Application, Getting Started
OpenMRS Reference Application, Getting Started
djazayeri
 
Openmrs Use Examples PPT
Openmrs Use Examples PPTOpenmrs Use Examples PPT
Openmrs Use Examples PPT
djazayeri
 
OpenMRS Concept Management Tutorial
OpenMRS Concept Management TutorialOpenMRS Concept Management Tutorial
OpenMRS Concept Management Tutorial
lnball
 
BE/ ME / MTech / BTech Computer Engineering Project titles IEEE 2014 IEEE 2015
BE/ ME / MTech / BTech Computer Engineering Project titles IEEE 2014 IEEE 2015BE/ ME / MTech / BTech Computer Engineering Project titles IEEE 2014 IEEE 2015
BE/ ME / MTech / BTech Computer Engineering Project titles IEEE 2014 IEEE 2015
Adz91 Digital Ads Pvt Ltd
 
Darius Open Mrs Examples
Darius Open Mrs ExamplesDarius Open Mrs Examples
Darius Open Mrs Examples
hamishfraser
 
Health IT and OpenMRS
Health IT and OpenMRSHealth IT and OpenMRS
Health IT and OpenMRS
Saptarshi Purkayastha
 
OpenMRS Meeting Boston, Introduction
OpenMRS Meeting Boston, IntroductionOpenMRS Meeting Boston, Introduction
OpenMRS Meeting Boston, Introduction
hamishfraser
 
FOSS Asia 2016 - OpenMRS networks for networks
FOSS Asia 2016 - OpenMRS networks for networksFOSS Asia 2016 - OpenMRS networks for networks
FOSS Asia 2016 - OpenMRS networks for networks
Saptarshi Purkayastha
 
Cover front and back for leadership asg
Cover front and back for leadership asgCover front and back for leadership asg
Cover front and back for leadership asg
Sokunthea So
 
OpenMRS Concept Management Tutorial (addendum)
OpenMRS Concept Management Tutorial (addendum)OpenMRS Concept Management Tutorial (addendum)
OpenMRS Concept Management Tutorial (addendum)
lnball
 
OpenMRS Presentation
OpenMRS PresentationOpenMRS Presentation
OpenMRS Presentation
AnnieLGCI
 
OpenMRS presentation, part of Google Code-In 2015
OpenMRS presentation, part of Google Code-In 2015 OpenMRS presentation, part of Google Code-In 2015
OpenMRS presentation, part of Google Code-In 2015
Ioana-Andreea Berdei
 
MVP Open Mrs Update 052609
MVP Open Mrs Update 052609MVP Open Mrs Update 052609
MVP Open Mrs Update 052609
hamishfraser
 
Seebregts Omrs Oasis Boston May09
Seebregts Omrs Oasis Boston May09Seebregts Omrs Oasis Boston May09
Seebregts Omrs Oasis Boston May09
hamishfraser
 
Open MRS
Open MRSOpen MRS
Open MRS
Shriman Visahan
 
OpenMRS presentation
OpenMRS presentationOpenMRS presentation
OpenMRS presentation
Sarthak Gulati
 
The open mrs hl7query module
The open mrs hl7query moduleThe open mrs hl7query module
The open mrs hl7query module
Suranga Nath Kasthurirathne
 
Open Mrs Vision 2
Open Mrs Vision 2Open Mrs Vision 2
Open Mrs Vision 2
hamishfraser
 

Viewers also liked (20)

OpenMRS: htmlforms
OpenMRS: htmlformsOpenMRS: htmlforms
OpenMRS: htmlforms
 
What Is Open M R S
What Is  Open M R SWhat Is  Open M R S
What Is Open M R S
 
OpenMRS Reference Application, Getting Started
OpenMRS Reference Application, Getting StartedOpenMRS Reference Application, Getting Started
OpenMRS Reference Application, Getting Started
 
Openmrs Use Examples PPT
Openmrs Use Examples PPTOpenmrs Use Examples PPT
Openmrs Use Examples PPT
 
OpenMRS Concept Management Tutorial
OpenMRS Concept Management TutorialOpenMRS Concept Management Tutorial
OpenMRS Concept Management Tutorial
 
BE/ ME / MTech / BTech Computer Engineering Project titles IEEE 2014 IEEE 2015
BE/ ME / MTech / BTech Computer Engineering Project titles IEEE 2014 IEEE 2015BE/ ME / MTech / BTech Computer Engineering Project titles IEEE 2014 IEEE 2015
BE/ ME / MTech / BTech Computer Engineering Project titles IEEE 2014 IEEE 2015
 
Darius Open Mrs Examples
Darius Open Mrs ExamplesDarius Open Mrs Examples
Darius Open Mrs Examples
 
Health IT and OpenMRS
Health IT and OpenMRSHealth IT and OpenMRS
Health IT and OpenMRS
 
OpenMRS Meeting Boston, Introduction
OpenMRS Meeting Boston, IntroductionOpenMRS Meeting Boston, Introduction
OpenMRS Meeting Boston, Introduction
 
FOSS Asia 2016 - OpenMRS networks for networks
FOSS Asia 2016 - OpenMRS networks for networksFOSS Asia 2016 - OpenMRS networks for networks
FOSS Asia 2016 - OpenMRS networks for networks
 
Cover front and back for leadership asg
Cover front and back for leadership asgCover front and back for leadership asg
Cover front and back for leadership asg
 
OpenMRS Concept Management Tutorial (addendum)
OpenMRS Concept Management Tutorial (addendum)OpenMRS Concept Management Tutorial (addendum)
OpenMRS Concept Management Tutorial (addendum)
 
OpenMRS Presentation
OpenMRS PresentationOpenMRS Presentation
OpenMRS Presentation
 
OpenMRS presentation, part of Google Code-In 2015
OpenMRS presentation, part of Google Code-In 2015 OpenMRS presentation, part of Google Code-In 2015
OpenMRS presentation, part of Google Code-In 2015
 
MVP Open Mrs Update 052609
MVP Open Mrs Update 052609MVP Open Mrs Update 052609
MVP Open Mrs Update 052609
 
Seebregts Omrs Oasis Boston May09
Seebregts Omrs Oasis Boston May09Seebregts Omrs Oasis Boston May09
Seebregts Omrs Oasis Boston May09
 
Open MRS
Open MRSOpen MRS
Open MRS
 
OpenMRS presentation
OpenMRS presentationOpenMRS presentation
OpenMRS presentation
 
The open mrs hl7query module
The open mrs hl7query moduleThe open mrs hl7query module
The open mrs hl7query module
 
Open Mrs Vision 2
Open Mrs Vision 2Open Mrs Vision 2
Open Mrs Vision 2
 

Similar to AngularJS and REST - #omrs15 tutorial

JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
Vlad Fedosov
 
Introduction to Ember.js
Introduction to Ember.jsIntroduction to Ember.js
Introduction to Ember.js
Vinoth Kumar
 
Reactjs Basics
Reactjs BasicsReactjs Basics
Reactjs Basics
Hamid Ghorbani
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
Rob Davarnia
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JSFestUA
 
What is mean stack?
What is mean stack?What is mean stack?
What is mean stack?
Rishabh Saxena
 
Top java script frameworks ppt
Top java script frameworks pptTop java script frameworks ppt
Top java script frameworks ppt
Omkarsoft Bangalore
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
ASG
 
Top 10 Javascript Frameworks For Easy Web Development
Top 10 Javascript Frameworks For Easy Web DevelopmentTop 10 Javascript Frameworks For Easy Web Development
Top 10 Javascript Frameworks For Easy Web Development
Technostacks Infotech Pvt. Ltd.
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
Prasad Narasimhan
 
Intro to AngularJS
Intro to AngularJS Intro to AngularJS
Intro to AngularJS
Sparkhound Inc.
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
Angular webinar - Credo Systemz
Angular webinar - Credo SystemzAngular webinar - Credo Systemz
Angular webinar - Credo Systemz
Training Institute
 
Modern webtechnologies
Modern webtechnologiesModern webtechnologies
Modern webtechnologies
Besjan Xhika
 
Cloud APIs Overview Tucker
Cloud APIs Overview   TuckerCloud APIs Overview   Tucker
Cloud APIs Overview Tucker
Infrastructure 2.0
 
angularjs_tutorial.docx
angularjs_tutorial.docxangularjs_tutorial.docx
angularjs_tutorial.docx
telegramvip
 
Components of a Generic Web Application Architecture
Components of  a Generic Web Application ArchitectureComponents of  a Generic Web Application Architecture
Components of a Generic Web Application Architecture
MadonnaLamin1
 
ExpressJS and REST API.pptx
ExpressJS and REST API.pptxExpressJS and REST API.pptx
ExpressJS and REST API.pptx
Govardhan Bhavani
 
6 10-presentation
6 10-presentation6 10-presentation
6 10-presentation
Remi Arnaud
 
AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)
Alex Ross
 

Similar to AngularJS and REST - #omrs15 tutorial (20)

JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
 
Introduction to Ember.js
Introduction to Ember.jsIntroduction to Ember.js
Introduction to Ember.js
 
Reactjs Basics
Reactjs BasicsReactjs Basics
Reactjs Basics
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 
What is mean stack?
What is mean stack?What is mean stack?
What is mean stack?
 
Top java script frameworks ppt
Top java script frameworks pptTop java script frameworks ppt
Top java script frameworks ppt
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
 
Top 10 Javascript Frameworks For Easy Web Development
Top 10 Javascript Frameworks For Easy Web DevelopmentTop 10 Javascript Frameworks For Easy Web Development
Top 10 Javascript Frameworks For Easy Web Development
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
 
Intro to AngularJS
Intro to AngularJS Intro to AngularJS
Intro to AngularJS
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
Angular webinar - Credo Systemz
Angular webinar - Credo SystemzAngular webinar - Credo Systemz
Angular webinar - Credo Systemz
 
Modern webtechnologies
Modern webtechnologiesModern webtechnologies
Modern webtechnologies
 
Cloud APIs Overview Tucker
Cloud APIs Overview   TuckerCloud APIs Overview   Tucker
Cloud APIs Overview Tucker
 
angularjs_tutorial.docx
angularjs_tutorial.docxangularjs_tutorial.docx
angularjs_tutorial.docx
 
Components of a Generic Web Application Architecture
Components of  a Generic Web Application ArchitectureComponents of  a Generic Web Application Architecture
Components of a Generic Web Application Architecture
 
ExpressJS and REST API.pptx
ExpressJS and REST API.pptxExpressJS and REST API.pptx
ExpressJS and REST API.pptx
 
6 10-presentation
6 10-presentation6 10-presentation
6 10-presentation
 
AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)AngularJS in Production (CTO Forum)
AngularJS in Production (CTO Forum)
 

Recently uploaded

Tips for Pet Care in winters How to take care of pets.
Tips for Pet Care in winters How to take care of pets.Tips for Pet Care in winters How to take care of pets.
Tips for Pet Care in winters How to take care of pets.
Dinesh Chauhan
 
Comprehensive Rainy Season Advisory: Safety and Preparedness Tips.pdf
Comprehensive Rainy Season Advisory: Safety and Preparedness Tips.pdfComprehensive Rainy Season Advisory: Safety and Preparedness Tips.pdf
Comprehensive Rainy Season Advisory: Safety and Preparedness Tips.pdf
Dr Rachana Gujar
 
HUMAN BRAIN.pptx.PRIYA BHOJWANI@GAMIL.COM
HUMAN BRAIN.pptx.PRIYA BHOJWANI@GAMIL.COMHUMAN BRAIN.pptx.PRIYA BHOJWANI@GAMIL.COM
HUMAN BRAIN.pptx.PRIYA BHOJWANI@GAMIL.COM
priyabhojwani1200
 
DELIRIUM BY DR JAGMOHAN PRAJAPATI.......
DELIRIUM BY DR JAGMOHAN PRAJAPATI.......DELIRIUM BY DR JAGMOHAN PRAJAPATI.......
DELIRIUM BY DR JAGMOHAN PRAJAPATI.......
DR Jag Mohan Prajapati
 
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
rightmanforbloodline
 
U Part Wigs_ A Natural Look with Minimal Effort Jokerwigs.in.pdf
U Part Wigs_ A Natural Look with Minimal Effort Jokerwigs.in.pdfU Part Wigs_ A Natural Look with Minimal Effort Jokerwigs.in.pdf
U Part Wigs_ A Natural Look with Minimal Effort Jokerwigs.in.pdf
Jokerwigs arts and craft
 
PET CT beginners Guide covers some of the underrepresented topics in PET CT
PET CT  beginners Guide  covers some of the underrepresented topics  in PET CTPET CT  beginners Guide  covers some of the underrepresented topics  in PET CT
PET CT beginners Guide covers some of the underrepresented topics in PET CT
MiadAlsulami
 
MBC Support Group for Black Women – Insights in Genetic Testing.pdf
MBC Support Group for Black Women – Insights in Genetic Testing.pdfMBC Support Group for Black Women – Insights in Genetic Testing.pdf
MBC Support Group for Black Women – Insights in Genetic Testing.pdf
bkling
 
Common Challenges in Dermatology Billing and How to Overcome.pptx
Common Challenges in Dermatology Billing and How to Overcome.pptxCommon Challenges in Dermatology Billing and How to Overcome.pptx
Common Challenges in Dermatology Billing and How to Overcome.pptx
patriciaava1998
 
Champions of Health Spotlight On Leaders Shaping Germany's Healthcare.pdf
Champions of Health Spotlight On Leaders Shaping Germany's Healthcare.pdfChampions of Health Spotlight On Leaders Shaping Germany's Healthcare.pdf
Champions of Health Spotlight On Leaders Shaping Germany's Healthcare.pdf
eurohealthleaders
 
Exploring the Benefits of Binaural Hearing: Why Two Hearing Aids Are Better T...
Exploring the Benefits of Binaural Hearing: Why Two Hearing Aids Are Better T...Exploring the Benefits of Binaural Hearing: Why Two Hearing Aids Are Better T...
Exploring the Benefits of Binaural Hearing: Why Two Hearing Aids Are Better T...
Ear Solutions (ESPL)
 
Bringing AI into a Mid-Sized Company: A structured Approach
Bringing AI into a Mid-Sized Company: A structured ApproachBringing AI into a Mid-Sized Company: A structured Approach
Bringing AI into a Mid-Sized Company: A structured Approach
Brian Frerichs
 
Luxurious Spa In Ajman Chandrima Massage Center
Luxurious Spa In Ajman Chandrima Massage CenterLuxurious Spa In Ajman Chandrima Massage Center
Luxurious Spa In Ajman Chandrima Massage Center
Chandrima Spa Ajman
 
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
gjsma0ep
 
Let's Talk About It: Breast Cancer (What is Mindset and Does it Really Matter?)
Let's Talk About It: Breast Cancer (What is Mindset and Does it Really Matter?)Let's Talk About It: Breast Cancer (What is Mindset and Does it Really Matter?)
Let's Talk About It: Breast Cancer (What is Mindset and Does it Really Matter?)
bkling
 
The Power of Superfoods and Exercise.pdf
The Power of Superfoods and Exercise.pdfThe Power of Superfoods and Exercise.pdf
The Power of Superfoods and Exercise.pdf
Dr Rachana Gujar
 
DRAFT Ventilator Rapid Reference version 2.4.pdf
DRAFT Ventilator Rapid Reference  version  2.4.pdfDRAFT Ventilator Rapid Reference  version  2.4.pdf
DRAFT Ventilator Rapid Reference version 2.4.pdf
Robert Cole
 
Can coffee help me lose weight? Yes, 25,422 users in the USA use it for that ...
Can coffee help me lose weight? Yes, 25,422 users in the USA use it for that ...Can coffee help me lose weight? Yes, 25,422 users in the USA use it for that ...
Can coffee help me lose weight? Yes, 25,422 users in the USA use it for that ...
nirahealhty
 
LGBTQ+ Adults: Unique Opportunities and Inclusive Approaches to Care
LGBTQ+ Adults: Unique Opportunities and Inclusive Approaches to CareLGBTQ+ Adults: Unique Opportunities and Inclusive Approaches to Care
LGBTQ+ Adults: Unique Opportunities and Inclusive Approaches to Care
VITASAuthor
 
chatgptfornlp-230314021506-2f03f614.pdf. 21506-2f03f614.pdf
chatgptfornlp-230314021506-2f03f614.pdf. 21506-2f03f614.pdfchatgptfornlp-230314021506-2f03f614.pdf. 21506-2f03f614.pdf
chatgptfornlp-230314021506-2f03f614.pdf. 21506-2f03f614.pdf
marynayjun112024
 

Recently uploaded (20)

Tips for Pet Care in winters How to take care of pets.
Tips for Pet Care in winters How to take care of pets.Tips for Pet Care in winters How to take care of pets.
Tips for Pet Care in winters How to take care of pets.
 
Comprehensive Rainy Season Advisory: Safety and Preparedness Tips.pdf
Comprehensive Rainy Season Advisory: Safety and Preparedness Tips.pdfComprehensive Rainy Season Advisory: Safety and Preparedness Tips.pdf
Comprehensive Rainy Season Advisory: Safety and Preparedness Tips.pdf
 
HUMAN BRAIN.pptx.PRIYA BHOJWANI@GAMIL.COM
HUMAN BRAIN.pptx.PRIYA BHOJWANI@GAMIL.COMHUMAN BRAIN.pptx.PRIYA BHOJWANI@GAMIL.COM
HUMAN BRAIN.pptx.PRIYA BHOJWANI@GAMIL.COM
 
DELIRIUM BY DR JAGMOHAN PRAJAPATI.......
DELIRIUM BY DR JAGMOHAN PRAJAPATI.......DELIRIUM BY DR JAGMOHAN PRAJAPATI.......
DELIRIUM BY DR JAGMOHAN PRAJAPATI.......
 
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
TEST BANK FOR Health Assessment in Nursing 7th Edition by Weber Chapters 1 - ...
 
U Part Wigs_ A Natural Look with Minimal Effort Jokerwigs.in.pdf
U Part Wigs_ A Natural Look with Minimal Effort Jokerwigs.in.pdfU Part Wigs_ A Natural Look with Minimal Effort Jokerwigs.in.pdf
U Part Wigs_ A Natural Look with Minimal Effort Jokerwigs.in.pdf
 
PET CT beginners Guide covers some of the underrepresented topics in PET CT
PET CT  beginners Guide  covers some of the underrepresented topics  in PET CTPET CT  beginners Guide  covers some of the underrepresented topics  in PET CT
PET CT beginners Guide covers some of the underrepresented topics in PET CT
 
MBC Support Group for Black Women – Insights in Genetic Testing.pdf
MBC Support Group for Black Women – Insights in Genetic Testing.pdfMBC Support Group for Black Women – Insights in Genetic Testing.pdf
MBC Support Group for Black Women – Insights in Genetic Testing.pdf
 
Common Challenges in Dermatology Billing and How to Overcome.pptx
Common Challenges in Dermatology Billing and How to Overcome.pptxCommon Challenges in Dermatology Billing and How to Overcome.pptx
Common Challenges in Dermatology Billing and How to Overcome.pptx
 
Champions of Health Spotlight On Leaders Shaping Germany's Healthcare.pdf
Champions of Health Spotlight On Leaders Shaping Germany's Healthcare.pdfChampions of Health Spotlight On Leaders Shaping Germany's Healthcare.pdf
Champions of Health Spotlight On Leaders Shaping Germany's Healthcare.pdf
 
Exploring the Benefits of Binaural Hearing: Why Two Hearing Aids Are Better T...
Exploring the Benefits of Binaural Hearing: Why Two Hearing Aids Are Better T...Exploring the Benefits of Binaural Hearing: Why Two Hearing Aids Are Better T...
Exploring the Benefits of Binaural Hearing: Why Two Hearing Aids Are Better T...
 
Bringing AI into a Mid-Sized Company: A structured Approach
Bringing AI into a Mid-Sized Company: A structured ApproachBringing AI into a Mid-Sized Company: A structured Approach
Bringing AI into a Mid-Sized Company: A structured Approach
 
Luxurious Spa In Ajman Chandrima Massage Center
Luxurious Spa In Ajman Chandrima Massage CenterLuxurious Spa In Ajman Chandrima Massage Center
Luxurious Spa In Ajman Chandrima Massage Center
 
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
 
Let's Talk About It: Breast Cancer (What is Mindset and Does it Really Matter?)
Let's Talk About It: Breast Cancer (What is Mindset and Does it Really Matter?)Let's Talk About It: Breast Cancer (What is Mindset and Does it Really Matter?)
Let's Talk About It: Breast Cancer (What is Mindset and Does it Really Matter?)
 
The Power of Superfoods and Exercise.pdf
The Power of Superfoods and Exercise.pdfThe Power of Superfoods and Exercise.pdf
The Power of Superfoods and Exercise.pdf
 
DRAFT Ventilator Rapid Reference version 2.4.pdf
DRAFT Ventilator Rapid Reference  version  2.4.pdfDRAFT Ventilator Rapid Reference  version  2.4.pdf
DRAFT Ventilator Rapid Reference version 2.4.pdf
 
Can coffee help me lose weight? Yes, 25,422 users in the USA use it for that ...
Can coffee help me lose weight? Yes, 25,422 users in the USA use it for that ...Can coffee help me lose weight? Yes, 25,422 users in the USA use it for that ...
Can coffee help me lose weight? Yes, 25,422 users in the USA use it for that ...
 
LGBTQ+ Adults: Unique Opportunities and Inclusive Approaches to Care
LGBTQ+ Adults: Unique Opportunities and Inclusive Approaches to CareLGBTQ+ Adults: Unique Opportunities and Inclusive Approaches to Care
LGBTQ+ Adults: Unique Opportunities and Inclusive Approaches to Care
 
chatgptfornlp-230314021506-2f03f614.pdf. 21506-2f03f614.pdf
chatgptfornlp-230314021506-2f03f614.pdf. 21506-2f03f614.pdfchatgptfornlp-230314021506-2f03f614.pdf. 21506-2f03f614.pdf
chatgptfornlp-230314021506-2f03f614.pdf. 21506-2f03f614.pdf
 

AngularJS and REST - #omrs15 tutorial

  • 1. AngularJS & REST Web Services #OMRS15 Darius Jazayeri darius@openmrs.org djazayeri@thoughtworks.com
  • 2. Download this... ● Download the Postman Chrome app ● https://www.getpostman.com/ ● We'll use it shortly
  • 3. REST ● REST = Representational State Transfer ● the software architectural style of the World Wide Web ● Levels of maturity – “just add a REST API on top of it” – Hypermedia as the engine of application state (HATEOAS) – http://martinfowler.com/articles/richardsonMaturityModel.html ● Using HTTP to interact with the server in a constrained machine-friendly way ● Constraints allow for scalability via standard web technologies (stateless, cacheable, layered)
  • 4. REST concepts ● Resource – URI that addresses a collection or item in the system – e.g. http://…/patient or http://…/patient/abc123 ● Representation – Specific state of the application. Based on one of these a client can change application state – Typically JSON or XML ● Hyperlinks – what client can do from a given state – e.g. {"rel": "next", "uri": "http://.../concept?startIndex=50"}
  • 5. REST in OpenMRS ● Started in 2011 ● Level 2 on the Richardson Maturity Model – http://martinfowler.com/articles/richardsonMaturityModel.html ● RESTful CRUD access to the OpenMRS platform data model ● We would like to be REST-first, but we're not there yet. This is still second-class to our Java API
  • 6. REST in OpenMRS ● Documentation on the wiki at “REST Web Services API For Clients” – https://wiki.openmrs.org/x/P4IaAQ – Big refresh coming in the next OpenMRS Platform release (Swagger!) ● Basic Authentication ● Paging ● Different sized representations (ref, default, full) – Also, custom representations
  • 7. REST in OpenMRS: Let's play ● Use the Postman Chrome app (or something else) ● http://demo.openmrs.org/openmrs/ws/rest/v1/concept ● .../concept?startIndex=50 ● .../concept?q=malaria ● .../concept/CIEL:160152 ● Add header… Accept: application/xml ● .../location?v=default
  • 8. REST in OpenMRS: Exercise ● Create an encounter for an existing patient that records their weight – You will need to find a patient, look up some other metadata, and figure out the encounter POST format
  • 9. AngularJS ● https://angularjs.org/ (by Google) – “HTML is great for declaring static documents, but it falters when we try to use it for declaring dynamic views in web-applications. AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop.” ● Great framework for building client-side web applications ● Normally, one would build a complete app in AngularJS – Bahmni – OpenMRS Ebola Tablet App ● In the OpenMRS Reference Application we embed smaller AngularJS apps in a primarily- server-side application – but we're using AngularJS more and more ● Clone: https://github.com/djazayeri/openmrs-module-angulartutorial openmrs-core version 1.11.x modules: appui, uiframework, appframework, uicommons, webservices.rest
  • 10. AngularJS Concepts ● Directives – Think of this as an “HTML tag/attribute handler” – AngularJS code that is applied – Built-in directives; Also write your own ● Scopes – The dynamic thing that connects controller to view – Directives have a $scope (sometimes inherited from a parent, sometimes isolated) – $rootScope
  • 11. AngularJS Concepts ● Two-way data binding – <input ng-model="myVariable" type="text"/> – Editing the text box will update $scope.myVariable – Setting $scope.myVariable will update the text box ● Templates – with {{ interpolation }} ● Functions in the $scope – <button ng-click="doSomething()">...</button> ● See example1 in the tutorial module
  • 12. AngularJS Docs ● Developer Guide – https://docs.angularjs.org/guide ● API Reference – https://docs.angularjs.org/api ● More sophisticated: tutorial example2
  • 14. AngularJS +/- GSP ● OpenMRS Reference Application includes a non-standard mix of server-side GSP and client-side AngularJS code ● Filters – {{ visit.startDate | date }} ● tutorial example4
  • 15. AngularJS + REST in OpenMRS ● Using raw $http – Tutorial example5 ● Using ngResource – Tutorial example6 ● Services in uicommons module