Compare commits

...

3 Commits

3 changed files with 13 additions and 7 deletions

View File

@ -1,4 +1,5 @@
# ExtensionDsLab
ExtensionDsLab is a data science and machine learning framework for analyzing
security and privacy related properties of the browser extensions (and Chrome
Apps) offered in the [Chrome Web Store](https://chrome.google.com/webstore/).

View File

@ -45,11 +45,13 @@ module ExtensionQueries =
///
/// **Exceptions**
///
/// * `MySql.Data.MySqlClient.MySqlException`
///
let getDownloads (ctx:ExtensionDbType) extid =
query {
for order in ctx.Extensions.Extension do
where (order.Extid = extid && order.Downloads.IsSome)
select (order.Date, order.Downloads.Value)
where (order.Extid = extid && order.Downloads.IsSome)
select (order.Date, order.Downloads.Value)
}
/// **Description**
@ -69,9 +71,11 @@ module ExtensionQueries =
///
/// **Exceptions**
///
/// * `MySql.Data.MySqlClient.MySqlException`
///
let getAllExtIds (ctx:ExtensionDbType) =
query {
for ext in ctx.Extensions.Extension do
select ext.Extid
distinct
select ext.Extid
distinct
}

View File

@ -31,7 +31,7 @@ open XPlot.GoogleCharts.Deedle
// the connection string shall be of the form
// "Server=<DBHOST>;Database=extensions;User=<USER>;Password=<PASSWORD>"
let ctx = ExtensionDbProvider.GetDataContext(connectionStringOrDefault "")
let ctx = ExtensionDbProvider.GetDataContext(connectionStringOrDefault "",commandTimeout=36000)
// Log SQL: https://fsprojects.github.io/SQLProvider/core/querying.html
FSharp.Data.Sql.Common.QueryEvents.SqlQueryEvent |> Event.add (printfn "Executing SQL: %O")
@ -39,11 +39,11 @@ FSharp.Data.Sql.Common.QueryEvents.SqlQueryEvent |> Event.add (printfn "Executin
let chartDownloads extIds = (List.map (fun e -> (series (getDownloads ctx e))) extIds)
|> Chart.Line
|> Chart.WithOptions (Options(legend=Legend(position="bottom")))
|> Chart.WithOptions (Options(legend=Legend(position="bottom"), width=1100))
|> Chart.WithLabels extIds
chartDownloads ["lkllajgbhondgjjnhmmgbjndmogapinp"]
// chartDownloads (List.take 5 (getAllExtIds ctx))
// chartDownloads (List.take 5 (getAllExtIds ctx |> Seq.toList))
let extData =
query {for x in ctx.Extensions.Extension do
@ -52,3 +52,4 @@ let extData =
|> Seq.map (fun (date, name, download) -> (date, name.Value, download.Value))
|> Frame.ofRecords
|> Frame.indexColsWith ["Date"; "Name"; "Downloads"]