Implementing a JSON REST API using Java 8 & Spring

Job ID: 35515884

Budget: $10 – $40 CAD

This project is a simple Java 8 Spring project implementing a JSON REST API. It consists of a single end-point that returns a list of patients.

The project uses an in-memory H2 database. Every time it is run, it loads to contents of src/main/resources/sample_patients.tsv into the Patient repository.

Exercise
The patient ID values (i.e., “patientId” field) are correct in the database, but the values returned by the GET /patients/ endpoint are incorrect. Investigate and correct the deficiency.

Create a new endpoint, GET /patients/alberta/csv, that returns CSV-formatted data in the response body for all patients whose patient ID begins with a 6.

Requirements
i. The response body should be a list of all patients whose patient ID (i.e., "patientId" field) begins with a 6.

ii. The response should be CSV-formatted, consisting of the following fields in this order: id, firstName, lastName, email, sex, birthDate, height, weight, patientId.

iii. The first line of the response body should be a header line consisting of the names of the fields.

iv. Each successive line should be one patient, with each patient’s fields separated by commas.

v. For example, for two patients John Smith and Jane Doe, the response body might look as follows.

id,firstName,lastName,email,sex,birthDate,height,weight,patientId

Create a new entity, repository, service, dto and controller for a new model called Medication.

Requirements
i. Each medication belongs to exactly one patient, but each patient can have multiple medications.

ii. Aside from the patient relationship, each medication has one additional field: medicationName, which is a string.

iii. The controller should contain two endpoints that: (a) create a single medication for one patient, and; (b) get a JSON list of all medications belonging to a single patient, given that patient's id (i.e., "id" field) as a path parameter