You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by cu...@apache.org on 2017/04/12 23:35:30 UTC
[whimsy] branch master updated: Prototype trademark docket
CSV->JSON converter
This is an automated email from the ASF dual-hosted git repository.
curcuru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 00ca854 Prototype trademark docket CSV->JSON converter
00ca854 is described below
commit 00ca854c5241cfc289730c8de61f41b98dc7f297
Author: Shane Curcuru <as...@shanecurcuru.org>
AuthorDate: Wed Apr 12 19:35:24 2017 -0400
Prototype trademark docket CSV->JSON converter
---
www/test/test.cgi | 52 +++++++++++++++++++++++++++-------------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/www/test/test.cgi b/www/test/test.cgi
index 573bd98..7052e22 100644
--- a/www/test/test.cgi
+++ b/www/test/test.cgi
@@ -10,33 +10,35 @@ require 'net/http'
require 'whimsy/asf/themes'
PAGETITLE = 'Listing of Apache Registered Trademarks'
-CSVFILE = "/Users/curcuru/src/foundation/Brand/trademark-registrations.csv"
-docket = CSV.read(CSVFILE, headers:true)
-docketcols = %w[ Mark Jurisdiction Class ]
-# Map Mark names to PMC identifiers (only openoffice.org so far)
-docket.each do |r|
- r << ['pmc', r['Mark'].downcase.sub('.org','').sub(' & design','')]
-end
-dockethash = {}
+brand_dir = ASF::SVN['private/foundation/Brand']
-# Create hash based on pmc with aggregated data
-docket.each do |r|
- key = r['pmc'].to_sym
- if dockethash.key?(key)
- # Aggregate specific values
- docketcols.each do |col|
- dockethash[key][col] |= [r[col]]
- end
+_json do
+ docket = CSV.read("#{brand_dir}/docket.csv", headers:true)
+ docketcols = %w[ TrademarkName TrademarkStatus CountryName Class RegNumber ]
+ # Map Mark names to PMC identifiers (only openoffice.org so far)
+ docket.each do |r|
+ r << ['pmc', r['TrademarkName'].downcase.sub('.org','').sub(' & design','')]
+ end
+ dockethash = {}
- else
- # Create first copy of the pmc
- dockethash[key] = {}
- docketcols.each do |col|
- dockethash[key][col] = [r[col]]
+ # Create hash based on pmc with aggregated data
+ docket.each do |r|
+ key = r['pmc'].to_sym
+ if dockethash.key?(key)
+ # Aggregate specific values
+ docketcols.each do |col|
+ dockethash[key][col] |= [r[col]]
+ end
+
+ else
+ # Create first copy of the pmc
+ dockethash[key] = {}
+ docketcols.each do |col|
+ dockethash[key][col] = [r[col]]
+ end
+ # Hack: only use first Goods
+ dockethash[key]['ClassGoods'] = r['ClassGoods']
end
- # Hack: only use first Goods
- dockethash[key]['Goods'] = r['Goods']
end
+ dockethash
end
-
-puts JSON.pretty_generate(dockethash)
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].