SSRS: How to create 'Color Analytics Map' in Reporting Services 2008 / Report Builder 3.0 - dictionary

I'm setting up a map report in Reporting Services (Report Builder 3.0) running on a SQL Server 2008 RC2.
I've got a dataset like this:
CODE VAL
AF 11
AL 7
DZ 7
VI 15
AD 7
AO 6
AI 8
AQ 10
I've downloaded the shape (.shp) file from here: http://www.naturalearthdata.com/downloads/110m-cultural-vectors/. I imported this file to my report and in the dialog 'Select fields to match spatial data and analytical data' I've registered a match between the spatial data field 'ISO_A2' and my own 'CODE' field. I've checked manually that these columns match.
I've set my VAL-field as the field to 'visualize' in the Wizard.
I've changed the distribution-range in the 'Map Color Rules Properties' dialog as starting from 1 through 20.
When I preview my report, all the countries are rendered with No Color (all backgroundss are grey as the background)! I tried a lot of difference color setups but no luck. Seems like the spatial data and my test dataset doesn't get join correctly!? :(
How can I ensure that the spatial data and my analytical data are joined correctly?
Am I doing something obviously wrong?
Any solutions/hints highly appreciated! ;)
Regards
Alex

Related

ggmap and spatial data plotting issue

I am trying to update some old code that I inherited from before the Google API days to do a fairly simple (I think) plot.
By the time I get to the plot, my data consists of 50 triplets of latitude, longitude, and $K amount of investment at that location.
head(investData)
amount latitude longitude
1 1404 42.45909 -71.27556
2 1 42.29076 -71.35368
3 25 42.34700 -71.10215
4 1 40.04492 -74.58916
5 15 43.16431 -75.51130
at this point I use the following
register_google(key = "###myKey###") #my actual key here
USAmap <- qmap("USA",zoom=4)
USAmap + geom_point(data=investData, aes(x=investData$longitude, y=investData$latitude,size=investData$amount))
I've been fighting all ay with establishing accounts and enabling APIs with Google, so it's entirely possible I've simply failed to enable something I need to. I have the geocoding, geolocation, and maps static APIs enabled.
I get the following output at the console
Source : https://maps.googleapis.com/maps/api/staticmap?center=USA&zoom=4&size=640x640&scale=2&maptype=terrain&language=en-EN&key=xxx
Source : https://maps.googleapis.com/maps/api/geocode/json?address=USA&key=xxx
But I get no plot.
if I simply run
qmap("USA", zoom=4)
I get the map I expect. But when I try to overlay the investment data I get zilch. I'm told by the folks who handed this to me that it worked in 2017...
Any idea where I'm going wrong?
If you are running your script via the source function or with the run command (from inside RStudio) you must explicitly call the print function on your ggplot commands. For example:
print(USAmap + geom_point(data=investData, aes(x=longitude, y=latitude,size=amount)))
As Camille mentioned, no need for the $ inside the aes

Encryption or Hashing of Date Value

I have an old program that has been discontinued which communicates with an SQL database. When I enter certain information in the defunct software, it is encrypted, encoded, or hashed before being entered into the database.
I am creating another application to interact with the same data, and I need to figure out how the end result is being produced.
Here's an example:
I enter 6/18/2017, I get y/7w/iXIE
I enter 6/18/2099, I get y/7w/iXBM
I enter 6/12/2017, I get y/7c/iXIE
I enter 12/11/2018, I get SN/u0/ZmWk
The last one throws me for a loop... what method is being used and how can I replicate this?
It might be format preserving encryption or just substatutions. In all cases the number of characgters in each section delimited by / are the same number of characters. With enough samples, all 12 months, 31 days and years you should be able to match the method.
6/18/2017
y/7w/iXIE
6/18/2099
y/7w/iXBM
6/12/2017
y/7c/iXIE
12/11/2018
SN/u0/ZmWk
months: 6 -> y, 12 -> SN
days: 11 -> u0, 12 -> 7c, 18 -> 7w
years: 2017 -> iXIE, 2018 -> ZmWk, 2099 -> iXBM

R webcorpus attribute extraction

I am using the tm.plugin.webmining to get latest news about a company say microsoft using the following command
corpus<-WebCorpus(GoogleBlogSearchSource(stock))
When I run meta(corpus[[1]]) i get
Metadata:
author : character(0)
datetimestamp: 2014-07-17 20:28:10
description : Microsoft Layoffs – What it Means for MSFT StockInvestorplace.comWhile the layoffs are obviously
going to be hardest on the workers, as investors we still have to take
a rational and objective look at the corporation to see what it means
for MSFT – particularly if you are personally a
Microsoft stock holder ...Why Microsoft (MSFT) Stock Is Up
TodayTheStreet.comEarnings Preview: Microsoft Corporation (MSFT),
Apple Inc (AAPL), Facebook ...International Business TimesWhat Do
Microsoft's Layoff Plans Tell Us About Satya Nadella's Vision?Motley
FoolTech Insider -Insider Monkey (blog)all 2,176 news articles »
heading : Microsoft Layoffs – What it Means for MSFT Stock - Investorplace.com
id : tag:news.google.com,2005:cluster=http://investorplace.com/2014/07/microsoft-layoffs-means-msft-stock/
language : character(0)
origin : http://news.google.com/news/url?sa=t&fd=R&ct2=us&usg=AFQjCNEadqFvThyxvJU3O5uHa6wiyoWNEw&clid=c3a7d30bb8a4878e06b80cf16b898331&cid=52778559643673&ei=Cr3LU8jGNMnNkwX_lYCICQ&url=http://investorplace.com/2014/07/microsoft-layoffs-means-msft-stock/
So here I see that the different attributes are here but when I run
Headers<-sapply(meta(corpus,FUN=function(x){attr(x,"heading")})
Headers is a list of 100 items with null values. I am pretty sure this particular code was running a few days back. What changed in between was I reinstalled the packages on the new system and also updated R to 3.1.1 instead of R 3.1.0(earlier)
What can I do to get separate lists of headers, descriptions timestamp, etc, which I later want to convert into a 100X3 data frame.
With the newest R, Please try the following code:
Code :
headers<-meta(corpus,tag="heading")

How to connect data dictionaries to the unlabeled data

I'm working with some large government datasets from the Department of Transportation that are available as tab-delimited text files accompanied by data dictionaries. For example, the auto complaints file is a 670Mb file of unlabeled data (when unzipped), and comes with a dictionary. Here are some excerpts:
Last updated: April 24, 2014
FIELDS:
=======
Field# Name Type/Size Description
------ --------- --------- --------------------------------------
1 CMPLID CHAR(9) NHTSA'S INTERNAL UNIQUE SEQUENCE NUMBER.
IS AN UPDATEABLE FIELD,THUS DATA FOR A
GIVEN RECORD POTENTIALLY COULD CHANGE FROM
ONE DATA OUTPUT FILE TO THE NEXT.
2 ODINO CHAR(9) NHTSA'S INTERNAL REFERENCE NUMBER.
THIS NUMBER MAY BE REPEATED FOR
MULTIPLE COMPONENTS.
ALSO, IF LDATE IS PRIOR TO DEC 15, 2002,
THIS NUMBER MAY BE REPEATED FOR MULTIPLE
PRODUCTS OWNED BY THE SAME COMPLAINANT.
Some of the fields have foreign keys listed like so:
21 CMPL_TYPE CHAR(4) SOURCE OF COMPLAINT CODE:
CAG =CONSUMER ACTION GROUP
CON =FORWARDED FROM A CONGRESSIONAL OFFICE
DP =DEFECT PETITION,RESULT OF A DEFECT PETITION
EVOQ =HOTLINE VOQ
EWR =EARLY WARNING REPORTING
INS =INSURANCE COMPANY
IVOQ =NHTSA WEB SITE
LETR =CONSUMER LETTER
MAVQ =NHTSA MOBILE APP
MIVQ =NHTSA MOBILE APP
MVOQ =OPTICAL MARKED VOQ
RC =RECALL COMPLAINT,RESULT OF A RECALL INVESTIGATION
RP =RECALL PETITION,RESULT OF A RECALL PETITION
SVOQ =PORTABLE SAFETY COMPLAINT FORM (PDF)
VOQ =NHTSA VEHICLE OWNERS QUESTIONNAIRE
There are import instructions for Microsoft Access, which I don't have and would not use if I did. But I THINK this data dictionary was meant to be machine-readable.
My question: Is this data dictionary a standard format of some kind? I've tried to Google around, but it's hard to do so without the right terminology. I would like to import into R, though I'm flexible so long as it can be done programmatically.

Biztalk schema pipe delimited header/detail on same level

I have a flat file below. I'm having trouble with the schema with this layout. I switched it around to have a header and a detail and created an application with no problems, but the customer won't change the layout. This is probably pretty basic, but I'm a beginner. How do I take certain fields from this layout and create a header and a detail? The last date field needs to be in the header so you can see how it's random.
PO207730CO|1271|customer 1|john doe|1|161075|161075|BROOM FLAGGED LOBBY|2|5.62|24-Feb-2014|
PO207730CO|1271|customer 1|john doe|2|167316|167316|CLEANER DISPATCH SPRAY HOSPITAL DISINFECTANT W/BLEACH|1|59.84|24-Feb-2014|
PO207730CO|1271|customer 1|john doe|3|162175|162175|DUST PAN LOBBY|2|6.26|24-Feb-2014|
PO207730CO|1271|customer 1|john doe|4|163325|163325|MOP WET LARGE GENERAL-PURPOSE BLUE WB/LP|1|18.45|24-Feb-2014|
PO207730CO|1271|customer 1|john doe|5|164715|164715|SOAP PROVON MEDICATED TFX|1|32.79|24-Feb-2014|
PO207730CO|1271|customer 1|john doe|6|166338|166338|TOWEL MULTI-FOLD SCOTT WHITE|5|18.91|24-Feb-2014|
PO207814CO|1264|customer 2|jane doe|1|Cups||Bib 20x35 2 Ply Lab (756220)|1|17.47|24-Feb-2014|
PO207814CO|1264|customer 2|jane doe|2|Cups||Cup 9oz Translucent (098219)|1|24-Feb-2014|
PO207814CO|1264|customer 2|jane doe|3|Cups||Cup Foam 16oz (177190)|2|35.1|24-Feb-2014|
PO207814CO|1264|customer 2|jane doe|4|Cups||Lid 16/20 Whte Tab W/Sslot (194088)|2|16.57|24-Feb-2014|
PO207814CO|1264|customer 2|jane doe|5|Cups||Tissue 2-Ply 100-Sht (343227)|3|16.38|24-Feb-2014|
The basic problem here is the Flat File Disassembler does not support the concept of splitting/debatching based on changing values, PO207730CO -> PO207814CO for example.
So, you'll have to regroup by PO number at some following step.
You have a few options:
Use a Custom XSLT Map to group the lines based on the PO Number,
then split, by using a Receive Pipeline on an Orchestration for example.
https://social.technet.microsoft.com/wiki/contents/articles/17985.xslt-muenchian-grouping-biztalk-complex-transformation.aspx
Use an xPath Debatching Pattern in an Orchestration. http://www.biztalkgurus.com/biztalk_server/biztalk_2004/m/biztalk_2004_samples/32438.aspx
Either way, you would parse the flat file as you are now, row by row.
Thanks for the replies.
I went with an SSIS package to preload a table and build the pipe delimited file. I have Biztalk then picking up that file and debatching it the way I need it.

Resources