rails_elastic_sensitivity 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 360672c160e4003725870af0c59a49f398241b542e345198e96ff6fca398e451
4
- data.tar.gz: b3f0b90b6b53c3e3f6c755dbb76ee4bd1f5ceb3e6d3918bb5a66b9eb6528272a
3
+ metadata.gz: e097b29769d8ed9e5ef84706d4ad17de585f6ed89ef1d5f7dcaf3d31bb8d8deb
4
+ data.tar.gz: 9bdef083dc6219807c906e42f44294ce37dcde7bd2c6651e8ee13bd08e4be12d
5
5
  SHA512:
6
- metadata.gz: 50c956cb713851120a4e07d91328174124f45e1ef812fe1d8d128b2cd6715fc12ec3358b1db9d52e1fbbb18a0af825bc92687c138b504cebbce1d680f088223e
7
- data.tar.gz: 4a7ad6ef5251a29547b2c9e72bcc9447a33aa88af51ec34ba07b226b1d1aec737e2c1d28dd7f7c339f91de089e014e4fa6eea01b528f452234ab5a364d721f8a
6
+ metadata.gz: e72e060e807cf9ed015e366fcfcfef2268de558063fa6dfd370211480717ae53e7d803890df0e050f6e9aacad03cbb28d46c762ecd7116efce01514a9f4b36ad
7
+ data.tar.gz: 6bfe349288aa309409e9f727dcc8eecf7e233056d1fa083ca00a35f0484e27ba88a39610d5c50032cca16409b95c72861c0cf78a4960e44dd2f383b59fa05235
data/README.md CHANGED
@@ -1,20 +1,25 @@
1
- # RailsElasticSensitivity
1
+ ## What is Rails Elastic Sensitivity?
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_elastic_sensitivity`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Elastic sensitivity is an approach which was invented by UBER for efficiently approximating the local sensitivity of a query, which can be used to
4
+ enforce differential privacy for the query. The approach requires only a static analysis of the query and therefore
5
+ imposes minimal performance overhead. Importantly, it does not require any changes to the database.
6
+ Details of the approach are available in [this paper](https://arxiv.org/abs/1706.09479).
7
+
8
+ This Project implement this mechanism on Rails to achieve counting query with any DataBase Rails support (MySQL, PostSQL, SQLite, etc).
4
9
 
5
- TODO: Delete this and the text above, and describe your gem
6
10
 
7
11
  ## Installation
8
12
 
9
13
  Add this line to your application's Gemfile:
10
14
 
11
15
  ```ruby
12
- gem 'rails_elastic_sensitivity'
16
+ # Lastest Version
17
+ gem 'rails_elastic_sensitivity', '~> 0.1.1'
13
18
  ```
14
19
 
15
20
  And then execute:
16
21
 
17
- $ bundle
22
+ $ bundle install
18
23
 
19
24
  Or install it yourself as:
20
25
 
@@ -22,7 +27,7 @@ Or install it yourself as:
22
27
 
23
28
  ## Usage
24
29
 
25
- Example:
30
+ Single Join Example:
26
31
 
27
32
  ```rb
28
33
  # Create Instance
@@ -35,6 +40,13 @@ es.joins(:gamecharacters).where(gamecharacters: {course_id: 100}).count
35
40
  es.joins(:gamecharacters).where(gamecharacters: {course_id: 100}).elastic_count
36
41
  ```
37
42
 
43
+ Double Join Example:
44
+ ```rb
45
+ es = ElaticSensitivity.new(:user)
46
+ es.joins(gamecharacters: :gc_achievements).where(gamecharacters: {course_id: 1}).count
47
+ es.joins(gamecharacters: :gc_achievements).where(gamecharacters: {course_id: 1}).elastic_count
48
+ ```
49
+
38
50
  ## Development
39
51
 
40
52
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -3,7 +3,6 @@ require 'active_record'
3
3
 
4
4
  class ElaticSensitivity
5
5
  attr_accessor :main_t, :elastic_sensitivity, :epi, :k, :c, :k_square, :cache_mfx_table
6
- alias_method :mfx, :precompute_mfx
7
6
 
8
7
  def initialize(table)
9
8
  @cache_mfx_table = {}
@@ -1,3 +1,3 @@
1
1
  module RailsElasticSensitivity
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_elastic_sensitivity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - fifiten82726