Changeset 82626
- Timestamp:
- 08/16/11 21:10:43 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gsoc11-statistics/docs/implementation/impl.tex
r80582 r82626 183 183 184 184 \section{Server Side - Ruby on Rails} 185 \subsection{Database Schema} 186 187 \subsubsection {Categories table} 188 189 Imported from MPWA 190 191 \begin{verbatim} 192 create_table "categories", :force => true do |t| 193 t.string "name" 194 t.datetime "created_at" 195 t.datetime "updated_at" 196 end 197 \end{verbatim} 198 199 \textbf{Relationships and Validations} 200 201 \begin{verbatim} 202 has_many :ports 203 validates_presence_of :name 204 \end{verbatim} 205 206 \textbf{Changes from MPWA} 207 \begin{itemize} 208 \item Validate presence of name 209 \end{itemize} 210 211 \subsection{Ports table} 212 213 Imported from MPWA 214 215 \begin{verbatim} 216 create_table "ports", :force => true do |t| 217 t.string "name" 218 t.string "path" 219 t.string "version" 220 t.text "description" 221 t.string "licenses" 222 t.integer "category_id" 223 t.text "variants" 224 t.string "maintainers" 225 t.string "platforms" 226 t.string "categories" 227 t.datetime "created_at" 228 t.datetime "updated_at" 229 end 230 231 add_index "ports", ["name"], :name => "index_ports_on_name" 232 \end{verbatim} 233 234 \textbf{Relationships and Validations} 235 236 \begin{verbatim} 237 has_one :category 238 belongs_to :category 239 has_many :installed_ports 240 validates_presence_of :name, :version 241 \end{verbatim} 242 243 \textbf{Changes from MPWA} 244 \begin{itemize} 245 \item Changed variant column to text type from string 246 \item Added index on name column 247 \item Validate presence of name and version 248 \item has\_many installed ports 249 \end{itemize} 250 251 \subsubsection{installed\_ports table} 252 253 The installed\_ports table holds submitted port installation data. It keeps track of an installed port's version and variants as well as the id of the submitting user. 254 255 \begin{verbatim} 256 create_table "installed_ports", :force => true do |t| 257 t.integer "port_id" 258 t.string "version" 259 t.text "variants" 260 t.datetime "created_at" 261 t.datetime "updated_at" 262 t.integer "user_id" 263 end 264 265 add_index "installed_ports", ["port_id"], :name => "index_installed_ports_on_port_id" 266 add_index "installed_ports", ["user_id"], :name => "index_installed_ports_on_user_id" 267 \end{verbatim} 268 269 \textbf{Relationships and Validations} 270 271 \begin{verbatim} 272 belongs_to :port 273 has_one :user 274 275 validates_presence_of :user_id, :port_id, :version 276 \end{verbatim} 277 278 \subsubsection{os\_statistics table} 279 280 The os\_statistics table holds information about a user's system. 281 282 \begin{verbatim} 283 create_table "os_statistics", :force => true do |t| 284 t.datetime "created_at" 285 t.datetime "updated_at" 286 t.string "macports_version" 287 t.string "osx_version" 288 t.string "os_arch" 289 t.string "os_platform" 290 t.string "build_arch" 291 t.string "xcode_version" 292 t.string "gcc_version" 293 t.integer "user_id" 294 end 295 296 add_index "os_statistics", ["user_id"], :name => "index_os_statistics_on_user_id" 297 \end{verbatim} 298 299 \begin{verbatim} 300 belongs_to :port 301 has_one :user 302 303 validates_presence_of :user_id, :port_id, :version 304 \end{verbatim} 305 306 \subsubsection{users table} 307 308 The users table holds UUIDs for each user. 309 310 \begin{verbatim} 311 create_table "users", :force => true do |t| 312 t.string "uuid" 313 t.datetime "created_at" 314 t.datetime "updated_at" 315 end 316 \end{verbatim} 317 318 \begin{verbatim} 319 has_one :os_statistic 320 has_many :installed_ports 321 \end{verbatim} 322 323 \subsection{Submissions} 324 325 JSON encoded submissions are sent via HTTPS POST to the \texttt{/submissions} page. All data is stored in the \texttt{data} POST variable. 326 327 Submissions are stored on a month by month basis. Resubmissions in a given month cause that month's data to be updated. 328 329 Storing data happens as follows 330 \begin{enumerate} 331 \item Attempt to find a user with the given UUID in the database. If no user is found then add a new entry 332 \item Attempt to find an entry in the os\_statistics table for this user that was created this month. If no such entry is found then add an try for this month. If an entry is found then update it. 333 \item For each submitted port verify that it is a valid port by checking to see if it exists in the \texttt{ports} table. If it does not exist then skip it. If it does exist then attempt to find an entry for the given user that was created this month. If an entry was found then update it, otherwise create a new entry. 334 \end{enumerate} 335 336 \subsection{OS Statistics Page} 337 338 The OS statistics page provides visualizations of the data in the \texttt{os\_statistics} table. It shows pie charts for each of 339 \begin{itemize} 340 \item MacPorts Version 341 \item OSX Versions 342 \item OS Arch 343 \item OS Platform 344 \item Build Arch 345 \item gcc Versions 346 \item XCode Versions 347 \end{itemize} 348 349 These pie charts show the percentage of the user population running different versions (or arch / platform) in each category. 350 351 \subsection{Port Page} 352 353 Every port in the MacPorts repository has an associated port page. This page displays basic information about the port such as 354 \begin{itemize} 355 \item Name 356 \item Current version 357 \item Licenses 358 \item Categories 359 \item Variants 360 \end{itemize} 361 362 This page also shows visualizations of the data in the \texttt{installed\_ports} page for this particular port. 363 364 It has the following 365 \begin{itemize} 366 \item Line chart of installation counts over the past 12 months. 367 \item Top versions over the past 12 months. This finds the top 5 most popular versions in use right now and tracks how their popularity has changed over the past 12 months. Popularity is measured by the number of installations of each version per month. 368 \item Pie chart of all versions. This shows the distribution of all different versions in use right now. It will show you that \(x\%\) of users of this port are using version \(y\). 369 \item Similarly to all versions, there is a pie chart of all variants in use. 370 \end{itemize} 371 372 \subsection{Installed Ports Page} 373 185 374 TODO 186 375 187 376 188 189 190 377 \end{document}
Note: See TracChangeset
for help on using the changeset viewer.

