- Details: Create a new user account, with authentication credentials stored in Auth0 database and user details in Google Datastore.
- Request:
o Header: Content-Type (only accepts ‘application/json’)
o Body input in JSON: email (a string), password (a string), full_name (a string), department (a string), and start_date (a string).
§ Note: ‘email’ must be a properly formatted email string, and the remaining properties must be non-empty strings.
§ Example:
{
"email"<EMAIL_ADDRESS>"password": "abc123",
"full_name": "Bob Fisher",
"department": "Math",
"start_date": "1/1/2010"
}
- Response:
o Valid input: Returns status code “201 Created”, a link to the newly created resource in the “Location” header, and a JSON object in the body with the following properties: full_name, department, start_date, email, owner_of_courses, id, and self.
§ Example in “Location” header:
Location<EMAIL_ADDRESS>§ Example in body:
{
"full_name": "Bob Fisher",
"department": "Math",
"start_date": "1/1/2010",
"email"<EMAIL_ADDRESS>"owner_of_courses": [],
"id": "5698529657880576",
"self"<EMAIL_ADDRESS>}
o Invalid body input: Returns status code “400 Bad Request”, and error message in body.
§ Example, any empty property:
The following properties are required: email, password, full_name, department, and start_date.
§ Example, using an email that is already in use:
{
"name": "BadRequestError",
"code": "user_exists",
"description": "The user already exists.",
"statusCode": 400
}
§ Example, an invalid email:
{
"error": "invalid email address"
}
o Invalid “Content-Type” header: Returns status code “415 Unsupported Media Type”, and error message in body.
§ Example, “Content-Type” header set to “application/xml”:
Server can only accept 'application/json'.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
POST /login
- Details: Log into a user account to retrieve a JSON Web Token (JWT) using Auth0 authentication.
- Request:
o Header: Content-Type (only accepts ‘application/json’)
o Body input in JSON: username (a properly formatted email address string), password (a non-empty string).
§ Example:
{
"username"<EMAIL_ADDRESS>"password": "abc123"
}
- Response:
o Valid input: Returns status code “200 OK” and a JSON object in the body with the following properties: access_token, id_token, scope, expires_in, and token_type.
§ Example in body:
{
"access_token": "CjE...A3J",
"id_token": "eyJ0...chg",
"scope": "openid profile email address phone",
"expires_in": 86400,
"token_type": "Bearer"
}
o Invalid body input: Returns status code “400 Bad Request”, and error message in body.
§ Example, an incorrect username and/or password:
{
"error": "invalid_grant",
"error_description": "Wrong email or password."
}
§ Example, an empty username:
{
"error": "invalid_request",
"error_description": "Missing required parameter: username"
}
§ Example, an empty password:
{
"error": "invalid_request",
"error_description": "Missing required parameter: password"
}
o Invalid “Content-Type” header: Returns status code “415 Unsupported Media Type”, and error message in body.
§ Example, “Content-Type” header set to “application/xml”:
Server can only accept 'application/json'.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
GET /users/:email
- Description: Get the details of a user resource. Requires authentication. The requested user resource must belong to the user.
- Request:
o Header: Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameter: email (a properly formatted email string).
§ Example:
<EMAIL_ADDRESS>- Response:
o Valid input: Returns status code “200 OK”, and a JSON object in the body with the following properties: full_name, department, start_date, email, owner_of_courses, id, and self.
§ “owner_of_courses” is an array of the courses the user owns—the following high-level details of each course are displayed: id, course_number, course_title, and self.
§ Example:
{
"start_date": "1/1/2010",
"full_name": "Bob Fisher",
"email"<EMAIL_ADDRESS>"department": "Math",
"owner_of_courses": [
{
"id": "5737442330017792",
"course_number": "CS101",
"course_title": "Intro to Computer Science",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5737442330017792"
},
{
"id": "6202224833200128",
"course_number": "CS493",
"course_title": "Cloud Application Development",
"self": "https://cs493-final-project-derrick.appspot.com/courses/6202224833200128"
}
],
"id": "5698529657880576",
"self"<EMAIL_ADDRESS>}
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Incorrect authentication to view user: Returns status code “403 Forbidden”, and error message in body.
§ Example, wrong JWT provided:
You do not have the authorization to view that user.
o Invalid email (i.e. non-existent email): Returns status code “404 Not Found”, and error message in body.
§ Example<EMAIL_ADDRESS>That user does not exist.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
PUT /users/:email
- Description: Edit the details of a user resource: full_name, department, and start_date. Requires authentication. The requested user resource must belong to the user.
o Note that a user’s email and password cannot be edited after creation.
- Request:
o Header:
§ Content-Type (only accepts ‘application/json’)
§ Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameter: email (a properly formatted email string).
§ Example:
<EMAIL_ADDRESS>o Body input in JSON: full_name (a string), department (a string), and start_date (a string).
§ Example:
{
"full_name": "Bob J Fisher",
"department": "Physics",
"start_date": "2/2/2020"
}
- Response:
o Valid input: Returns status code “200 OK”, a link to the edited resource in the “Location” header, and a JSON object in the body with the following properties: full_name, department, start_date, email, owner_of_courses, id, and self.
§ “owner_of_courses” is an array of the courses the user owns—the following high-level details of each course are displayed: id, course_number, course_title, and self.
§ Example in “Location” header:
Location<EMAIL_ADDRESS>§ Example:
{
"full_name": "Bob J Fisher",
"department": "Physics",
"start_date": "2/2/2020",
"email"<EMAIL_ADDRESS>"owner_of_courses": [
{
"id": "5737442330017792",
"course_number": "CS101",
"course_title": "Intro to Computer Science",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5737442330017792"
},
{
"id": "6202224833200128",
"course_number": "CS493",
"course_title": "Cloud Application Development",
"self": "https://cs493-final-project-derrick.appspot.com/courses/6202224833200128"
}
],
"id": "5698529657880576",
"self"<EMAIL_ADDRESS>}
o One or more empty properties: Returns status code “400 Bad Request”, and error message in body.
§ Example:
The following properties are required:
full_name, department, and start_date.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Incorrect authentication to edit user: Returns status code “403 Forbidden”, and error message in body.
§ Example, wrong JWT provided:
You do not have the authorization to edit that user.
o Invalid email (i.e. non-existent email): Returns status code “404 Not Found”, and error message in body.
§ Example<EMAIL_ADDRESS>That user does not exist.
o Invalid “Content-Type” header: Returns status code “415 Unsupported Media Type”, and error message in body.
§ Example, “Content-Type” header set to “application/xml”:
Server can only accept 'application/json'.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
DELETE /users/:email
- Description: Delete a user resource (from Google Datastore and Auth0 database). All courses belonging to user will be deleted as well. The deleted courses will be removed from the students’ schedules, but students’ resource will not be deleted. Requires authentication. The requested user resource must belong to the user.
- Request:
o Header: Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameter: email (a properly formatted email string).
§ Example:
<EMAIL_ADDRESS>- Response:
o Valid input: Returns status code “204 No Content”.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Incorrect authentication to delete user: Returns status code “403 Forbidden”, and error message in body.
§ Example, wrong JWT provided:
You do not have the authorization to delete that user.
o Invalid email (i.e. non-existent email): Returns status code “404 Not Found”, and error message in body.
§ Example<EMAIL_ADDRESS>That user does not exist.
POST /courses
- Details: Add a new course. Requires authentication. Course will be added to the user’s owner_of_courses array, and the course’s course_owner will hold the user’s email.
- Request:
o Header:
§ Content-Type (only accepts ‘application/json’)
§ Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Body input in JSON: course_number (a string – must be unique, i.e. cannot share the same course_number with any other courses), credits (an integer), and course_title (a string).
§ Example:
{
"course_number": "CS340",
"credits": "4",
"course_title": "Intro to Databases"
}
- Response:
o Valid body input: Returns status code “201 Created”, a link to the newly created resource in the “Location” header, and a copy of the created resource in JSON in the body with the following properties: course_number, credits, course_title, course_owner, enrolled_students, id, and self.
§ “course_owner” holds the high-level details of the owner of the course—specifically the user’s email and self-link.
§ Example in “Location” header:
Location: https://cs493-final-project-derrick.appspot.com/courses/5718848309297152
§ Example in body:
{
"course_number": "CS340",
"credits": 4,
"course_title": "Intro to Databases",
"course_owner": {
"email"<EMAIL_ADDRESS>"self"<EMAIL_ADDRESS>},
"enrolled_students": [],
"id": "5718848309297152",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5718848309297152"
}
o Invalid body input: Returns status code “400 Bad Request”, and error message in body.
§ Example, any empty property:
The following properties are required: course_number, credits, and course_title.
§ Example, invalid credits (i.e. not an integer, or an integer < 0):
'credits' field does not contain a valid value.
§ Example, duplicate course_number:
That course_number already exists.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Invalid “Content-Type” header: Returns status code “415 Unsupported Media Type”, and error message in body.
§ Example, “Content-Type” header set to “application/xml”:
Server can only accept 'application/json'.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
GET /courses
- Description: Get a paginated list of all courses in database and their high-level details. Does not require authentication.
- Request:
o (No query parameters nor body input.)
- Response:
o Returns status code “200 OK”, and a body with “total_course_count”, “courses”, and “next”.
§ “total_course_count” is the total number of courses stored in the database from all users.
§ “courses” is a list of courses objects (5 courses at a time). Each course object has the following keys: course_number, credits, course_title, course_owner, total_student_enrolled, id, and self.
· “total_student_enrolled” is the total number of students enrolled in that course.
· “course_owner” holds the high-level details of the owner of the course—specifically the user’s email and self-link.
§ “next” is the link to the next set of paginated results if there are more results to show.
§ Example:
{
"total_course_count": 6,
"courses": [
{
"course_owner": {
"email"<EMAIL_ADDRESS>"self"<EMAIL_ADDRESS>},
"course_number": "ME205",
"credits": 4,
"course_title": "Mechanical Design",
"id": "5664488955052032",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5664488955052032",
"total_students_enrolled": 0
},
{
"course_owner": {
"email"<EMAIL_ADDRESS>"self"<EMAIL_ADDRESS>},
"course_number": "CS340",
"credits": 4,
"course_title": "Intro to Databases",
"id": "5718848309297152",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5718848309297152",
"total_students_enrolled": 0
},
{
"credits": 4,
"course_title": "Intro to Mechanics",
"course_owner": {
"email"<EMAIL_ADDRESS>"self"<EMAIL_ADDRESS>},
"course_number": "ME101",
"id": "5728676100440064",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5728676100440064",
"total_students_enrolled": 0
},
{
"course_owner": {
"email"<EMAIL_ADDRESS>"self"<EMAIL_ADDRESS>},
"course_number": "ME155",
"credits": 4,
"course_title": "Thermodynamics",
"id": "5734055144325120",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5734055144325120",
"total_students_enrolled": 0
},
{
"course_owner": {
"email"<EMAIL_ADDRESS>"self"<EMAIL_ADDRESS>},
"course_number": "CS101",
"credits": 4,
"course_title": "Intro to Computer Science",
"id": "5737442330017792",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5737442330017792",
"total_students_enrolled": 0
}
],
"next": "https://cs493-final-project-derrick.appspot.com/courses?cursor=CjoSNGodbX5jczQ5My1maW5hbC1wcm9qZWN0LWRlcnJpY2tyEwsSBkNvdXJzZRiAgICgxsWYCgwYACAA"
}
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
GET /courses/:course_id
- Description: Get the in-depth details of a specific courses. Does not require authentication.
- Request:
o Query parameter: course_id (an integer).
§ Example:
/courses/5734055144325120
- Response:
o Valid course_id: Returns status code “200 OK” and the requested course resource in JSON in the body with the following properties: course_number, credits, course_title, course_owner, enrolled_students, id, and self.
§ “course_owner” holds the high-level details of the owner of the course—specifically the user’s email and self-link.
§ “enrolled_students” is an array of the students enrolled in the course—the following high-level details of each student are displayed: id, full_name, and self.
§ Example:
{
"credits": 4,
"course_title": "Thermodynamics",
"course_owner": {
"email"<EMAIL_ADDRESS>"self"<EMAIL_ADDRESS>},
"course_number": "ME155",
"enrolled_students": [
{
"id": "5092316834430976",
"full_name": "Sheldon Young",
"self": "https://cs493-final-project-derrick.appspot.com/students/5092316834430976"
},
{
"id": "5696068708728832",
"full_name": "Mike Hu",
"self": "https://cs493-final-project-derrick.appspot.com/students/5696068708728832"
}
],
"id": "5734055144325120",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5734055144325120"
}
o Invalid course_id (i.e. not an integer): Returns status code “400 Bad Request”, and error message in body.
§ Example, /courses/abc:
Invalid course id supplied.
o Invalid course_id (i.e. non-existent course_id): Returns status code “404 Not Found”, and error message in body.
§ Example, /courses/123:
That course does not exist.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
PUT /courses/:course_id
- Description: Edit the details of a course resource: course_number, credits, and course_title. Requires authentication. The requested course resource must belong to the user.
- Request:
o Header:
§ Content-Type (only accepts ‘application/json’)
§ Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameter: course_id (an integer).
§ Example:
/courses/5734055144325120
o Body input in JSON: course_number (a string – must be unique, i.e. cannot share the same course_number with any other courses), credits (an integer), and course_title (a string).
§ Example:
{
"course_number": "ME156",
"credits": "4",
"course_title": "Adv. Thermodynamics"
}
- Response:
o Valid input: Returns status code “200 OK”, a link to the edited resource in the “Location” header, and a JSON object in the body with the following properties: course_number, credits, course_title, course_owner, enrolled_students, id, and self.
§ “course_owner” holds the high-level details of the owner of the course—specifically the user’s email and self-link.
§ “enrolled_students” is an array of the students enrolled in the course—the following high-level details of each student are displayed: id, full_name, and self.
§ Example in “Location” header:
Location: https://cs493-final-project-derrick.appspot.com/courses/5734055144325120
§ Example:
{
"course_number": "ME156",
"credits": 4,
"course_title": "Adv. Thermodynamics",
"course_owner": {
"email"<EMAIL_ADDRESS>"self"<EMAIL_ADDRESS>},
"enrolled_students": [
{
"id": "5092316834430976",
"full_name": "Sheldon Young",
"self": "https://cs493-final-project-derrick.appspot.com/students/5092316834430976"
},
{
"id": "5696068708728832",
"full_name": "Mike Hu",
"self": "https://cs493-final-project-derrick.appspot.com/students/5696068708728832"
}
],
"id": "5734055144325120",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5734055144325120"
}
o Invalid input: Returns status code “400 Bad Request”, and error message in body.
§ Example, any empty property:
The following properties are required: course_number, credits, and course_title.
§ Example, invalid credits (i.e. not an integer, or an integer < 0):
'credits' field does not contain a valid value.
§ Example, duplicate course_number:
That course_number already exists.
§ Example, invalid course_id, e.g /courses/abc:
Invalid course id supplied.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Incorrect authentication to edit course: Returns status code “403 Forbidden”, and error message in body.
§ Example, wrong JWT provided:
You do not have the authorization to edit that course.
o Invalid course_id (i.e. non-existent course_id): Returns status code “404 Not Found”, and error message in body.
§ Example, /courses/123:
That course does not exist.
o Invalid “Content-Type” header: Returns status code “415 Unsupported Media Type”, and error message in body.
§ Example, “Content-Type” header set to “application/xml”:
Server can only accept 'application/json'.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
DELETE /courses/:course_id
- Description: Delete a course. The deleted course will be removed from the students’ schedules, but students’ resource will not be deleted. The deleted course will also be removed from the user’s list of owned courses. Requires authentication. The requested course resource must belong to the user.
- Request:
o Header: Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameter: course_id (an integer).
§ Example:
/courses/5721718521856000
- Response:
o Valid input: Returns status code “204 No Content”.
o Invalid ship_id (i.e. not an integer): Returns status code “400 Bad Request”, and error message in body.
§ Example, /courses/abc:
Invalid course id supplied.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Incorrect authentication to delete course: Returns status code “403 Forbidden”, and error message in body.
§ Example, wrong JWT provided:
You do not have the authorization to delete that course.
o Invalid course_id (i.e. non-existent course_id): Returns status code “404 Not Found”, and error message in body.
§ Example, /courses/123:
That course does not exist.
PUT /courses/:course_id/students/:student_id
- Details: Assign a student to a course. Requires authentication. The student resource may be altered by any authenticated user, but the course must belong to the user. The student will be added to the course’s list of enrolled students; and the course will be added to the student’s schedule.
- Request:
o Header: Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameters: course_id (an integer), student_id (an integer).
§
Example: /courses/5734055144325120/students/5696068708728832
- Response:
o Valid input: Returns status code “200 OK”, a link to the updated course resource in the “Location” header, and a success message in the body.
§ Example in “Location” header:
Location: https://cs493-final-project-derrick.appspot.com/courses/5734055144325120
§ Example in body:
Student successfully added to course.
o Invalid query: Returns status code “400 Bad Request”, and error message in body.
§ Example, invalid course_id (i.e. not an integer):
Invalid course id supplied.
§ Example, invalid student_id (i.e. not an integer):
Invalid student id supplied.
§ Example, student is already assigned to course:
That student is already in that course.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Incorrect authentication to put students in course: Returns status code “403 Forbidden”, and error message in body.
§ Example, wrong JWT provided:
You do not have the authorization to put students in that course.
o Invalid course_id or student_id (i.e. non-existent): Returns status code “404 Not Found”, and error message in body.
§ Example, non-existent course:
That course does not exist.
§ Example, non-existent student:
That student does not
exist.
DELETE /courses/:course_id/students/:student_id
- Details: Remove a student from a course. Requires authentication. The student resource may be altered by any authenticated user, but the course must belong to the user. The student will be removed from the course’s list of enrolled students; and the course will be removed from the student’s schedule.
- Request:
o Header: Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameters: course_id (an integer), student_id (an integer).
§
Example: /courses/5734055144325120/students/5696068708728832
- Response:
o Valid input: Returns status code “200 OK”, a link to the updated course resource in the “Location” header, and a success message in the body.
§ Example in “Location” header:
Location: https://cs493-final-project-derrick.appspot.com/courses/5734055144325120
§ Example in body:
Student successfully removed from course.
o Invalid query: Returns status code “400 Bad Request”, and error message in body.
§ Example, invalid course_id (i.e. not an integer):
Invalid course id supplied.
§ Example, invalid student_id (i.e. not an integer):
Invalid student id supplied.
§ Example, student is not assigned to course:
That student is not in that course.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Incorrect authentication to put students in course: Returns status code “403 Forbidden”, and error message in body.
§ Example, wrong JWT provided:
You do not have the authorization to remove students from that course.
o Invalid course_id or student_id (i.e. non-existent): Returns status code “404 Not Found”, and error message in body.
§ Example, non-existent course:
That course does not exist.
§ Example, non-existent student:
That student does not exist.
POST /students
- Details: Add a new student. Requires authentication. Any authenticated user can add a new student. The created student resource does not belong to any user.
- Request:
o Header:
§ Content-Type (only accepts ‘application/json’)
§ Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Body input in JSON: full_name (a string), graduation_year (an integer), and major (a string).
§ Example:
{
"full_name": "Samus Aran",
"graduation_year": 1986,
"major": "Astronomy"
}
- Response:
o Valid body input: Returns status code “201 Created”, a link to the newly created resource in the “Location” header, and a copy of the created resource in JSON in the body with the following properties: full_name, graduation_year, major, schedule_of_courses, id, and self.
§ Example in “Location” header:
Location: https://cs493-final-project-derrick.appspot.com/courses/5686147871145984
§ Example in body:
{
"full_name": "Samus Aran",
"graduation_year": 1986,
"major": "Astronomy",
"schedule_of_courses": [],
"id": "5686147871145984",
"self": "https://cs493-final-project-derrick.appspot.com/students/5686147871145984"
}
o Invalid body input: Returns status code “400 Bad Request”, and error message in body.
§ Example, any empty property:
The following properties are required: full_name, graduation_year, and major.
§ Example, invalid graduation_year (i.e. not an integer, or an integer < 0):
'graduation_year' field does not contain a valid value.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Invalid “Content-Type” header: Returns status code “415 Unsupported Media Type”, and error message in body.
§ Example, “Content-Type” header set to “application/xml”:
Server can only accept 'application/json'.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
GET /students
- Description: Get a paginated list of all students in database and their high-level details. Does not require authentication.
- Request:
o (No query parameters nor body input.)
- Response:
o Returns status code “200 OK”, and a body with “total_student_count”, “students”, and “next”.
§ “total_ student _count” is the total number of students stored in the database.
§ “students” is a list of student objects (5 students at a time). Each student object has the following keys: full_name, graduation_year, major, total_courses_scheduled, id, and self.
· “total_courses_scheduled” is the total number of courses the student has added to their schedule.
§ “next” is the link to the next set of paginated results if there are more results to show.
§ Example:
{
"total_student_count": 6,
"students": [
{
"full_name": "Sheldon Young",
"major": "Marine Biology",
"graduation_year": 2010,
"id": "5092316834430976",
"self": "https://cs493-final-project-derrick.appspot.com/students/5092316834430976",
"total_courses_scheduled": 1
},
{
"major": "Astronomy",
"graduation_year": 1986,
"full_name": "Samus Aran",
"id": "5686147871145984",
"self": "https://cs493-final-project-derrick.appspot.com/students/5686147871145984",
"total_courses_scheduled": 0
},
{
"major": "Biology",
"graduation_year": 2022,
"full_name": "Lauren Keith",
"id": "5687777542799360",
"self": "https://cs493-final-project-derrick.appspot.com/students/5687777542799360",
"total_courses_scheduled": 0
},
{
"full_name": "Jen Roberts",
"major": "Physics",
"graduation_year": 2020,
"id": "5695159920492544",
"self": "https://cs493-final-project-derrick.appspot.com/students/5695159920492544",
"total_courses_scheduled": 0
},
{
"major": "Bioengineering",
"graduation_year": 2010,
"full_name": "Mike Hu",
"id": "5696068708728832",
"self": "https://cs493-final-project-derrick.appspot.com/students/5696068708728832",
"total_courses_scheduled": 0
}
],
"next": "https://cs493-final-project-derrick.appspot.com/students?cursor=CjsSNWodbX5jczQ5My1maW5hbC1wcm9qZWN0LWRlcnJpY2tyFAsSB1N0dWRlbnQYgICAwLWRjwoMGAAgAA=="
}
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
GET /students/:student_id
- Description: Get the in-depth details of a specific student. Does not require authentication.
- Request:
o Query parameter: student_id (an integer).
§ Example:
/students/5686147871145984
- Response:
o Valid student_id: Returns status code “200 OK” and the requested student resource in JSON in the body with the following properties: full_name, graduation_year, major, schedule_of_courses, id, and self.
§ “schedule_of_courses” is an array of courses the student has added to their schedule—the following high-level details of each course are displayed: id, course_number, course_title, and self.
§ Example:
{
"schedule_of_courses": [
{
"id": "5734055144325120",
"course_number": "ME156",
"course_title": "Adv. Thermodynamics",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5734055144325120"
},
{
"id": "5728676100440064",
"course_number": "ME101",
"course_title": "Intro to Mechanics",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5728676100440064"
}
],
"full_name": "Samus Aran",
"major": "Astronomy",
"graduation_year": 1986,
"id": "5686147871145984",
"self": "https://cs493-final-project-derrick.appspot.com/students/5686147871145984"
}
o Invalid student_id (i.e. not an integer): Returns status code “400 Bad Request”, and error message in body.
§ Example, /students/abc:
Invalid student id supplied.
o Invalid student_id (i.e. non-existent student_id): Returns status code “404 Not Found”, and error message in body.
§ Example, /students/123:
That student does not exist.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
PUT /students/:student_id
- Description: Edit the details of a student resource: full_name, graduation_year, and major. Requires authentication. Any authenticated user can edit any student.
- Request:
o Header:
§ Content-Type (only accepts ‘application/json’)
§ Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameter: student_id (an integer).
§ Example:
/students/5686147871145984
o Body input in JSON: full_name (a string), graduation_year (an integer), and major (a string).
§ Example:
{
"full_name": "Samus E Aran",
"graduation_year": 2020,
"major": "Forest Engineering"
}
- Response:
o Valid input: Returns status code “200 OK”, a link to the edited resource in the “Location” header, and a JSON object in the body with the following properties: full_name, graduation_year, major, schedule_of_courses, id, and self.
§ “schedule_of_courses” is an array of courses the student has added to their schedule—the following high-level details of each course are displayed: id, course_number, course_title, and self.
§ Example in “Location” header:
Location: https://cs493-final-project-derrick.appspot.com/students/5686147871145984
§ Example:
{
"full_name": "Samus E Aran",
"graduation_year": 2020,
"major": "Forest Engineering",
"schedule_of_courses": [
{
"id": "5734055144325120",
"course_number": "ME156",
"course_title": "Adv. Thermodynamics",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5734055144325120"
},
{
"id": "5728676100440064",
"course_number": "ME101",
"course_title": "Intro to Mechanics",
"self": "https://cs493-final-project-derrick.appspot.com/courses/5728676100440064"
}
],
"id": "5686147871145984",
"self": "https://cs493-final-project-derrick.appspot.com/students/5686147871145984"
}
o Invalid input: Returns status code “400 Bad Request”, and error message in body.
§ Example, any empty property:
The following properties are required: full_name, graduation_year, and major.
§ Example, invalid graduation_year (i.e. not an integer, or an integer < 0):
'graduation_year' field does not contain a valid value.
§ Example, invalid student_id, e.g /students/abc:
Invalid student id supplied.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Invalid student_id (i.e. non-existent student_id): Returns status code “404 Not Found”, and error message in body.
§ Example, /students/123:
That student does not exist.
o Invalid “Content-Type” header: Returns status code “415 Unsupported Media Type”, and error message in body.
§ Example, “Content-Type” header set to “application/xml”:
Server can only accept 'application/json'.
o Invalid “Accept” header (i.e. any other value besides ‘application/json’): Returns status code “406 Not Acceptable”, and error message in body.
§ Example, “Accept” header set to “application/xml”:
Server can only return 'application/json'.
DELETE /students/:student_id
- Description: Delete a student. The deleted student will be removed from all the courses it has in its schedule, i.e. the student will be removed from each courses’ list of enrolled students. Requires authentication. Any authenticated user can delete any student.
- Request:
o Header: Authorization (the “token_type” value, i.e. “Bearer”, followed by a space and the “id_token” value).
o Query parameter: student_id (an integer).
§ Example:
/students/5721718521856000
- Response:
o Valid input: Returns status code “204 No Content”.
o Invalid student_id (i.e. not an integer): Returns status code “400 Bad Request”, and error message in body.
§ Example, /students/abc:
Invalid student id supplied.
o Non-existent or invalidly formatted JWT in “Authorization” header: Returns status code “401 Unauthorized”, and error message in body.
§ Example, non-existent JWT:
JWT required in authorization header.
o Invalid student_id (i.e. non-existent student_id): Returns status code “404 Not Found”, and error message in body.
§ Example, /students/123:
That student does not exist.


Hello There, I am results-oriented Web Application Developer with training and experience in website design, layout and in all stages of design, coding, testing of web applications.
Hello There, I am results-oriented Web Application Developer with training and experience in website design, layout and in all stages of design, coding, testing of web applications.


Module Documentation¶
omdk.models.OasisModel
¶
-
class
models.OasisModel.
OasisModel
(model_supplier_id, model_id, model_version_id, resources=None)[source]¶ A simple object representation of Oasis models and their resources - an Oasis model is identified by a triple: a specific supplier ID, model ID and model version. The constructor requires these three arguments for creating a new Oasis model object. Each model object also has a resources dictionary that can be used to “attach” any resources by clients, e.g. a lookup service instance, a transforms files pipeline, validation and transformation files for the source -> canonical and canonical -> model exposure transforms, etc.
-
key
¶ Model key - getter only. Format is
getter: Returns <model supplier ID>/<model ID>/<model version ID> type: string
-
model_id
¶ Model ID property - getter only.
getter: Gets the model ID type: string
-
model_version_id
¶ Model version ID property - getter only.
getter: Gets the model version ID type: string
-
resources
¶ Model resources dictionary property.
getter: Gets the attached resource in the model resources dict using the optional resource key
argument. Ifkey
is not given then the entire resources dict is returned.setter: Sets the value of the optional resource key
in the resources dict toval
. If nokey
is given thenval
is assumed to be a new resources dict and is used to replace the existing dict.deleter: Deletes the value of the optional resource key
in the resources dict. If nokey
is given then the entire existing dict is cleared.
-
supplier_id
¶ Model supplier ID property - getter only.
getter: Gets the model supplier ID type: string
-
omdk.exposures.OasisExposuresManagerInterface
¶
-
class
exposures.OasisExposuresManagerInterface.
OasisExposuresManagerInterface
(oasis_models=None)[source]¶ An interface for defining the behaviour of an Oasis exposures manager.
-
clear_files_pipeline
(oasis_model, **kwargs)[source]¶ Clears the exposure transforms files pipeline for the given
oasis_model
optionally using additional arguments in thekwargs
dict.All the required resources must be provided either in the model object resources dict or the
kwargs
dict.In the design of the exposure transform framework a model’s files pipeline is an object value in its resources dict with the key
transforms_files_pipeline
and is thereby accessible withoasis_model.resources[‘transforms_files_pipeline’]This returns an object of type
exposure_transforms.OasisExposureTransformsFilesPipelinewhich stores the different files in the transformation stages for the model as property attributes, e.g.
oasis_model.resources[‘transforms_files_pipeline’].source_exposures_fileA standard implementation could either assign a new object of this type in the call to
clear_files_pipeline
, or set some subset of the file attributes of this pipelines object to null.
-
generate_coverages_file
(oasis_model, **kwargs)[source]¶ Generates a coverages file for the given
oasis_model
.
-
generate_gulsummaryxref_file
(oasis_model, **kwargs)[source]¶ Generates a gulsummaryxref file for the given
oasis_model
.
-
generate_items_file
(oasis_model, **kwargs)[source]¶ Generates an items file for the given
oasis_model
.
-
generate_oasis_files
(oasis_model, **kwargs)[source]¶ For a given
oasis_model
generates the standard Oasis files, namelyitems.csv
coverages.csv
gulsummaryxref.csv
All the required resources must be provided either in the model object resources dict or the
kwargs
dict.It is up to the specific implementation of this class of how these resources will be named in
kwargs
and how they will be used to effect the transformation.
-
get_keys
(oasis_model, **kwargs)[source]¶ Generates the Oasis keys CSV file for a given model object, with headers
LocID,PerilID,CoverageID,AreaPerilID,VulnerabilityID
All the required resources must be provided either in the model object resources dict or the
kwargs
dict.It is up to the specific implementation of this class of how these resources will be named in
kwargs
and how they will be used to effect the transformation.A “standard” implementation should use the lookup service factory class in
oasis_utils
(a submodule of omdk) namelyoasis_utils.oasis_keys_lookup_service_utils.KeysLookupServiceFactory
-
load_canonical_profile
(oasis_model, **kwargs)[source]¶ Loads a JSON file representing the canonical exposures profile for a given
oasis_model
.All the required resources must be provided either in the model object resources dict or the
kwargs
dict.It is up to the specific implementation of this class of how these resources will be named in
kwargs
and how they will be used to effect the transformation.
-
start_files_pipeline
(oasis_model, **kwargs)[source]¶ Starts the exposure transforms pipeline for the given
oasis_model
, i.e. the generation of the canonical exposures files, keys file and finally the Oasis files.All the required resources must be provided either in the model object resources dict or the
kwargs
dict.It is up to the specific implementation of a manager of whether to use the model object resources dict or additional optional arguments in
kwargs
for this process.In a standard implementation of the manager the call to start_files_pipeline should trigger calls to the individual methods for performing file transformations in a normal sequence, e.g.
transform_source_to_canonical transform_canonical_to_model transform_model_to_keys load_canonical_profile generate_oasis_filesand the generated files should be stored as attributes in the given model object’s transforms files pipeline.
-
transform_canonical_to_model
(oasis_model, **kwargs)[source]¶ Transforms the canonical exposures/locations file for a given
oasis_model
object to a format understood by Oasis keys lookup services.All the required resources must be provided either in the model object resources dict or the
kwargs
dict.It is up to the specific implementation of this class of how these resources will be named in
kwargs
and how they will be used to effect the transformation.
-
transform_source_to_canonical
(oasis_model, **kwargs)[source]¶ Transforms the source exposures/locations file for a given
oasis_model
object to a canonical/standard Oasis format.All the required resources must be provided either in the model object resources dict or the
kwargs
dict.It is up to the specific implementation of this class of how these resources will be named in
kwargs
and how they will be used to effect the transformation.The transform is generic by default, but could be supplier specific if required.
-
omdk.exposures.OasisExposuresManager
¶
Oasis exposures manager - manages the exposure management workflow for multiple models, from loading the source exposures and canonical exposures profiles to generating the intermediate files (canonical exposures files, model exposures files, keys files) and finally generating the Oasis files from these.
-
class
exposures.OasisExposuresManager.
OasisExposuresManager
(oasis_models=None)[source]¶ -
-
clear_files_pipeline
(oasis_model, **kwargs)[source]¶ Clears the oasis files pipeline for the given Oasis model object.
- Args:
oasis_model
(omdk.models.OasisModel.OasisModel
): The model object.**kwargs
(arbitary keyword arguments):- Returns:
oasis_model
(omdk.models.OasisModel.OasisModel
): The model object with its Oasis files pipeline cleared.
-
generate_coverages_file
(oasis_model, with_model_resources=True, **kwargs)[source]¶ Generates a coverages file for the given
oasis_model
.
-
generate_gulsummaryxref_file
(oasis_model, with_model_resources=True, **kwargs)[source]¶ Generates a gulsummaryxref file for the given
oasis_model
.
-
generate_items_file
(oasis_model, with_model_resources=True, **kwargs)[source]¶ Generates an items file for the given
oasis_model
.
-
generate_oasis_files
(oasis_model, with_model_resources=True, **kwargs)[source]¶ For a given
oasis_model
generates the standard Oasis files, namelyitems.csv
coverages.csv
gulsummaryxref.csv
-
get_keys
(oasis_model, with_model_resources=True, **kwargs)[source]¶ Generates the Oasis keys CSV file for a given model object, with headers
LocID,PerilID,CoverageID,AreaPerilID,VulnerabilityID
using the lookup service defined for this model.
By default it is assumed that all the resources required for the transformation are present in the model object’s resources dict, specifically its transforms files pipeline - this is indicated by the optional
with_model_resources
variable which isTrue
by default. In this case the generated file is stored in the appropriate attribute of the model object’s transforms files pipeline, the manager’s model dict is updated, and the model object returned.If not then
with_model_resources
should be set toFalse
, in which case all the resources required for the transformation should be present in the optionalkwargs
dict as named arguments. In this case only the generated canonical file is returned.
-
keys_lookup_factory
¶ Keys lookup service factory property - getter only.
getter: Gets the current keys lookup service factory instance
-
load_canonical_profile
(oasis_model, with_model_resources=True, **kwargs)[source]¶ Loads a JSON string or JSON file representation of the canonical exposures profile for a given
oasis_model
, stores this in the model object’s resources dict, and returns the object.
-
models
¶ Model objects dictionary property.
getter: Gets the model in the models dict using the optional
key
argument. Ifkey
is not given then the dict is returned.setter: Sets the value of the optional
key
in the models dict toval
whereval
is assumed to be an Oasis model object (omdk.OasisModel.OasisModel
).If no
key
is given thenval
is assumed to be a new models dict and is used to replace the existing dict.deleter: Deletes the value of the optional
key
in the models dict. If nokey
is given then the entire existing dict is cleared.
-
start_files_pipeline
(oasis_model, with_model_resources=True, **kwargs)[source]¶ Starts the oasis files pipeline for the given Oasis model object, which is the generation of the Oasis items, coverages and GUL summary files from the source exposures file, canonical exposures profile, and associated validation files and transformation files for the source and intermediate files (canonical exposures, model exposures).
- Args:
oasis_model
(omdk.models.OasisModel.OasisModel
): The model object.with_model_resources
: (bool
): Indicates whether to look for resources in the model object’s resources dictionary or in**kwargs
.**kwargs
(arbitrary keyword arguments): Ifwith_model_resources
isFalse
then the filesystem paths (including filename and extension) of the canonical exposures file, the model exposures
-
transform_canonical_to_model
(oasis_model, with_model_resources=True, **kwargs)[source]¶ Transforms the canonical exposures/locations file for a given
oasis_model
object to a format understood by Oasis keys lookup services.By default it is assumed that all the resources required for the transformation are present in the model object’s resources dict, specifically its transforms files pipeline - this is indicated by the optional
with_model_resources
variable which isTrue
by default. In this case the generated file is stored in the appropriate attribute of the model object’s transforms files pipeline, the manager’s model dict is updated, and the model object returned.If not then
with_model_resources
should be set toFalse
, in which case all the resources required for the transformation should be present in the optionalkwargs
dict as named arguments. In this case only the generated canonical file is returned.
-
transform_source_to_canonical
(oasis_model, with_model_resources=True, **kwargs)[source]¶ Transforms the source exposures/locations file for a given
oasis_model
object to a canonical/standard Oasis format.By default it is assumed that all the resources required for the transformation are present in the model object’s resources dict, specifically its transforms files pipeline - this is indicated by the optional
with_model_resources
variable which isTrue
by default. In this case the generated file is stored in the appropriate attribute of the model object’s oasis files pipeline, which is in turn a key in the manager’s models dict. The models dict is updated, and the model object returned.If not then
with_model_resources
should be set toFalse
, in which case all the resources required for the transformation should be present in the optionalkwargs
dict as named arguments. In this case only the generated canonical exposures file is returned.
-
omdk.exposures.OasisFilesPipeline
¶
-
class
exposures.OasisFilesPipeline.
OasisFilesPipeline
(model_key=None, source_exposures_file=None, canonical_exposures_file=None, model_exposures_file=None, keys_file=None)[source]¶ -
canonical_exposures_file
¶ Canonical exposures file property.
getter: Gets the actual file object setter: Sets the file to the specified file object
-
coverages_file
¶ Oasis coverages file property.
getter: Gets the actual file object setter: Sets the file to the specified file object
-
classmethod
create
(model_key=None, source_exposures_file=None, canonical_exposures_file=None, model_exposures_file=None, keys_file=None)[source]¶ Class method that returns an instance of an Oasis files pipeline as used in exposures management.
-
gulsummaryxref_file
¶ GUL summary file property.
getter: Gets the actual file object setter: Sets the file to the specified file object
-
items_file
¶ Oasis items file property.
getter: Gets the actual file object setter: Sets the file to the specified file object
-
keys_file
¶ Oasis keys file property.
getter: Gets the actual file object setter: Sets the file to the specified file object
-
model_exposures_file
¶ Model exposures file property.
getter: Gets the actual file object setter: Sets the file to the specified file object
-
model_key
¶ Model key property - getter only.
getter: Gets the key of model to which the pipeline is attached.
-
oasis_files
¶ Oasis files set property - getter only.
getter: Gets the complete set of generated Oasis files, including items.csv
,coverages.csv
, gulsummaryxref.csv.
-
source_exposures_file
¶ Source exposures file property.
getter: Gets the actual file object setter: Sets the file to the specified file object
-
omdk.keys.OasisKeysLookupFactory
¶
-
class
keys.OasisKeysLookupFactory.
OasisKeysLookupFactory
[source]¶ A factory class to load and run keys lookup services for different models/suppliers.
-
classmethod
create
(model_keys_data_path=None, model_version_file_path=None, lookup_package_path=None)[source]¶ Creates a keys lookup class instance for the given model and supplier - local file paths are required for the model keys data folder, the model version file and the Git repository for the model keys server. Returns a pair
(model_info, klc)
, wheremodel_info
is a dictionary holding model information from the model version file and klc is the lookup service class instance for the model.
-
classmethod
get_keys
(lookup=None, model_exposures=None, model_exposures_file_path=None, success_only=True)[source]¶ Generates keys keys records (JSON) for the given model and supplier - requires an instance of the lookup service (which can be created using the create method in this factory class), and either the model location file path or the string contents of such a file.
The optional keyword argument
success_only
indicates whether only records with successful lookups should be returned (default), or all records.
-
classmethod
get_lookup_class_instance
(lookup_package, keys_data_path, model_info)[source]¶ Get the keys lookup class instance.
-
classmethod
get_lookup_package
(lookup_package_path)[source]¶ Returns the lookup service parent package (called keys_server and located in src in the model keys server Git repository or in var/www/oasis in the keys server Docker container) from the given path.
-
classmethod
get_model_exposures
(model_exposures=None, model_exposures_file_path=None)[source]¶ Get the model exposures/location file data as a pandas dataframe given either the path of the model exposures file or the string contents of such a file.
-
classmethod
get_model_info
(model_version_file_path)[source]¶ Get model information from the model version file.
-
classmethod
save_keys
(lookup=None, model_exposures=None, model_exposures_file_path=None, success_only=True, output_file_path=None, format='oasis_keys')[source]¶ Writes the keys keys records generated by the lookup service for the given model and supplier to a local file - requires a lookup service instance (which can be created using the create method in this factory class), the path of the model location file, the path of output file, and the format of the output file which can be an Oasis keys file (
oasis_keys
) or a simple listing of the records to file (list_keys
).The optional keyword argument
success_only
indicates whether only records with successful lookups should be returned (default), or all records.Returns a pair
(f, n)
wheref
is the output file object andn
is the number of records written to the file.
-
classmethod
omdk.generate_keys
¶
generate_keys.py
is an executable script which can generate and
write Oasis keys (area peril ID, vulnerability ID) for a model, given
the following arguments (in no particular order)
./generate_keys.py -k /path/to/keys/data
-v /path/to/model/version/csv/file
-l /path/to/lookup/service/package
-e /path/to/model/exposures/csv/file
-o /path/to/output/file
[-f <output format - 'oasis_keys' or 'list_keys'>]
When calling the script this way paths can be given relative to the
script, in particular, file paths should include the filename and
extension. The paths to the keys data, lookup service package (Python
package containing the lookup source code), and model version file will
usually be located in the model keys server (Git) repository. If the
repository was created by or is managed by Oasis LMF then the lookup
service package will usually be contained in the src/keys_server
Python subpackage and can be given as the path to that subpackage (see
the OasisPiWind repository as a reference for how to structure an Oasis
keys server repository)
It is also possible to run the script by defining these arguments in a
JSON configuration file and calling the script with option -f
and
the (relative or absolute) path to the file.
./generate_keys.py -f /path/to/script/config/json/file
The JSON file should contain the following keys (in no particular order)
"keys_data_path"
"model_version_file_path"
"lookup_package_path"
"model_exposures_file_path"
"output_file_path"
"output_format"
and the values of the path-related keys should be string paths, given
relative to the location of JSON file. The JSON file is usually placed
in the model keys server repository. The "output_format"
key is
optional - by default the script will generate an Oasis keys file.
Keys records returned by an Oasis keys lookup service (see the PiWind lookup service for reference) will be Python dicts with the following structure
{
"id": <loc. ID>,
"peril_id": <Oasis peril type ID - oasis_utils/oasis_utils.py>,
"coverage": <Oasis coverage type ID - see oasis_utils/oasis_utils.py>,
"area_peril_id": <area peril ID>,
"vulnerability_id": <vulnerability ID>,
"message": <lookup status message>,
"status": <lookup status code - see oasis_utils/oasis_utils.py>
}
The generate_keys.py
script can generate keys records in this
format, and write them to file.
For model loss calculations however ktools requires a keys CSV file with the following format
LocID,PerilID,CoverageID,AreaPerilID,VulnerabilityID
..
..
where the headers correspond to the relevant Oasis keys record fields. The generate_keys.py
script can also generate and
write Oasis keys files.
omdk.generate_oasis_files
¶
generate_oasis_files.py
is an executable script which can generate
Oasis files (items, coverages, GUL summary) for a model, given the
following arguments (in no particular order)
./generate_oasis_files.py -k /path/to/keys/data
-v /path/to/model/version/csv/file
-l /path/to/lookup/service/package
-p /path/to/canonical/exposures/profile/JSON/file
-e /path/to/source/exposures/file
-a /path/to/source/exposures/validation/file
-b /path/to/source/to/canonical/exposures/transformation/file
-c /path/to/canonical/exposures/validation/file
-d /path/to/canonical/to/model/exposures/transformation/file
-x /path/to/xtrans/executable
[-o /path/to/oasis/files/directory]
When calling the script this way paths can be given relative to the
script, in particular, file paths should include the filename and
extension. The paths to the keys data, lookup service package, model
version file, canonical exposures profile JSON, source exposures file,
transformation and validation files, will usually be located in the
model keys server repository. The path to the Oasis files directory is
optional - by default the script will create a timestamped folder in
omdk/runs
with the prefix OasisFiles
.
It is also possible to run the script by defining these arguments in a
JSON configuration file and calling the script using the path to this
file using the option -f
and the (relative or absolute) path to the
file.
./generate_oasis_files.py -f /path/to/script/config/json/file
The JSON file contain the following keys (in no particular order)
"keys_data_path"
"model_version_file_path"
"lookup_package_path"
"canonical_exposures_profile_json_path"
"source_exposures_file_path"
"source_exposures_validation_file_path"
"source_to_canonical_exposures_transformation_file_path"
"canonical_exposures_validation_file_path"
"canonical_to_model_exposures_transformation_file_path"
"xtrans_path"
"oasis_files_path"
and the values of these keys should be string paths, given relative to
the location of the JSON file. The JSON file is usually placed in the
model keys server repository. The "oasis_files_path"
key is optional
- by default the script will create a timestamped folder in
omdk/runs
with the prefix OasisFiles
.
omdk.generate_losses
¶
generate_losses.py
is an executable script which, given Oasis files,
model analysis settings JSON file, model data, and some other
parameters, can generate losses using the installed ktools framework.
The script can be called directly from the command line given the
following arguments (in no particular order)
./generate_losses.py -o /path/to/oasis/files
-j /path/to/analysis/settings/json/file
-m /path/to/model/data
[-r /path/to/model/run/directory]
[-s <ktools script name (without file extension)>]
[-n <number of ktools calculation processes to use>]
[--execute | --no-execute]
When calling the script this way paths can be given relative to the
script, in particular, file paths should include the filename and
extension. The path to the model run directory is optional - by default
the script will create a timestamped folder in omdk/runs
with the
prefix ProgOasis
. The ktools script name and number of calculation
processes are optional - by default the script will create a ktools
script named run_tools.sh
and set the number of calculation
processes to 2. By default executing generate_losses.py
will
automatically execute the ktools losses script it generates. If you
don’t want this provide the (optional) --no-execute
argument. The
default here is automatic execution.
The script copies the analysis settings JSON file to the model run directory and sets up the following folder structure inside
├── analysis_settings.json
├── fifo/
├── input/
├── output/
├── static/
└── work/
Depending on the OS type the model data is symlinked (Linux, Darwin) or
copied (Cygwin, Windows) into the static
subfolder. The input files
are kept in the input
subfolder and the losses are generated as CSV
files in the output
subfolder.
It is also possible to run the script by defining these arguments in a
JSON configuration file and calling the script using the path to this
file using the option -f
and the (relative or absolute) path to the
file.
./generate_losses.py -f /path/to/script/config/json/file'
The JSON file should contain the following keys (in no particular order)
"oasis_files_path"
"analysis_settings_json_file_path"
"model_data_path"
"model_run_dir_path"
"ktools_script_name"
"ktools_num_processes"
"execute"
and the values of the path-related keys should be string paths, given
relative to the location of the JSON file. The JSON file is usually
placed in the model keys server repository. The "model_run_dir_path"
key is optional - by default the script will create a timestamped folder
in omdk/runs
with the prefix ProgOasis
. The
"ktools_script_name"
and "ktools_num_processes"
keys are
optional - by default the script will create a ktools script named
run_tools.sh
and set the number of calculation processes to 2. The
"execute"
key is optional - if present it should be either true
or false
depending on whether you want the generated ktools losses
scripts to be automatically executed or not. The default here is
automatic execution.
omdk.run_model
¶
run_model.py
is an executable “master” script that can run models
end-to-end, i.e. generate losses given model resources, including keys
data, canonical exposure profiles, exposure transformation and
validation files, model data, analysis settings etc., given the
following arguments (in no particular order)
./run_model.py -k /path/to/keys/data/folder
-v /path/to/model/version/file
-l /path/to/lookup/service/package
-p /path/to/canonical/exposures/profile/JSON/file
-e /path/to/source/exposures/file
-a /path/to/source/exposures/validation/file
-b /path/to/source/to/canonical/exposures/transformation/file
-c /path/to/canonical/exposures/validation/file
-d /path/to/canonical/to/model/exposures/transformation/file
-x /path/to/xtrans/executable
-j /path/to/analysis/settings/json/file
-m /path/to/model/data
[-r /path/to/model/run/directory]
[-s <ktools script name (without file extension)>]
[-n <number of ktools calculation processes to use>]
When calling the script this way paths can be given relative to the
script, in particular, file paths should include the filename and
extension. The paths to the keys data, lookup service package, model
version file, canonical exposures profile JSON, source exposures file,
transformation and validation files, and analysis settings JSON file,
will usually be located in the model keys server repository. The path to
the model run directory is optional - by default the script will create
a timestamped folder in omdk/runs
with the prefix ProgOasis
. The
ktools script name and number of calculation processes are also optional
- by default the script will create a ktools script named
run_tools.sh
and set the number of calculation processes to 2.
It is also possible to run the script by defining these arguments in a
JSON configuration file and calling the script using the path to this
file using the option -f
and the (relative or absolute) path to the
file.
./run_model.py -f /path/to/script/config/json/file'
The JSON file should contain the following keys (in no particular order)
"keys_data_path"
"model_version_file_path"
"lookup_package_path"
"canonical_exposures_profile_json_path"
"source_exposures_file_path"
"source_exposures_validation_file_path"
"source_to_canonical_exposures_transformation_file_path"
"canonical_exposures_validation_file_path"
"canonical_to_model_exposures_transformation_file_path"
"xtrans_path"
"analysis_settings_json_file_path"
"model_data_path"
"model_run_dir_path"
"ktools_script_name"
"ktools_num_processes"
and the values of the path-related keys should be string paths, given
relative to the location of the JSON file. The JSON file is usually placed in the model keys server
repository. The "model_run_dir_path"
key is optional - by default
the script will create a timestamped folder in omdk/runs
with the
prefix ProgOasis
. The "ktools_script_name"
and
"ktools_num_processes"
keys are optional - by default the script
will create a ktools script named run_tools.sh
and set the number of
calculation processes to 2.
You can define a separate JSON configuration file for each model, provided you have the model keys server repository and other required model resources available locally.
NOTE: For a given model the JSON script configuration files for
generate_oasis_files.py
, generate_losses.py
and run_model.py
should complement each other, except for generate_losses.py
which
requires the path to Oasis files, not required by run_model.py
. You
can run any of these scripts against a single master script
configuration file, provided that the path to an actual set of Oasis
files is added in order to run generate_losses.py
.
omdk.utils
¶
MDK internal utilities
-
utils.
load_script_args_from_config_file
(script_args_metadict, config_file_path)[source]¶ Returns a script arguments dict from a JSON config file.


Change propagation, widget customization, implementing a more authentic/involved GUI application.
Cells is a more authentic and involved task that tests if a particular approach also scales to a somewhat bigger application. The two primary GUI-related challenges are intelligent propagation of changes and widget customization. Admittedly, there is a substantial part that is not necessarily very GUI-related but that is just the nature of a more authentic challenge. A good solution’s change propagation will not involve much effort and the customization of a widget should not prove too difficult. The domain-specific code is clearly separated from the GUI-specific code. The resulting spreadsheet widget is reusable.
Cells is directly inspired by the SCells spreadsheet example from the book Programming in Scala. Please refer to the book (or the implementations in this repository) for more details especially with respect to the not directly GUI-related concerns like parsing and evaluating formulas and the precise syntax and semantics of the spreadsheet language.
After opening a code link below, hit the '.' key to open GitHub's browser editor for improved reading experience.


National campaign for the Government of the State of Pernambuco, Brazil
Empetur - Governo de Pernambuco
Director: Pio Figueiroa
Assistant
Director: Henrique Lapa
Director of photography: Ariel Schvartzman
Production: RTV/485
Filmes
Local campaign for the Government of the State of Pernambuco, Brazil
Empetur - Governo de Pernambuco
Director: Pio Figueiroa
Assistant
Director: Henrique Lapa
Director of photography: Ariel Schvartzman
Nagem - Series of 4 ads
Client: Nagem
Agency: Black Ninja
Director: Pablo Polo
Assistant Director: Henrique
Lapa
Director of Photography: Beto Martins
Production: VDG
Local campaign for the Government of the State of Pernambuco, Brazil
Governo de Pernambuco
Director: Bruno Duzi
Assistant Director: Henrique Lapa
Director of
photography: JP Maggera
Production: RTV/485 Filmes


Abstract parser interface. More...
#include <Parser.h>
Public Member Functions | |
| virtual | ~AbstractParser () |
| Destructor. More... | |
| virtual bool | parse (const char *input)=0 |
| Parser function interface. More... | |
| virtual const int8_t & | index () |
| Get matched index of after parsing. More... | |
Protected Member Functions | |
| AbstractParser () | |
| Constructor. More... | |
Protected Attributes | |
| int8_t | m_index |
Abstract parser interface.
|
protected |
Constructor.
The method is protected to disable instantiation.
|
virtual |
Destructor.
|
virtual |
Get matched index of after parsing.
| !-1 | Matched. (The value is the index selected from the condition given when instantiating the class.) |
| -1 | Parsing failed, so there is no matched index. |
|
pure virtual |
Parser function interface.
| [in] | input | String you want to parse. |
Implemented in Utility::HexStringParser, Utility::StringGroupParser, Utility::CharGroupParser, and Utility::NilParser.
|
protected |


For best results, clean your Nike shoes immediately after exposing them to dirt.
Remove excess dirt first using a soft-bristled brush (shoe brush or old toothbrush) to clean the outsole.
Mix warm water and a small amount of laundry detergent to create a slightly soapy mixture.
Apply a small amount of the water/detergent mixture to a sponge, soft cloth or soft brush and clean affected areas.
Apply a small amount of warm water to another sponge or soft cloth to remove any excess detergent.
Air dry the shoes at room temperature.
Repeat these steps to attempt to remove persistent stains. Nike doesn't recommend any alternative cleaning methods, placing your shoes in a washing machine or dryer, or using any other products on your shoes such as bleach or other chemicals.
Saddle soap can soften leather and is recommended only on leather components of shoes that aren't subjected to excessive stress. Don't use saddle soap on soccer cleats, basketball shoes, golf shoes, training shoes or any other shoes designed for activities involving lateral movement.
Remove the insoles from your shoes.
Follow the same shoe cleaning steps listed above.
Air dry completely before putting the insoles back in the shoes.
If these steps don't reduce shoe odor, replace the insoles. Replacement insoles are available at most sporting goods and shoe stores.


@RegisterExtension
which have a wrong type or are not declared as static when it's required.
Such extensions won't be registered correctly and could lead to test startup failures.
Example:
public class MyTest {
@RegisterExtension
private JUnit4Rule rule;
}


User Registration
First Name
Last Name
Password
Email
Mobile
Date of Birth
Gender
Male
Female
Transgender
Country
India
Sweden
Japan
Korea
United Kingdom
Address
Register
Clear


Challenge Detail
Name:
{{ challenge.name }}
Business Name:
{{ challenge.business_name }}
Business Website:
Business Email:
{{ challenge.business_email }}
Description:
{{ challenge.description }}
{{ challenge.geometry }}
Date Time:
{{ challenge.updated_at }}


frame-objects COLLECTION FRAME_NAME
Returns the object list of a frame.
If I want to get a list of objects (JSON array of objects) for a frame named “captions-dates-locations” from my collection called “photos.ds” I would do the following (will be using the -p
option to pretty print the results)
dataset frame-objects -p photos.ds captions-dates-locations


Shared coding conventions allow teams to collaborate efficiently. This rule checks that all variables match the following regular expression: ^(::)?([a-z][a-z0-9_]*::)*[a-z][a-z0-9_]*$
This naming convention is compliant with the more strict Puppet 4 naming convention.
file { $myFile: # Noncompliant ensure => file, mode => $Mode, # Noncompliant }
file { $my_file: ensure => file, mode => $mode, }


Bullish strategy.
- Pair: EUR/USD.
- Timeframe: 15m.
- SMA: 1500 periods.
- Knoxville Divergence: 50 periods.
- Exit: 18 periods.
- Emergency Stop Loss: 400 pips under the entry price.
- Valid Period: 01/01/2017 – 30/09/2017.
Bearish strategy.
- Pair: USD/CHF
- Timeframe: 15m.
- SMA: 2000 periods.
- Knoxville Divergence: 50 periods.
- Exit: 32 periods.
- Emergency Stop Loss: 500 pips above the entry price.
- Valid Period: 01/01/2017 – 30/09/2017.
Statistics.
Here you will see several pieces of statistical data so you can understand better how this strategy has behaved. These statistics have been calculated including commissions (2 pips per trade).
- Strategy's working period: 01/07/2008 – 01/01/2017
- Number of trades: 1205.
- Profits (in pips): 2289.5 pips
- Winning trades percentage: 52,3%.
- Average win: 16.7 pips.
- Average loss: 13.1 pips.
- Mean: 1.9 pips.
- Standard deviation: 21.6 pips.
- Sharpe Ratio: 0.088
- Sortino Ration: 1.24
- SQN: 3.05


- Journal List
- Br J Clin Pharmacol
- v.72(2); 2011 Aug
- PMC3162661
Eltrombopag increases plasma rosuvastatin exposure in healthy volunteers
Abstract
AIM
Eltrombopag, an oral, nonpeptide thrombopoietin receptor agonist, inhibits the organic anion transporting polypeptide 1B1 (OATP1B1) and breast cancer resistance protein (BCRP) in vitro. OATP1B1 is important for hepatic uptake of rosuvastatin and inhibition of this transporter could reduce cholesterol-lowering efficacy and increase the risk of exposure-dependent toxicities. In contrast, BCRP is an efflux transporter and inhibition of this transporter could increase both hepatic and plasma rosuvastatin concentrations, resulting in increased efficacy and toxicity. To determine if co-administration of eltrombopag with rosuvastatin alters plasma rosuvastatin exposure, an open-label study was conducted in 42 healthy adult subjects.
METHODS
Subjects received rosuvastatin and eltrombopag orally: day 1, rosuvastatin 10 mg single dose; days 6 to 9, eltrombopag 75 mg once daily; day 10, eltrombopag 75 mg once daily and rosuvastatin 10 mg single dose. Adverse event assessments were performed daily and at the follow-up visit. Plasma samples for pharmacokinetic analysis were collected days 1 to 5 and days 10 to 14.
RESULTS
Co-administration of eltrombopag with rosuvastatin increased geometric mean (90% confidence interval) plasma rosuvastatin AUC(0,∞) by 55% (42%, 69%) and Cmax by 103% (82%, 126%) in the overall study population, with a larger interaction in the non-Asian compared with Asian subjects.
CONCLUSIONS
Concomitant administration of eltrombopag with rosuvastatin was associated with increased rosuvastatin exposure. The therapeutic index of HMG Co-A reductase inhibitors may be reduced by the concomitant use of eltrombopag. In subjects taking eltrombopag, a reduced dose of HMG Co-A reductase inhibitors may be needed.
WHAT IS ALREADY KNOWN ABOUT THIS SUBJECT
-
OATP1B1 is important for hepatic uptake of rosuvastatin and BCRP is important for rosuvastatin absorption and elimination. Eltrombopag inhibits OATP1B1 and BCRP in vitro at clinically relevant concentrations. Inhibition of these transporters could change cholesterol-lowering efficacy and increase the risk of exposure-dependent toxicities. To determine if co-administration of eltrombopag with rosuvastatin alters plasma rosuvastatin exposure, an open-label study was conducted in 42 healthy adult subjects.
WHAT THIS STUDY ADDS
-
Concomitant administration of eltrombopag with rosuvastatin was associated with increased rosuvastatin exposure via inhibition of drug transporters. The therapeutic index of HMG Co-A reductase inhibitors may be reduced by the concomitant use of eltrombopag. In subjects taking eltrombopag, a reduced dose of HMG Co-A reductase inhibitors may be needed.
Introduction
Eltrombopag (GlaxoSmithKline) is an oral, nonpeptide thrombopoietin receptor agonist approved for the treatment of chronic immune thrombocytopenia (ITP). It is also being investigated for the treatment of thrombocytopenia due to other aetiologies including chronic liver disease and hepatitis C virus [1–3]. Eltrombopag binds to the transmembrane domain of the thrombopoietin receptor and increases platelet counts by stimulating proliferation and differentiation of megakaryocytes [4].
In preclinical studies, eltrombopag inhibited the organic anion transporting polypeptide 1B1 (OATP1B1) and breast cancer resistance protein (BCRP). Eltrombopag was also identified as a BCRP substrate in vitro. OATP1B1 is highly expressed in the liver and involved in the hepatic uptake of all HMG-CoA reductase inhibitors (statins) [5]. OATP1B1 is important for rosuvastatin disposition as demonstrated by genetic polymorphism, where subjects with the homozygous OATP1B1 (SLCO1B1) c.521CC genotype had 65% higher rosuvastatin mean area under the curve (AUC(0,48 h)) than those with the homozygous c.521TT (control) genotype [6]. The OATP1B1 (SLCO1B1) c.388GG genotype in combination with the c.521CC genotype (SLCO1B1*15/*15) has also been associated with higher plasma rosuvastatin exposure [7]. BCRP is an efflux transporter that transports drugs from the liver into bile and also limits intestinal drug absorption. BCRP is important for rosuvastatin disposition as demonstrated by genetic polymorphism, where subjects with the heterozygous BCRP (ABCG2) c.421CA or homozygous c.421AA genotypes had approximately two-fold the rosuvastatin AUC(0,∞) compared with those with the homozygous c.421CC (control) genotype [8, 9]. The ABCG2 c.421AA genotype was associated with greater reductions in low-density lipoprotein (LDL) cholesterol in subjects receiving rosuvastatin therapy [10].
Rosuvastatin has known transporter-mediated drug interactions, such as its interaction with gemfibrozil and cyclosporin [11, 12]. The objective of this study was to evaluate the impact of eltrombopag on plasma rosuvastatin exposure.
Methods
Study design
An open-label, single sequence study was conducted at clinical research sites in Singapore and the United States in 42 healthy adult men and women. All subjects provided written, informed consent. Subjects received rosuvastatin and eltrombopag orally in the following sequence: day 1, rosuvastatin 10 mg single dose; day 6 through day 9, eltrombopag 75 mg once daily; day 10, eltrombopag 75 mg once daily and rosuvastatin 10 mg single dose. This study was designed and monitored in accordance with Good Clinical Practice and the Declaration of Helsinki. The individual Institutional Review Boards at each study site approved the protocol before the study started.
To ensure treatment compliance and continuous safety monitoring, subjects received all doses of study drugs at the clinical research centre and remained in the clinical research unit from day −1 through day 5 and from days 10 through 14. Subjects returned for a follow-up visit approximately 7 to 14 days after the last dose of study medication. The duration of each individual's participation in the study from initial screening to follow-up was approximately 4 weeks.
Inclusion criteria required that participants be healthy. Male and non-pregnant female subjects 18 to 64 years weighing at least 50 kg for men and 45 kg for women were eligible for enrolment. Candidates were ineligible if they had any clinically relevant abnormality identified by prestudy screening history, physical examination, or laboratory testing, including electrocardiogram (ECG) abnormalities, cardiovascular or coagulation disorders, evidence of drug or alcohol abuse or tobacco use, a positive test for HIV, hepatitis B or hepatitis C virus, or use of prescription or non-prescription medications within 7 days (14 days for enzyme-inducing drugs) before receiving the first dose of study drug.
Adverse event (AE) assessments were performed daily for the duration of the study and at the follow-up visit. Standard meals were provided on study day −1 to day 5 and days 10 to 14. Participants fasted 8 h before and 4 h after administration of either study drug. Serial 3 ml blood samples for pharmacokinetic (PK) analysis were collected prior to and 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 12, 24, 36, 48, 60, 72, 84 and 96 h after single dose rosuvastatin administration on days 1 and 10. A blood sample was obtained on day −1 for the purpose of genotyping the OATP1B1 (SLCO1B1), BCRP (ABCG2) and NTCP [sodium taurocholate co-transporting polypeptide (SLC10A1)] transporters.
Analyses
Genotyping for polymorphisms in OATP1B1 (SLCO1B1) T521C and A388G and BCRP (ABCG2) C421A and NTCP (SLC10A1) exon 3 *3 and exon 4 *2, *4, and *5 was done. Regions spanning the single nucleotide polymorphisms (SNPs) of interest were first amplified from genomic DNA via polymerase chain reaction (PCR) using specific primers as presented in Table 1. PCR product sizes and purity were confirmed by agarose gel electrophoresis against a 100 base pair (bp) molecular weight marker.
For OATP1B1 (SLCO1B1) T521C and A388G, and NTCP (SLC10A1) exon 3 *3 and exon 4 *2, *4, and *5, the amplified fragments were subsequently analyzed by bidirectional sequencing using Bigdye V3.1 termination cycle sequencing kit (Applied Biosystems, Foster City, CA) on an ABI Avant 3100 genetic analyzer (Applied Biosystems). All polymorphisms were called using mutation analysis software (Mutation Surveyor V5.1) and qualified additionally by predetermined sample controls.
The BCRP (ABCG2) C421A polymorphism was genotyped by Taa I PCR restriction fragment length polymorphism. Briefly, the amplified 289 bp PCR fragment encompassing the SNP of interest was subsequently incubated at 65°C with three units of a restriction enzyme (Taa I) for 3 h. The digested amplified products were loaded onto a 3% agarose gel to verify digested product sizes. A wt/wt (cc/cc) genotype would reveal a digested product size of 256 bp whereas a mt/mt (aa/aa) genotype would resist digestion by the enzyme to remain at 289 bp. Heterozygous genotypes exhibit both product sizes (289 bp and 256 bp).
Plasma PK samples collected on days 1 and 10 were assayed for rosuvastatin using a validated analytical method based on solid phase extraction, followed by high-performance liquid chromatography coupled to tandem mass spectrometry (HPLC/MS/MS) analysis. Using a 100 µl aliquot of plasma, the lower limit of quantification for the rosuvastatin assay was 0.2 ng ml−1 and the higher limit of quantification was 30 ng ml−1. Each batch of plasma samples was run against freshly prepared duplicate calibration standards (n = 8). Imprecision and inaccuracy between assays were <14%. Quality control (QC) samples at three concentrations (0.5, 5, and 25 ng ml−1) were assayed along with study samples and the calculated QC sample concentrations deviated by <15% from the actual concentrations. Plasma PK samples collected on day 10 were assayed for eltrombopag using a validated analytical method based on protein precipitation, followed by HPLC/MS/MS analysis. Using a 50 µl aliquot of plasma, the lower limit of quantification for the eltrombopag assay was 100 ng ml−1 and the higher limit of quantification was 50 000 ng ml−1. Each batch of plasma samples was run against freshly prepared duplicate calibration standards (n = 9). Imprecision and inaccuracy between assays were <14%. QC samples at three concentrations (400, 4000, and 40 000 ng ml−1) were assayed along with study samples and the calculated QC sample concentrations deviated by <15% from the actual concentrations.
The primary PK endpoints were maximum plasma concentration (Cmax) and area under the plasma concentration vs. time curve starting from dosing and extrapolated to infinity (AUC(0,∞)) of rosuvastatin when administered alone or co-administered with eltrombopag. Cmax and the first time to reach Cmax (tmax) were the actual observed values. The AUC was calculated using the linear trapezoidal rule for each incremental trapezoid and the log trapezoidal rule for each decremental trapezoid. The AUC from time zero to the last measurable concentration (AUC(0,τ)) and AUC(0,∞) was determined. Values for AUC(0,∞) were estimated as the sum of AUC(0,τ) and Ct divided by the elimination rate constant (λz), where Ct was the last observed quantifiable concentration.
Steady-state plasma eltrombopag Cmax and AUC over a dosing interval (AUC(0,τ)) were estimated for the combination regimen only. In addition, plasma eltrombopag trough concentrations collected on day 10 prior to administration of rosuvastatin and 24 h after rosuvastatin co-administration were measured.
To assess the effects of eltrombopag on rosuvastatin PK, log transformed plasma rosuvastatin AUC(0,∞) and Cmax were analyzed separately by analysis of variance (anova) fitting terms for treatment and subject. Point estimates and associated 90% confidence intervals (CI) for the differences were constructed using the appropriate error term. The point and interval estimates on the log scale were then back-transformed to give point and interval estimates for the ratios. Plasma eltrombopag and rosuvastatin PK parameters were summarized by treatment and by race and gender within treatment. Plasma rosuvastatin concentration–time profiles were plotted by treatment, race and gender. Plasma rosuvastatin AUC(0,∞) was plotted by genotype combination (approach 2 as described in the following paragraph). Subgroup analyses were conducted as secondary analyses. Similar to the primary statistical analysis, plasma rosuvastatin PK values were compared between treatments for subgroups based on race (Asian vs. non-Asian) and gender.
Multivariate analyses of the relationship between day 1 plasma rosuvastatin AUC(0,∞) and Cmax and potential covariates was completed. The analysis included race (Asian vs. non-Asian), gender, body weight, and OATP1B1 (SLCO1B1) A388G and T521C and BCRP (ABCG2) C421A genotypes. Genotypes were included three ways. Approach 1: each gene variant was included separately. Approach 2: SLCO1B1 haplotype and ABCG2 genotype combinations were categorized, Category 1 included SLCO1B1 haplotypes *1a/*1a, *1a/*1b, and *1b/*1b, Category 2 included SLCO1B1 haplotypes *1a/*15 and *1b/*15, Category 3 included the ABCG2 c.421CA genotype in combination with SLCO1B1 haplotypes *1a/*1a, *1a/*1b, or *1b/*1b and Category 4 included the ABCG2 c.421CA genotype in combination with SLCO1B1 haplotypes *1b/*15 or *15/*15 and the ABCG2 c.421AA genotype in combination with SLCO1B1 haplotype *1b/*1b. Approach 3: combinations of gene variants c.388AA, c.388AG, c.521TT, c.521TC and c.421CC were assigned zero, c.388GG, c.521CC and c.421CA were assigned 1 and c.421AA was assigned 2, and the scores were summed across the three gene variants (possible score of 0 to 4).
Results
Demographics and genotypes
Similar numbers of Asian and non-Asian subjects were enrolled in the study (Table 2). Of the genotypes evaluated in the current study, only the OATP1B1 (SLCO1B1) A388G genotypes were relatively evenly distributed overall and within Asian and non-Asian groups (Table 3). The majority of subjects had homozygous wild-type OATP1B1 (SLCO1B1) c.521TT and BCRP (ABCG2) c.421CC genotypes, with 20 to 40% having the heterozygous genotype (Table 3). There was a broad range of OATP1B1 (SLCO1B1) haplotype and BCRP (ABCG2) genotype combinations (Table 3).
Pharmacokinetics
Race (P < 0.001) and gender (P < 0.05) were retained as significant predictors of plasma rosuvastatin AUC(0,∞) and Cmax in the final multivariate models where genotype by approach 1 and approach 2 were tested. Race (P < 0.001), gender (P < 0.05) and genotype (P < 0.05) were retained in the final model as significant predictors of plasma rosuvastatin AUC(0,∞) and Cmax where genotype by approach 3 was tested. Body weight was not a significant covariate in any of the analyses. Only one of 21 Asian subjects was female, so the gender effect was driven by data within the non-Asian group (seven of 18 non-Asian subjects were female). Asian participants had a 109% higher rosuvastatin AUC(0,∞) and a 139% higher Cmax compared with non-Asian subjects when rosuvastatin was administered alone (Table 4). Within the non-Asian population, female participants had 50% higher rosuvastatin AUC(0,∞) and 84% higher Cmax compared with male subjects when rosuvastatin was administered alone.
Co-administration of eltrombopag with rosuvastatin increased plasma rosuvastatin AUC(0,∞) by 55% and Cmax by 103% in the overall study population compared with administration of rosuvastatin alone (Table 4). The impact of eltrombopag on plasma rosuvastatin exposure differed by race. Plasma rosuvastatin AUC(0,∞) increased by 88% and Cmax increased 165% in non-Asian subjects, whereas AUC(0,∞) increased by 32% and Cmax increased 61% in Asian subjects (Table 4). Median plasma rosuvastatin concentration–time profiles are displayed for the overall population and by race for each treatment in Figure 1. The impact of eltrombopag on plasma rosuvastatin exposure appeared to differ by gender within the non-Asian population (Table 4).
Subjects with combined genotype scores (approach 3) of 2–3 had higher plasma rosuvastatin exposures than subjects with scores of 0–1, and there was also a trend for higher plasma rosuvastatin exposures for subjects in category 4 (approach 2). However, given the small sample size, it is difficult to draw firm conclusions regarding the relationship between genotype and plasma rosuvastatin exposure. Plasma rosuvastatin AUC(0,∞) vs. genotype combination (approach 2) are displayed in Figure 2, along with race and gender details.
For the overall population, the geometric mean of plasma eltrombopag Cmax was 8.00 µg ml−1 and AUC(0,τ) was 102 µg ml−1 h, and plasma eltrombopag exposures were similar between Asian and non-Asian subjects and between the BCRP (ABCG2) c.421CC and c.421CA genotypes (Table 5). The one subject (Asian male) with the c.421AA genotype had the highest plasma eltrombopag AUC(0,τ) (247 µg ml−1 h), but the exposure was similar to the highest AUC(0,τ) (227 µg ml−1 h) observed for an Asian male subject with the c.421CC genotype. When races were combined, plasma eltrombopag exposure was similar between males and females (Table 5), but within the non-Asian group, women had approximately 46% higher plasma eltrombopag AUC(0,τ) (126 vs. 86 µg ml−1 h) and 37% higher Cmax (9.48 vs. 6.94 µg ml−1). Median (range) eltrombopag trough concentrations of 2.98 µg ml−1 (1.14–6.97 µg ml−1) collected on day 10 prior to co-administration of rosuvastatin were similar to trough concentrations of 3.22 µg ml−1 (1.22–6.94 µg ml−1) collected 24 h after co-administration of a single dose of rosuvastatin.
Safety
AEs were reported by 10% to 21% of subjects per treatment. AEs reported by more than one subject on a given treatment included gastroenteritis, headache and upper respiratory infection. No serious AEs were reported by study participants. Subjects experienced no clinically significant changes in vital signs, ECG abnormalities or QTc prolongation. Increased platelet counts were observed in several subjects following administration of eltrombopag. At the follow-up visit, 16 subjects (38%) had platelet counts >400 Gi l−1 (range 415–684 Gi l−1), the upper limit of normal. Changes from baseline in these individuals ranged from 32% to 113%. In these subjects, platelet counts decreased to normal no later than day 117. Because lens changes have been observed in preclinical animal studies and in clinical studies, ophthalmic assessments were conducted in this study. No changes in ocular status due to cataracts were observed during the study.
Discussion
This study was conducted because in vitro data identified eltrombopag as an inhibitor of both OATP1B1 and BCRP with IC50s of 2.7 µm (1.19 µg ml−1). Eltrombopag concentrations achieved clinically are higher than this IC50 value (Table 5), and OATP1B1 and BCRP are important for rosuvastatin disposition. Statins are widely used cholesterol-lowering agents [13] and are generally used as chronic therapy, but they are associated with significant toxicities, such as rhabdomyolysis and increases in liver transaminases, the incidence of which can increase in the presence of elevated plasma drug concentrations. In addition, the efficacy of statins can be reduced if their uptake into the liver is impaired. Thus, drug interactions involving statins can be clinically important for both safety and efficacy. The central finding of the study was that co-administration of eltrombopag 75 mg once daily with a single dose of rosuvastatin 10 mg increased plasma rosuvastatin Cmax by 103% and AUC(0,∞) by 55% in the overall study population compared with rosuvastatin alone (Table 4).
Because it was known that Asian subjects have higher rosuvastatin exposures than non-Asian subjects [7], this study enrolled subjects at one site in Singapore and one site in the United States. Consistent with previous data, Asian race was associated with higher plasma rosuvastatin exposure, with Asian subjects having approximately twice the exposure as non-Asian subjects enrolled in the current study when rosuvastatin was given alone. Interestingly, the non-Asian group studied by Lee et al. [7] was composed of White subjects, whereas the non-Asian group in the current study included a high percentage of African American subjects. The observed interindividual variability in plasma rosuvastatin exposure could be due to different genetic polymorphisms that encode drug-metabolizing transporters [14]. It was anticipated that inhibition of OATP1B1 by eltrombopag would have a lesser effect on plasma rosuvastatin exposure in Asian subjects compared with non-Asian subjects, whose transporter activity is more functional, and this was confirmed when the drug interaction results were summarized by race (Table 4).
OATP1B1 (SLCO1B1) T521C polymorphisms independently and in combination with the c.388GG polymorphisms (SLCO1B1*15/*15) have not been associated with racial differences in rosuvastatin PK, but have been associated with rosuvastatin PK variability in White subjects [7]. BCRP C421A polymorphisms have been associated with rosuvastatin PK variability as well [8]. The study was not designed to stratify enrolment by SLCO1B1 A388G, SLCO1B1 T521A or ABCG2 C421T genotypes or by SLCO1B1 haplotype and ABCG2 C421A genotype combinations. Of the gene variants evaluated in the current study, only SLCO1B1 A388G genotypes, which have not been independently associated with plasma rosuvastatin exposure, were relatively evenly distributed across the enrolled population. In a multivariate analysis where each gene variant was included separately, genotype was not significantly associated with plasma rosuvastatin exposure when race, gender and body weight were included in the model. In multivariate analyses including SLCO1B1 haplotype and ABCG2 genotype combinations, there was some association between haplotype and genotype combinations and plasma rosuvastatin exposure when race, gender and body weight were included in the model, but given the small sample size within each combination, it is difficult to draw conclusions (Figure 2).
The finding of statistically significant higher plasma rosuvastatin exposures in female subjects has not been reported in the literature to our knowledge. However, there was a trend for higher exposures reported for Chinese female healthy volunteers [15].
Because the in vitro inhibition potency of eltrombopag is similar for OATP1B1 and BCRP and because genetic polymorphisms in both transporters are known to be associated with rosuvastatin exposure, it is probable that the increased rosuvastatin exposure observed with eltrombopag co-administration is due to inhibition of both transporters. Inhibition of OATP1B1 increases plasma rosuvastatin exposure by reducing the hepatic uptake; in this scenario, rosuvastatin efficacy may be reduced and toxicity may be increased. In contrast, inhibition of BCRP increases plasma rosuvastatin exposure by enhancing rosuvastatin absorption and/or by inhibiting rosuvastatin elimination in the bile; in this scenario rosuvastatin efficacy and toxicity may both be increased. In vitro evidence also suggests that rosuvastatin is a substrate for other hepatic uptake transporters including OATP1B3, OATP2B1, OATP1A2, as well as a substrate for the bile acid uptake transporter NTCP [13]. It is not known if eltrombopag has an impact on these other transporters.
OATP1B1 is highly expressed on the basolateral (sinusoidal) membrane of hepatocytes and involved in the hepatic uptake of all HMG-CoA reductase inhibitors (statins) [5, 13]. However, the importance of OATP1B1 on the HMG-CoA reductase inhibitors' disposition varies among the drugs of this class. For example, subjects with the homozygous OATP1B1 (SLCO1B1) 521CC genotype had 1.65- to 3.21-fold higher exposures of rosuvastatin, pravastatin, simvastatin, lovastatin and atorvastatin than those with the homozygous 521TT (control) genotypes [6, 16, 17]. In contrast, fluvastatin exposure was not different among the T521C genotypes, further suggesting that OATP1B1 may not be important for fluvastatin disposition. BCRP is highly expressed on the apical membrane of enterocytes of the small intestine and the bile canalicular membrane of the hepatocyte and involved in the efflux of some statins out of the intestine and into the bile. BCRP polymorphisms have been associated with rosuvastatin, atorvastatin, fluvastatin and simvastatin lactone (but not acid), but not pravastatin or pitavastatin [8, 9, 18, 19].
Given that exposures to several HMG-CoA reductase inhibitors are associated with OATP1B1 (SLCO1B1) and/or BCRP (ABCG2) polymorphisms, the results of the eltrombopag-rosuvastatin interaction study may be extended to other statins. In subjects who were co-administered eltrombopag and rosuvastatin, increased rosuvastatin Cmax (mean 103% increase) and AUC(0,∞) (mean 55% increase) were observed. This suggests that clinicians should consider reducing a subject's dose of statin when co-administered with eltrombopag. Monitoring side effects, clinical chemistry, and lipid concentrations is warranted in subjects receiving both eltrombopag and a statin. As noted by other investigators, most clinically significant drug–drug interactions involving lipid-lowering drugs can be avoided by appropriate drug selection and dosing [5].
The impact of rosuvastatin on plasma eltrombopag PK was not formally assessed. However, eltrombopag trough concentrations collected prior to co-administration of rosuvastatin were similar to trough concentrations collected 24 h after co-administration of a single dose of rosuvastatin. In addition, plasma eltrombopag exposure for the 75 mg once daily regimen (in combination with a single dose of rosuvastatin) was generally as expected based on plasma eltrombopag exposures observed in other eltrombopag studies [20–22]. Therefore, there does not appear to be a significant impact of rosuvastatin on plasma eltrombopag PK.
Plasma eltrombopag exposures collected in the presence of rosuvastatin were similar between Asian and non-Asian subjects. This is inconsistent with previous studies that have shown approximately two-fold higher plasma eltrombopag exposures in Asian vs. non-Asian subjects [21, 22]. In these prior studies, the non-Asian populations were predominantly White/Caucasian, whereas, in the current study, the non-Asian population included a high percentage of African Americans. Within the non-Asian population, female subjects had higher plasma eltrombopag exposure, which is consistent with previous reports [22]. Eltrombopag is a BCRP substrate and plasma eltrombopag exposure was similar between c.421CC and c.421CA genotypes. Although the one subject (Asian male) with the c.421AA genotype had the highest plasma eltrombopag AUC(0,τ) (247 µg ml−1 h), the exposure was similar to the highest AUC(0,τ) (227 µg ml−1 h) observed for an Asian male subject with the c.421CC genotype. Given the limited data for the c.421AA genotype, no conclusions can be drawn as to whether this genotype is associated with plasma eltrombopag exposure.
In conclusion, concomitant administration of eltrombopag with rosuvastatin was associated with increased rosuvastatin exposure. The therapeutic index of HMG Co-A reductase inhibitors may be reduced by the concomitant use of eltrombopag. In subjects taking eltrombopag, a reduced dose of HMG Co-A reductase inhibitors may be needed.
Acknowledgments
The authors thank Mark Dana, Sandra Saouaf, PhD and AOI Communications, L.P., for assistance in preparing this manuscript.
Competing Interests
Alicia Allred, Carolyn Bowen and Mary Beth Wire are employees of GlaxoSmithKline (GSK), and are stock holders. Bin Peng and Jung Wook Park were employees of GSK during the time that the study was conducted, and are stock holders. Daphne Williams was an employee of GSK during the time that the study was conducted. Edmund Lee does not have conflicts of interest to disclose.
REFERENCES
Formats:
- Article
- |
- PubReader
- |
- ePub (beta)
- |
- PDF (1.1M)
- |
- Citation