Get to know this exceptional case of migration to the cloud with MicroProfile and Jakarta EE in the Brazilian medical industry. It involves several challenges such as the fifth-largest population and largest territory in the world; complexity; and diversity, both geographic and economic. We discuss how MicroProfile projects such as Health Check, JWT Authentication, Metrics, OpenAPI, Rest Client, and Config contributed to the success of the project; what benefits they saw; the challenges they faced; and how they solved them.
2. @GuimaraesSv @CesarHgt @tomitribe
SPEAKERS
Rafael Guimarães
● Software Engineer
● GBR Systems.
● +27 experience in Medical and Judicial
areas in Brazil.
● University faculty professor.
● Focused on distributed software
architectures.
César Hernández
● Senior Software Engineer at Tomitribe
● Oracle Java Champion and
Groundbreaker Ambassador
● Duke’s Choice Award 2016, 2017
● Oracle Certified Professional
● +14 experience with Java EE
● Apache TomEE and Eclipse Committer,
Microprofile Contributor.
● Open Source advocate, writer, teacher
and public speaker
3. @GuimaraesSv @CesarHgt @tomitribe
Agenda
● Brazilian health care system Overview
● Base System
● Boosting Brazilian healthcare systems with Jakarta EE, Eclipse
MicroProfile and Apache TomEE
● Contribution to the COVID-19 Response
● Lessons Learned
5. @GuimaraesSv @CesarHgt @tomitribe
5 major regions
26 states / 5570 cities
1 federal district
Brazilian health care system Overview
214M
People
563k
Doctors
155k
Health Service
Providers
6th largest population
(behind China, India, United
States, Indonesia, Pakistan)
source:
http://cnes.datasus.gov.br
http://fiscalizacao.cfm.org.br/
https://population.un.org/wpp/Download/Standard/Population/
5th largest country
(behind Russia, Canada,
China, United States)
7. @GuimaraesSv @CesarHgt @tomitribe
Medical Practice!
Brazilian health care system - Actors
Medicine
Council
Government Health Departments
Control
Regulation
Policies
Sanitary Surveillance
Licences
Records
Professional Discipline
Ethical Judgment
Licence to work
Keep Records
Inspections
Complains
Guiding
Integrations
Information Sharing
Medicine
Schools
&
Residency
Programs
Learning, Training, Specializing
Counselors
&
Inspectors
Health Service
Providers
Doctors
Patients
8. @GuimaraesSv @CesarHgt @tomitribe
Brazilian health care system - Challenges
● Large and Complex
○ Inequalities
○ Difficult governance
○ 30 different Medical Specialties, 20 types of Health Service Providers
○ High frequency of Policy and Rule changes
● Difficult medicine practice
○ Poor infrastructure - high risk
○ Proliferation of medical schools - bad quality professionals
● Incomplete institutional information exchange
○ Diversity of technologies, legacy systems and standards
9. @GuimaraesSv @CesarHgt @tomitribe
Brazilian health care system - Challenges
● How to make good quality inspection reports, with agility, especially
considering the high amount of laws, recommendations, policies and
standards? And to create good statistics of those reports ?
● How to access legacy system data of other government departments without
bureaucracy, to check licences, records and information integrity ? Is the data
safe, monitored, fast, reliable ?
● What could be done to facilitate interaction between the doctors and the
council?
11. @GuimaraesSv @CesarHgt @tomitribe
About GBR
● Founded in 2008
● Consulting, Software Engineering & Architecture, Training
● Applications:
○ support Inspectors and Counselors in their principal job -
Professional Discipline, Guiding, Inspections
○ online services that control the Doctors and Service Providers
in their “life cycle” within Councils
○ to do quality auditing and certification of medical schools
12. @GuimaraesSv @CesarHgt @tomitribe
Base system
Server
● JAVA EE 6
● Jboss7
● Tomcat 6, 7
Client
● Adobe Flex
● Adobe Air
● Angular JS 1
Data Integration
● Kettle
ON-PREMISSE!
13. @GuimaraesSv @CesarHgt @tomitribe
About GBR coverage
Federal Medical
Council Nationwide
Regional
Medical Councils
National Inspection
Platform
CFM
Accreditation of
Medical Schools -
SAEME
South
Regional Santa Catarina
CRMSC
South
Regional Rio Grande do Sul
CREMERS
18. @GuimaraesSv @CesarHgt @tomitribe
Eclipse MicroProfile
● An open-source community specification
● Focus on Enterprise Java microservices
● Generates: SPEC, API, and TCK.
● https://microprofile.io
● Implemented by different vendors.
21. @GuimaraesSv @CesarHgt @tomitribe
● Apache Tomcat + Java EE = Apache TomEE
● Built from Apache components
● MicroProfile compliant
● Footprint: 30MB zip, 100~MB memory
● TomEE 9.0.0-M7 (Jakarta EE 9 Web Profile
compatible implementation)
● tomee.apache.org
22. @GuimaraesSv @CesarHgt @tomitribe
Apache TomEE
TomEE JAX-RS Microprofile
Java Server Pages
(JSP)
Java Server Faces
(JSF)
Java Transaction
API (JTA)
Bean Validation
Enterprise
JavaBeans
JavaMail API
Java API for
RESTful Web
Services (JAX-RS)
Java Persistence
API (JPA)
Contexts and
Dependency
Injection (CDI)
Java Servlets
Java
Authentication and
Authorization
Service (JAAS)
Java Authorization
Contract for
Containers (JACC)
http://tomee.apache.org/comparison.html
29. @GuimaraesSv @CesarHgt @tomitribe
Before
● Manual process and lack of coverage
● Disperse monitoring
● Hard to trace
● “It’s slow”, “a glitch”, “restarts”
● Reactive most of the time
Health Check + Metrics
30. @GuimaraesSv @CesarHgt @tomitribe
After
● JSON base alerts are now centralized and provide unified notifications
● Custom rules base on standard status
● Proactiveness since the last 3 months
● Improves user satisfaction
Health Check + Metrics
34. @GuimaraesSv @CesarHgt @tomitribe
JWT Authentication
Before:
● Basic HTTP Auth with session management
● Challenges for microservices
○ New stateless security requirement
○ Authentication and Authorization between microservices
○ Overhead and single point of failure
35. @GuimaraesSv @CesarHgt @tomitribe
JWT Authentication
After:
● OAuth 2.0 JWT
○ Stateless security
○ Authentication and Authorization between microservices
○ State was kept on the server and pointer on the client side
39. @GuimaraesSv @CesarHgt @tomitribe
Rest Client
Before
● JAX-RS Client
● No type-safe
● Service needed to be understood
● Request needed to be built by hand every time
● Not the best reusability of the code
40. @GuimaraesSv @CesarHgt @tomitribe
Rest Client
After
● Type-safe approach
● Usage of interfaces to call the services
● Header propagation and handling made easy
● Smooth JWT propagation
41. @GuimaraesSv @CesarHgt @tomitribe
@Dependent
@RegisterRestClient
public interface SerproSearchClient {
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response getToken(String body);
@GET
public Response searchCompany(@HeaderParam("Authorization") String key,
@HeaderParam("Accept") String accept);
}
Microprofile RestClient
42. @GuimaraesSv @CesarHgt @tomitribe
@Dependent
@RegisterRestClient
public interface SerproSearchClient {
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response getToken(String body);
@GET
public Response searchCompany(@HeaderParam("Authorization") String key,
@HeaderParam("Accept") String accept);
}
Microprofile RestClient
43. @GuimaraesSv @CesarHgt @tomitribe
Microprofile RestClient
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import javax.enterprise.context.Dependent;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
@RegisterRestClient
@Path("api/doctors")
public interface DoctorResourceClient {
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
Doctor find(@PathParam("id") Long id);
@GET
List<Doctor> getDoctors();
@POST
@Consumes("application/json")
Doctor addDoctor(Doctor doctor);
44. @GuimaraesSv @CesarHgt @tomitribe
Microprofile RestClient
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import javax.enterprise.context.Dependent;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
@RegisterRestClient
@Path("api/doctors")
public interface DoctorResourceClient {
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
Doctor find(@PathParam("id") Long id);
@GET
List<Doctor> getDoctors();
@POST
@Consumes("application/json")
Doctor addDoctor(Doctor doctor);
45. @GuimaraesSv @CesarHgt @tomitribe
Microprofile RestClient
import org.superbiz.moviefun.mpclient.DoctorResourceClient;
@Inject
@RestClient
private DoctorResourceClient doctorResourceClient;
public void printAllDoctors(){
List<Doctor> doctors = doctorResourceClient.getDoctors();
for (Doctor doctor : doctor) {
LOGGER.info(doctor.toString());
}
}
public void addNewDoctor() {
Doctor newDoctor = new Doctor ("7","Doctor 007.");
doctorResourceClient.addDoctor(newDoctor);
}
46. @GuimaraesSv @CesarHgt @tomitribe
Microprofile RestClient
import org.superbiz.moviefun.mpclient.DoctorResourceClient;
@Inject
@RestClient
private DoctorResourceClient doctorResourceClient;
public void printAllDoctors(){
List<Doctor> doctors = doctorResourceClient.getDoctors();
for (Doctor doctor : doctor) {
LOGGER.info(doctor.toString());
}
}
public void addNewDoctor() {
Doctor newDoctor = new Doctor ("7","Doctor 007.");
doctorResourceClient.addDoctor(newDoctor);
}
47. @GuimaraesSv @CesarHgt @tomitribe
Before
● Legacy system was not well document
● Documentation not fully aligned with master code
○ Duplication of code
○ Design first approach not trustable
OpenAPI
52. @GuimaraesSv @CesarHgt @tomitribe
Telemedicine Support - Doctor's Prescriptions System
● 5 days development
○ REST API
● Some integrations
○ Doctor's space login, Federal Companies Database, Pharmacies Database, Google
Authenticator (two factor auth)
● Sensitive data protection
○ Attribute Converter
Medical Practice!
Digital Prescription Digital Prescription
Doctor Patient Pharmacy
Receive / Validate
Emit
55. @GuimaraesSv @CesarHgt @tomitribe
Telemedicine Support - Doctor's Prescriptions System
● Almost 2,6 millions prescriptions in south of Brazil installations-- since Mar/ 2020.
Santa Catarina State Rio Grande do Sul State