Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Initial commit
  • Loading branch information
Reza committed Oct 8, 2019
1 parent 8b74686 commit b444d4ab97c21c3631717fa46f0ddc4466522dfc
Show file tree
Hide file tree
Showing 81 changed files with 11,846 additions and 0 deletions.
@@ -0,0 +1,85 @@
plugins {
id "org.sonarqube" version "2.6"
}

group 'com.bluemarlin.ims.imsservice'

def versionName() {
return '1.0.0.0'
}

sonarqube {
properties {
property 'sonar.projectName', 'BlueMarlin'
}
}

subprojects {
apply plugin: "java"
sourceCompatibility = 1.8
targetCompatibility = 1.8
apply plugin: 'project-report'

[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
ext {
commonsLang3Version = '3.4'
junitVersion = '4.12'
}
configurations {
compile.exclude group: 'ch.qos.logback'
}
repositories {
maven { url 'http://repo1.maven.org/maven2/' }
maven { url 'https://maven.google.com' }
}

dependencies {
testCompile group: 'junit', name: 'junit', version: "${junitVersion}"
compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.1'
compile group: 'org.apache.commons', name: 'commons-compress', version: '1.16.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.6'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.6'
compile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: '6.2.0'
}
}


project(':imsservice') {
apply plugin: 'java'
apply plugin: 'war'

war.baseName = 'imsservice'
project.webAppDirName = 'src/main/webapp'
sourceSets {
main {
java {
srcDir 'src/main/java'
}
}
}

dependencies {
compile group: 'org.springframework', name: 'spring-web', version: "4.2.4.RELEASE"
compile group: 'org.springframework', name: 'spring-webmvc', version: '4.2.4.RELEASE'
compile group: 'org.springframework', name: 'spring-context', version: '4.2.4.RELEASE'
compile group: 'org.springframework', name: 'spring-context-support', version: '4.2.4.RELEASE'
compile group: 'org.springframework', name: 'spring-jms', version: '4.2.4.RELEASE'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.13'
compile group: 'org.glassfish.jersey.core', name: 'jersey-common', version: '2.29'
compile group: 'org.apache.commons', name: 'commons-lang3', version: "${commonsLang3Version}"
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.11.0'
compile group: 'com.lmax', name: 'disruptor', version: '3.4.2'
compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.2'
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.0'
compile group: 'org.json', name: 'json', version: '20160810'
}

test {
testLogging {
events "passed", "skipped", "failed"
}
}
}


@@ -0,0 +1,15 @@
<code_scheme name="Default copy" version="173">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="20" />
</JavaCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="METHOD_BRACE_STYLE" value="2" />
<option name="LAMBDA_BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
</codeStyleSettings>
</code_scheme>
@@ -0,0 +1,14 @@
### What is IMS Service?

IMS Service provided online services for Inventory Management System. These services are:

1. Impression Inventory Query: This service returns amount of inventories for a specific criteria in a period of time. The service considers existing bookings.
2. User Inventory Query: This service returns number of unique users that match specific criteria in a period of time.
3. Book Inventory: This service is to book demanded amount of impression for a specific criteria.

The IMS Service Project explains data structure for Impression Inventory, User Inventory and Book Inventory systems.
The Impression Inventory service also contains algorithms to efficiently calculate amount of inventories from raw predicted data points and booked inventories.


### Install
Refer to doc/build-*.md for instructions on installing IMS.
@@ -0,0 +1,187 @@
### Book Inventory
##### Description
> This end-point books a number of inventory for a time period.
##### Method: POST
##### URL: http://service-domain/imsservice/api/bookings
#####POST Body:
```sh
{
targeting_channel:<ucdocument>,
ranges: [ {
sd:<start-date date in yyyy-mm-dd>,
ed:<end-date date in yyyy-mm-dd>,
sh:<start-hour in hh>,
eh:<end-hour in hh>} …]
price: <CPC price> numeric format.
advId: advertiser id
}
The following attributes are used in targeting channel:
1) pm: Price Model – CPM/CPC/CPD/CPT
2) ai: Ad slot - list
3) ipl: Geo-location – list of city code
4) r: Resident-location – list of city code
5) g: Gender - list
6) a: Age – list
- 0 - (0,18)
- 1 - [18,24]
- 2 - (24,34]
- 3 - (34,44]
- 4 - (44,54]
- 5 - (55,+)
7) aus: App usage – list of {category?_appusage_state}, state is one of following
a. active_30days
b. activated
c. installed_not_activated
d. not_instatlled
8) ais: App interest – list
9) t: Connection type - list
10) pdas: Pre-defined audiences – list
11) exclude_pdas: Excluded pre-defined audiences - list
12) dms: Device model – list
13) dpc: Device price category range of [0,4] - list
- (0-1500] – 0_1500
- (1500-2500] – 1500_2500
- (2500-3500] – 2500_3500
- (3500-4500] – 3500_4500
- (4500-+) – 4500
Excample:
{
"targetingChannel": {
"g":["g_m"],
"dms":["rneal00"]
},
"advId": 24512,
"price":0,
"days": [{
"st": "2018-11-07",
"ed": "2018-11-10",
"sh": 0,
"eh": 23
}],
"requestCount": 1000
}
```
##### Response:
```sh
{
"result": {
"bk_id": "56a1389a-ef6c-45b9-ae5f-936caf9e70de",
"total_booked": 1000
}
}
```
<br />
<br />
<br />
### Delete Booking
##### Description
> This end-point deletes a booking.
##### Method: DELETE
##### URL: http://service-domain/imsservice/api/bookings/<bk_id>
<br />
<br />
<br />
### Retrieve Bookings by Advertiser ID
##### Description
> This end-point returns all the bookings that belong to an advertiser.
##### Method: GET
##### URL: http://service-domain/imsservice/api/<advertiser_id>/bookings
##### Response Example:
```sh
{
"result": [
{
"days": [
"20181107",
"20181108",
"20181109",
"20181110"
],
"bk_id": "45111377-29eb-49e4-a999-de437b66cd60",
"adv_id": "24512",
"price": 0.0,
"amount": 1000,
"query": {
"r": null,
"g": [
"g_m"
],
"a": null,
"t": null,
"si": null,
"m": null,
"aus": null,
"ais": null,
"pdas": null,
"exclude_pdas": null,
"apps": null,
"exclude_apps": null,
"dms": [
"rneal00"
],
"pm": "NONE",
"dpc": null,
"ipl": null
},
"del": false
}
]
}
```
<br />
<br />
<br />
### Retrieve One Booking by BookingID
##### Description
> This end-point returns one specific booking.
##### Method: GET
##### URL: http://service-domain/imsservice/api/bookings/<bk_id>
##### Response Example:
```sh
{
"result": {
"days": [
"20181107",
"20181108",
"20181109",
"20181110"
],
"bk_id": "45111377-29eb-49e4-a999-de437b66cd60",
"adv_id": "24512",
"price": 0.0,
"amount": 1000,
"query": {
"r": null,
"g": [
"g_m"
],
"a": null,
"t": null,
"si": null,
"m": null,
"aus": null,
"ais": null,
"pdas": null,
"exclude_pdas": null,
"apps": null,
"exclude_apps": null,
"dms": [
"rneal00"
],
"pm": "NONE",
"dpc": null,
"ipl": null
},
"del": false
}
}
```

0 comments on commit b444d4a

Please sign in to comment.