need custom code written to read input file, and create output

Does anybody know a good place to find someone or a company that could do this?

Below is an email I sent to one person that explains what is needed.
 
(though if you just want to see a more technical description with example, see bottom of this post)


We are a market research company.  We program and field surveys.  In these surveys we often collect common demographic information.  Age, education, income, ethnicity, etc.   However for each job we do, the questions and response text would be worded a little different, and the data locations (we essentially have flat ascii fixed field data files) and codes used are different.  

We want to get data out of jobs over the last 3 years (hundreds of jobs).  In order to do this, it will require some sort of program that can read a sort of data map, that shows the text of the question, and the response text next to the codes.  It would have to interpret the response text to map it to some standard codes and then write out some definitions to a new file.  

I am thinking would probably want something that I could run from the command line (linux) with the input file as an argument.   I can then easily write something to run it on all the input files.  Though if the program can just process all the files in a folder, it can run on any platform.  

Obviously before you could really give a confident quote I would need to scope this out, to tell you exactly which situations specifically it should be able to handle.  (I.e.  for ethnicity, what all should it count as African American – “African American”, “Black”, etc – or like for age ranges, being able to understand “18-24” or “18 to 24” or “18 to less than 24”, etc)

But given the example below and attached –  can you tell me if this is the type of thing you could do, and could you give me a ballpark idea of what this would cost?

Let me know if you have any questions.

Thanks!





Below is a small example of a single question – the attached files show more examples and different kinds of questions.


''every question starts with an open bracket {
''at the end of that line, is the data location -- in this case 906.2
‘’906.2 here means column 906 for a length of 2 column (as you can see the response codes are 2 digits)
Here is an example question from the input file
{ L4: #12.92 906.2
L4.
What is your current marital status?  Are you ...

(READ LIST.  RECORD ONE RESPONSE.)

!FLD, , 1
() 01 Single
() 02 Married
() 03 Living with significant other
() 04 Divorced/separated
() 05 Widowed
() 99 Refused }

From that we would want the following output (just the >Def lines – the rest just explains it
''<-----define  Married
>def @marital1 [906.2#02]  
''<-----define  Single / never married
>def @marital2 [906.2#01]
''<-----define  Living with someone
>def @marital3 [906.2#03]  
''<-----define  Separated / widowed / divorced
>def @marital4 [906.2#04,05]  




input.txt
XetroximynAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

XetroximynAuthor Commented:
Attached is a more complete example output file

output.txt
Mick BarryJava DeveloperCommented:
we aren't allowed to give quotes on EE

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mrcoffee365Commented:
But you'll notice that many members give methods for contact in their profile pages.
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

CEHJCommented:
It's not far off being accessible to sed actually, although a program would be possibly more readable and maintainable
XetroximynAuthor Commented:
OK - so no quotes -- but can anybody point me to/recommend a person or company that could do this?

Or is anybody interested in doing this?


CEHJCommented:
I'll take a look tomorrow - it's approaching midnight here
mrcoffee365Commented:
I think you must not have understood what "objects" said above.  EE cannot be used to give or solicit quotes.  If you want to just click on the names of people who have responded to you here, you can correspond directly with them.
XetroximynAuthor Commented:
@Mrcoffee
My original post was not even trying to solicit here -- I was expecting people to recommend companies that do this kind of work.   Kind of like this post where I requested suggestions for companies that can do bulk tape restores....
http://www.experts-exchange.com/Storage/Backup_Restore/Q_26528946.html

After you pointed out to me that members can have "Hire Me" buttons in their profile pages -- I figured in my next post I would ask directly if anyone here could do it.  

Sorry if I have broken some rules!!  My bad!!

CEHJCommented:
From a reasonably quick glance at the spec, i'm not convinced this can implemented consistently
XetroximynAuthor Commented:
<!--[if gte mso 9]>   Normal  0          false  false  false    EN-US  X-NONE  X-NONE                                 MicrosoftInternetExplorer4                                     <![endif]--><!--[if gte mso 9]>                                                                                                                                                                                                                                                                                    <![endif]--><!--[if gte mso 10]><![endif]--> Can you clarify what the problem with the spec seems to be?  Why could it not be implemented?


Below is a more detailed spec I am working on...
 
Language Question
Definition
Response Codes “1 English” and “2 Spanish”
 
Code to generate (where 499.1 is the location of thequestion.)
>def @lang [499.1$]
 
If no such question found, then generate
>def @lang [9131.1$]
 
 
 
Gender
Definition
Response Codes “1 Male” and “2 Female”
 
Code to generate (where 901.1 is the location of thequestion)
>def @gender [901.1$]
 
If no such question found, then generate
>def @gender [9101.1$]
 
 
 
 
Marital Status
Definition
Response text includes any two of “Married”, “Divorced”,“Single”, “Widow”, “Widowed”
 
Mapping
@marital1 def should include codes with “Married” (unlesspreceded by the word “never” or “not”)
@marital2 def should include codes with “Single”
@marital3 def should include codes with the phrase “livingwith”
@marital4 def should include codes with any of the followingwords “Separated”, “Divorced”, “Widow”, “Widowed”
 
Code to generate (where 906.2 is the Q location, and thenumbers following the # are the response codes that match, separated by comma.(preceding 0 is important to include in codes)
The same response code should never be included in more thanone definition.  If there is a conflict keep the first one.  
>def @marital1 [906.2#02]
>def @marital2 [906.2#01]
>def @marital3 [906.2#03]
>def @marital4 [906.2#04,05]
 
 
If no such question found, then generate (or if no responsecodes found for a particular line, use this)
>def @marital1 [1^b]
>def @marital2 [1^b]
>def @marital3 [1^b]
>def @marital4 [1^b]
 
 
 
 
 
Ethnicity
Definition
Response text includes any two of “Caucasian”,“African-American”, “African American”, “Hispanic”, “Asian”
 
Mapping
@ethnic1  = “Caucasian” or “White”
@ethnic2  = “African-American” or “African American” or“Black”
@ethnic3  = “Hispanic”
@ethnic4 = “Asian” or ”Oriental” or “Indian” or “NativeAmerican” or “other” or “Samoan”
 
Code to generate (where 901.1 is the Q location, and thenumbers following the # are the response codes that match, separated by comma.(preceding 0 is important to include in codes)
>def @ethnic1 [901.1#1]
>def @ethnic2 [901.1#2]
>def @ethnic3 [901.1#3]
>def @ethnic4 [901.1#4,5,6]
 
If no such question found, then generate (or if no responsecodes found for a particular line, use this)
>def @ethnic1 [1^b]
>def @ethnic2 [1^b]
>def @ethnic3 [1^b]
>def @ethnic4 [1^b]
 
 
 
 
Education
Definition
Response text includes any two of “College”, “High School”,“graduate”, “degree”
 
Mapping
@edu1 = “Some High School” or “Grade School”
@edu2 = “High School” (not preceded by “some”)
@edu3 = “Some College”  or “2 year” or “two year” or“Associates”
@edu4 = “graduated college” or “college graduate” or “4year” or “four year” or “bachelors” or (“college” if no other response codecontains “college”)
@edu5 = “Post Graduate” or “Masters” or “doctorate” or “phd”
 
Code to generate (where 910.2 is the Q location, and thenumbers following the # are the response codes that match, separated by comma.(preceding 0 is important to include in codes)
>def @edu1 [910.2#01,02]
>def @edu2 [910.2#03]
>def @edu3 [910.2#04]
>def @edu4 [910.2#05,06]
>def @edu5 [910.2#07]  
 
If no such question found, then generate (or if no responsecodes found for a particular line, use this)
>def @edu1 [1^b]
>def @edu2 [1^b]
>def @edu3 [1^b]
>def @edu4 [1^b]
>def @edu5 [1^b]
 
 
 
 
Children in Household
Definition
If the question text contains…
(“how many children” or “have any children” or “havechildren” or “children living”) (any of those could have “kids” instead of“children”)
And also contains ”household” or “living with you” or“living at home”
 
Mapping
There are different ways this question is done. Sometimes it is yes/no – in which case the mapping is obvious.
 
The other type is where is asks how many.  And in thatcase there are two ways it is done.  If the question is of “!NUM” type –then you can take the location, and assume that “0” or “00” (depending onwidth) defines no, and that “01-20” or “1-7”  defines yes (so if 2 digitwidth, use “20” for high end, and if 1 digit width use “7” for high end)
 
The other way, is when they ask how many, and there areresponse codes just like normal questions.  
So the no would be whatever code includes “none” or “0” –(if there is no such code then the def should look like [701.1^b] or [701.2^^b](where 701.1 or 701.2 is the Q location)
And the yes would be defined as any code whose text includesa numerical number 1-20 or the spelled out versions one, two, three, etc.
This can be expressed as “[701.1#1-7]” or“[701.1#1,2,3,4,5,6,7}”
 
 
Code to generate examples
If it was a yes no type deal then it will probably looksomething like this
>def @childhhyes [701.1#1]
>def @childhhno [701.1#2]  
 
If it was a question with open ended numerical response(!NUM) or if the response codes were numerical then it will look something likethis
>def @childhhyes [701.2#01-20]
>def @childhhno [701.2#00]  
 
If no such question found, then generate (or if no responsecodes found for a particular line, use this)
>def @childhhyes [1^b]
>def @childhhno [1^b]  
 
 
 
 
 
Zip code
Definition
Question text contains “zip code” and the question type is“!NUM” (You would see “!NUM” at the beginning of a line in that question)
And the length (the part after the dot in the questionlocation) is 5, 9, or 10
 
 
Code to generate (where 801.5 is the Q location)
>def @zip [801.5$]
 
If no such question found, then
>def @zip [9101.5$]
 
 
 
 
Age and income questions are a bit different.  Usuallythey are asked as ranges.  With response codes having a range like 18-24,25-34, etc.  
Sometimes they are asked as exact numbers.   Inwhich case the question type will be “!NUM” instead of “!FLD”
 
Of course sometimes one or both are not asked atall.   So depending on what the case is – a single one of thefollowing should be generated.  
 
>def @bothrange    ''we have both incomeand age, and they are both ranges
''>def @agerange  ''age is a range and income isexact or unknown
''>def @incrange  ''income is a range and age isexact or unknown
''>def@norange         ''both income and ageare either exact or unknown
 
Then the following code should be generated exactly asshown.  (Unless an exact age or income is known, in which case thelocation of that question should be used instead of the default location)
>def @agex [9101.3$]
>def @incomex [9101.7$]
 
 
 
Age
Definition
Question text include “have your age” or “how old are you”or “reach your age” or “represents your age”
OR
If the response text includes any of the following
“18-24”
“25-34”
“25-29”
“65 or older”
 
Mapping
In the generated code we are going to set one define to thelocation of the question, and then we are going to set high and low defines foreach code.  Basically mapping the range that the code applies to.
 
So for @age1min – we put the low value for whatever code 1was, and so on.
 
For any response codes that we are unable to determine ahigh and low for then just define as “”
 
Notice the response text may look like “18-24” or “18 – 24”or  “18 to 24” or “18 to less than 24” or “18-24,” or “18-24, or” – Ithink a regex can be used to pretty universally fit any similar variation.
 
Also – almost always the final category will be somethinglike “65 or older” – assign this as 65-120.
 
 
Code to generate
 
>def @ageloc 1001
>def @age1min 18
>def @age1max 24
>def @age2min 25
>def @age2max 34
>def @age3min 35
>def @age3max 44
>def @age4min 45
>def @age4max 54
>def @age5min 55
>def @age5max 64
>def @age6min 65
>def @age6max 120
>def @age7min ""
>def @age7max ""
>def @age8min ""
>def @age8max ""
>def @age9min ""
>def @age9max ""
>def @age0min ""
>def @age0max ""
 
If there is no such question or the age question is exact –then just generate default code like shown above.  And either the@incrange or @norange code mentioned in previous section should be used
 
 
 
Income – will nearly the same as age – except its responsesoften include commas and $’s that will need to be removed beforeanalyzing.  
 
Definition
 
Code to generate
 
 
 
 
 
Here is some additional stuff to be generated
At the command line I will pass a single argument.  Itwill be the study code.  In all cases below where you see “h999” the studycode should be put there.  
I will provide the exact names of the input and output fileslater – they will be the study code with some prefix, and suffix.
Other than that most of this stuff will likely be static,and be the same for every file.  Though I might give some rules forfilling @fone, @name, @choose and possibly @month through @length
I have to see what the data maps look like for 3 years ago,to confirm if this fairly standard stuff was the same back then.  
 
 
>def @job "R_ABC_H999"
>def @data /usr1/cfmc77/data/h999.tr
>def @csv $h999mrfd.csv
 
 
>def @fone [7001.10$]
>def @name [9101.30$]
>def @choose SELECT=[101.3#1]
 
>def @month [189.2$]
>def @day  [191.2$]
>def @year [185.4$]
>def @hour [193.2$]
>def @min [195.2$]
>def @length [178.6$]
 
>def @numinhh [9101.1$]
>def @fips [9101.5$]
>def @county [9101.20$]
>def @state [9101.2$]
>def @dma [9101.3$]
 
 
 
 
 
These two lines should precede everything else in thegenerated output.  They should be the first two lines in the file
>PURGESAME
>allow_indent
 
 
 
 
 
The following should all be put at the end of the generatedfile.  After all the generated code.  This stuff is purely static,and the same in all files.
 
>PRINTFILE @csv PAGELENGTH=25000 PAGEWIDTH=1200
~SET -AUTOMATIC_NEW_PAGE
~in @data @choose
 
 
~DEF PROC=label:
 
 
if firstcase then
prt """TelephoneNumber"",""Job"",""Date ofComplete"",""Time"",""Length"",""Language"",""IncomeMin"",""Income Max"",""Age Min"",""AgeMax"",""Gender"",""Number of people inHH"",""Children in HH"",""MaritalStatus"",""Ethnicity"",""Education"",""Name"",""Zip"",""Fips"",""County"",""State"",""DMA"""
ENDIF
 
blank [9101.200]
t [9131.1$]="1"
 
 
 
 
>rep $childa="@childhhyes","@childhhno";&
$childb=1,2;
if $childa
t [9201.1$]="$childb"
endif
>endrep
 
>rep$maritala="@marital1","@marital2","@marital3","@marital4";&
$maritalb=1,2,3,4;
if $maritala
t [9211.1$]="$maritalb"
endif
>endrep
 
 
>rep$ethnica="@ethnic1","@ethnic2","@ethnic3","@ethnic4";&
$ethnicb=1,2,3,4;
if $ethnica
t [9221.1$]="$ethnicb"
endif
>endrep
 
>rep$edua="@edu1","@edu2","@edu3","@edu4","@edu5";&
$edub=1,2,3,4,5;
if $edua
t [9231.1$]="$edub"
endif
>endrep
 
 
 
>ifdef @bothrange
    >rep $inca=1,2,3,...,9,0; &
    $incb=@inc1min,@inc2min,@inc3min,@inc4min,@inc5min,@inc6min,@inc7min,@inc8min,@inc9min,@inc0min;&
   $incc=@inc1max,@inc2max,@inc3max,@inc4max,@inc5max,@inc6max,@inc7max,@inc8max,@inc9max,@inc0max;
        >rep$agea=1,2,3,...,9,0; &
        $ageb=@age1min,@age2min,@age3min,@age4min,@age5min,@age6min,@age7min,@age8min,@age9min,@age0min;&
       $agec=@age1max,@age2max,@age3max,@age4max,@age5max,@age6max,@age7max,@age8max,@age9max,@age0max;
           if [@incomeloc^$inca] and [@ageloc^$agea]
                PRT"=""\s"",""\s"",""\s/\s/\s"",""\s:\s"",""\s"",""\s"",""$incb"",""$incc"",""$ageb"",""$agec"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",=""\s"",=""\s"",""\s"",""\s"",=""\s"""&
               @fone @job @month @day @year @hour @min @length @lang @gender @numinhh[9201.1$] [9211.1$]  [9221.1$]  [9231.1$] @name @zip @fips @county@state @dma
            endif
        >endrep
    >endrep
>endif
 
 
>ifdef @agerange
    >rep $agea=1,2,3,...,9,0; &
    $ageb=@age1min,@age2min,@age3min,@age4min,@age5min,@age6min,@age7min,@age8min,@age9min,@age0min;&
   $agec=@age1max,@age2max,@age3max,@age4max,@age5max,@age6max,@age7max,@age8max,@age9max,@age0max;
        if[@ageloc^$agea]
            PRT"=""\s"",""\s"",""\s/\s/\s"",""\s:\s"",""\s"",""\s"",""\s"",""\s"",""$ageb"",""$agec"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",=""\s"",=""\s"",""\s"",""\s"",=""\s"""&
           @fone @job @month @day @year @hour @min @length @lang @incomex @incomex @gender@numinhh [9201.1$] [9211.1$]  [9221.1$]  [9231.1$] @name @zip @fips@county @state @dma
        endif
    >endrep
>endif
 
 
 
>ifdef @incrange
    >rep $inca=1,2,3,...,9,0; &
   $incb=@inc1min,@inc2min,@inc3min,@inc4min,@inc5min,@inc6min,@inc7min,@inc8min,@inc9min,@inc0min;&
    $incc=@inc1max,@inc2max,@inc3max,@inc4max,@inc5max,@inc6max,@inc7max,@inc8max,@inc9max,@inc0max;
        if[@incomeloc^$inca]
            PRT"=""\s"",""\s"",""\s/\s/\s"",""\s:\s"",""\s"",""\s"",""$incb"",""$incc"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",=""\s"",=""\s"",""\s"",""\s"",=""\s"""&
           @fone @job @month @day @year @hour @min @length@lang @agex @agex @gender @numinhh [9201.1$] [9211.1$]  [9221.1$] [9231.1$] @name @zip @fips @county @state @dma
        endif
    >endrep
>endif
 
 
 
>ifdef @norange
    PRT"=""\s"",""\s"",""\s/\s/\s"",""\s:\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",=""\s"",=""\s"",""\s"",""\s"",=""\s"""&
    @fone @job @month @day @year @hour @min@length @lang @incomex @incomex @agex @agex @gender @numinhh [9201.1$][9211.1$]  [9221.1$]  [9231.1$] @name @zip @fips @county @state @dma
>endif
 
 
 
 
 
}
~EXC PROC=label
~END
 
 
   
   
   
Language Question  
Definition  
Response Codes “1 English” and “2 Spanish”  
   
Code to generate (where 499.1 is the location of the question.)  
>def @lang [499.1$]  
   
If no such question found, then generate  
>def @lang [9131.1$]  
   
   
   
Gender  
Definition  
Response Codes “1 Male” and “2 Female”  
   
Code to generate (where 901.1 is the location of the question)  
>def @gender [901.1$]  
   
If no such question found, then generate  
>def @gender [9101.1$]  
   
   
   
   
Marital Status  
Definition  
Response text includes any two of “Married”, “Divorced”, “Single”, “Widow”, “Widowed”  
   
Mapping  
@marital1 def should include codes with “Married” (unless preceded by the word “never” or “not”)  
@marital2 def should include codes with “Single”  
@marital3 def should include codes with the phrase “living with”  
@marital4 def should include codes with any of the following words “Separated”, “Divorced”, “Widow”, “Widowed”  
   
Code to generate (where 906.2 is the Q location, and the numbers following the # are the response codes that match, separated by comma. (preceding 0 is important to include in codes)  
The same response code should never be included in more than one definition.  If there is a conflict keep the first one.    
>def @marital1 [906.2#02]  
>def @marital2 [906.2#01]  
>def @marital3 [906.2#03]  
>def @marital4 [906.2#04,05]  
   
   
If no such question found, then generate (or if no response codes found for a particular line, use this)  
>def @marital1 [1^b]  
>def @marital2 [1^b]  
>def @marital3 [1^b]  
>def @marital4 [1^b]  
   
   
   
   
   
Ethnicity  
Definition  
Response text includes any two of “Caucasian”, “African-American”, “African American”, “Hispanic”, “Asian”  
   
Mapping  
@ethnic1  = “Caucasian” or “White”  
@ethnic2  = “African-American” or “African American” or “Black”  
@ethnic3  = “Hispanic”  
@ethnic4 = “Asian” or ”Oriental” or “Indian” or “Native American” or “other” or “Samoan”  
   
Code to generate (where 901.1 is the Q location, and the numbers following the # are the response codes that match, separated by comma. (preceding 0 is important to include in codes)  
>def @ethnic1 [901.1#1]  
>def @ethnic2 [901.1#2]  
>def @ethnic3 [901.1#3]  
>def @ethnic4 [901.1#4,5,6]  
   
If no such question found, then generate (or if no response codes found for a particular line, use this)  
>def @ethnic1 [1^b]  
>def @ethnic2 [1^b]  
>def @ethnic3 [1^b]  
>def @ethnic4 [1^b]  
   
   
   
   
Education  
Definition  
Response text includes any two of “College”, “High School”, “graduate”, “degree”  
   
Mapping  
@edu1 = “Some High School” or “Grade School”  
@edu2 = “High School” (not preceded by “some”)  
@edu3 = “Some College”  or “2 year” or “two year” or “Associates”  
@edu4 = “graduated college” or “college graduate” or “4 year” or “four year” or “bachelors” or (“college” if no other response code contains “college”)  
@edu5 = “Post Graduate” or “Masters” or “doctorate” or “phd”  
   
Code to generate (where 910.2 is the Q location, and the numbers following the # are the response codes that match, separated by comma. (preceding 0 is important to include in codes)  
>def @edu1 [910.2#01,02]  
>def @edu2 [910.2#03]  
>def @edu3 [910.2#04]  
>def @edu4 [910.2#05,06]  
>def @edu5 [910.2#07]    
   
If no such question found, then generate (or if no response codes found for a particular line, use this)  
>def @edu1 [1^b]  
>def @edu2 [1^b]  
>def @edu3 [1^b]  
>def @edu4 [1^b]  
>def @edu5 [1^b]  
   
   
   
   
Children in Household  
Definition  
If the question text contains…  
(“how many children” or “have any children” or “have children” or “children living”) (any of those could have “kids” instead of “children”)  
And also contains ”household” or “living with you” or “living at home”  
   
Mapping  
There are different ways this question is done.  Sometimes it is yes/no – in which case the mapping is obvious.  
   
The other type is where is asks how many.  And in that case there are two ways it is done.  If the question is of “!NUM” type – then you can take the location, and assume that “0” or “00” (depending on width) defines no, and that “01-20” or “1-7”  defines yes (so if 2 digit width, use “20” for high end, and if 1 digit width use “7” for high end)  
   
The other way, is when they ask how many, and there are response codes just like normal questions.    
So the no would be whatever code includes “none” or “0” – (if there is no such code then the def should look like [701.1^b] or [701.2^^b] (where 701.1 or 701.2 is the Q location)  
And the yes would be defined as any code whose text includes a numerical number 1-20 or the spelled out versions one, two, three, etc.  
This can be expressed as “[701.1#1-7]” or “[701.1#1,2,3,4,5,6,7}”  
   
   
Code to generate examples  
If it was a yes no type deal then it will probably look something like this  
>def @childhhyes [701.1#1]  
>def @childhhno [701.1#2]    
   
If it was a question with open ended numerical response (!NUM) or if the response codes were numerical then it will look something like this  
>def @childhhyes [701.2#01-20]  
>def @childhhno [701.2#00]    
   
If no such question found, then generate (or if no response codes found for a particular line, use this)  
>def @childhhyes [1^b]  
>def @childhhno [1^b]    
   
   
   
   
   
Zip code  
Definition  
Question text contains “zip code” and the question type is “!NUM” (You would see “!NUM” at the beginning of a line in that question)  
And the length (the part after the dot in the question location) is 5, 9, or 10  
   
   
Code to generate (where 801.5 is the Q location)  
>def @zip [801.5$]  
   
If no such question found, then  
>def @zip [9101.5$]  
   
   
   
   
Age and income questions are a bit different.  Usually they are asked as ranges.  With response codes having a range like 18-24, 25-34, etc.    
Sometimes they are asked as exact numbers.   In which case the question type will be “!NUM” instead of “!FLD”  
   
Of course sometimes one or both are not asked at all.   So depending on what the case is – a single one of the following should be generated.    
   
>def @bothrange    ''we have both income and age, and they are both ranges  
''>def @agerange  ''age is a range and income is exact or unknown  
''>def @incrange  ''income is a range and age is exact or unknown  
''>def @norange         ''both income and age are either exact or unknown  
   
Then the following code should be generated exactly as shown.  (Unless an exact age or income is known, in which case the location of that question should be used instead of the default location)  
>def @agex [9101.3$]  
>def @incomex [9101.7$]  
   
   
   
Age  
Definition  
Question text include “have your age” or “how old are you” or “reach your age” or “represents your age”  
OR  
If the response text includes any of the following  
“18-24”  
“25-34”  
“25-29”  
“65 or older”  
   
Mapping  
In the generated code we are going to set one define to the location of the question, and then we are going to set high and low defines for each code.  Basically mapping the range that the code applies to.  
   
So for @age1min – we put the low value for whatever code 1 was, and so on.  
   
For any response codes that we are unable to determine a high and low for then just define as “”  
   
Notice the response text may look like “18-24” or “18 – 24” or  “18 to 24” or “18 to less than 24” or “18-24,” or “18-24, or” – I think a regex can be used to pretty universally fit any similar variation.  
   
Also – almost always the final category will be something like “65 or older” – assign this as 65-120.  
   
   
Code to generate  
   
>def @ageloc 1001  
>def @age1min 18  
>def @age1max 24  
>def @age2min 25  
>def @age2max 34  
>def @age3min 35  
>def @age3max 44  
>def @age4min 45  
>def @age4max 54  
>def @age5min 55  
>def @age5max 64  
>def @age6min 65  
>def @age6max 120  
>def @age7min "" 
>def @age7max "" 
>def @age8min "" 
>def @age8max "" 
>def @age9min "" 
>def @age9max "" 
>def @age0min "" 
>def @age0max "" 
   
If there is no such question or the age question is exact – then just generate default code like shown above.  And either the @incrange or @norange code mentioned in previous section should be used  
   
   
   
Income – will nearly the same as age – except its responses often include commas and $’s that will need to be removed before analyzing.    
   
Definition  
   
Code to generate  
   
   
   
   
   
Here is some additional stuff to be generated  
At the command line I will pass a single argument.  It will be the study code.  In all cases below where you see “h999” the study code should be put there.    
I will provide the exact names of the input and output files later – they will be the study code with some prefix, and suffix.  
Other than that most of this stuff will likely be static, and be the same for every file.  Though I might give some rules for filling @fone, @name, @choose and possibly @month through @length  
I have to see what the data maps look like for 3 years ago, to confirm if this fairly standard stuff was the same back then.      
   
   
>def @job "R_ABC_H999"  
>def @data /usr1/cfmc77/data/h999.tr  
>def @csv $h999mrfd.csv  
   
   
>def @fone [7001.10$]  
>def @name [9101.30$]  
>def @choose SELECT=[101.3#1]  
   
>def @month [189.2$]  
>def @day  [191.2$]  
>def @year [185.4$]  
>def @hour [193.2$]  
>def @min [195.2$]  
>def @length [178.6$]  
   
>def @numinhh [9101.1$]  
>def @fips [9101.5$]  
>def @county [9101.20$]  
>def @state [9101.2$]  
>def @dma [9101.3$]  
   
   
   
   
   
These two lines should precede everything else in the generated output.  They should be the first two lines in the file  
>PURGESAME  
>allow_indent  
   
   
   
   
   
The following should all be put at the end of the generated file.  After all the generated code.  This stuff is purely static, and the same in all files.  
   
>PRINTFILE @csv PAGELENGTH=25000 PAGEWIDTH=1200  
~SET -AUTOMATIC_NEW_PAGE  
~in @data @choose  
   
   
~DEF PROC=label:  
   
   
if firstcase then  
prt """Telephone Number"",""Job"",""Date of Complete"",""Time"",""Length"",""Language"",""Income Min"",""Income Max"",""Age Min"",""Age Max"",""Gender"",""Number of people in HH"",""Children in HH"",""Marital Status"",""Ethnicity"",""Education"",""Name"",""Zip"",""Fips"",""County"",""State"",""DMA"""  
ENDIF  
   
blank [9101.200]  
t [9131.1$]="1"  
   
   
   
   
>rep $childa="@childhhyes","@childhhno"; & 
$childb=1,2;  
if $childa  
t [9201.1$]="$childb"  
endif  
>endrep  
   
>rep $maritala="@marital1","@marital2","@marital3","@marital4"; & 
$maritalb=1,2,3,4;  
if $maritala  
t [9211.1$]="$maritalb"  
endif  
>endrep  
   
   
>rep $ethnica="@ethnic1","@ethnic2","@ethnic3","@ethnic4"; & 
$ethnicb=1,2,3,4;  
if $ethnica  
t [9221.1$]="$ethnicb"  
endif  
>endrep  
   
>rep $edua="@edu1","@edu2","@edu3","@edu4","@edu5";
$edub=1,2,3,4,5;  
if $edua  
t [9231.1$]="$edub"  
endif  
>endrep  
   
   
   
>ifdef @bothrange  
    >rep $inca=1,2,3,...,9,0; & 
    $incb=@inc1min,@inc2min,@inc3min,@inc4min,@inc5min,@inc6min,@inc7min,@inc8min,@inc9min,@inc0min;
    $incc=@inc1max,@inc2max,@inc3max,@inc4max,@inc5max,@inc6max,@inc7max,@inc8max,@inc9max,@inc0max;  
        >rep $agea=1,2,3,...,9,0; & 
        $ageb=@age1min,@age2min,@age3min,@age4min,@age5min,@age6min,@age7min,@age8min,@age9min,@age0min;
        $agec=@age1max,@age2max,@age3max,@age4max,@age5max,@age6max,@age7max,@age8max,@age9max,@age0max;  
            if [@incomeloc^$inca] and [@ageloc^$agea]  
                PRT "=""\s"",""\s"",""\s/\s/\s"",""\s:\s"",""\s"",""\s"",""$incb"",""$incc"",""$ageb"",""$agec"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",=""\s"",=""\s"",""\s"",""\s"",=""\s""" & 
                @fone @job @month @day @year @hour @min @length @lang @gender @numinhh [9201.1$] [9211.1$]  [9221.1$]  [9231.1$] @name @zip @fips @county @state @dma  
            endif  
        >endrep  
    >endrep  
>endif  
   
   
>ifdef @agerange  
    >rep $agea=1,2,3,...,9,0; & 
    $ageb=@age1min,@age2min,@age3min,@age4min,@age5min,@age6min,@age7min,@age8min,@age9min,@age0min;
    $agec=@age1max,@age2max,@age3max,@age4max,@age5max,@age6max,@age7max,@age8max,@age9max,@age0max;  
        if [@ageloc^$agea]  
            PRT "=""\s"",""\s"",""\s/\s/\s"",""\s:\s"",""\s"",""\s"",""\s"",""\s"",""$ageb"",""$agec"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",=""\s"",=""\s"",""\s"",""\s"",=""\s""" & 
            @fone @job @month @day @year @hour @min @length @lang @incomex @incomex @gender @numinhh [9201.1$] [9211.1$]  [9221.1$]  [9231.1$] @name @zip @fips @county @state @dma  
        endif  
    >endrep  
>endif  
   
   
   
>ifdef @incrange  
    >rep $inca=1,2,3,...,9,0; & 
    $incb=@inc1min,@inc2min,@inc3min,@inc4min,@inc5min,@inc6min,@inc7min,@inc8min,@inc9min,@inc0min;
    $incc=@inc1max,@inc2max,@inc3max,@inc4max,@inc5max,@inc6max,@inc7max,@inc8max,@inc9max,@inc0max;  
        if [@incomeloc^$inca]  
            PRT "=""\s"",""\s"",""\s/\s/\s"",""\s:\s"",""\s"",""\s"",""$incb"",""$incc"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",=""\s"",=""\s"",""\s"",""\s"",=""\s""" & 
            @fone @job @month @day @year @hour @min @length @lang @agex @agex @gender @numinhh [9201.1$] [9211.1$]  [9221.1$]  [9231.1$] @name @zip @fips @county @state @dma  
        endif  
    >endrep  
>endif  
   
   
   
>ifdef @norange  
    PRT "=""\s"",""\s"",""\s/\s/\s"",""\s:\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",""\s"",=""\s"",=""\s"",""\s"",""\s"",=""\s""" & 
    @fone @job @month @day @year @hour @min @length @lang @incomex @incomex @agex @agex @gender @numinhh [9201.1$] [9211.1$]  [9221.1$]  [9231.1$] @name @zip @fips @county @state @dma  
>endif  
   
   
   
   
   
}  
~EXC PROC=label  
~END  
   
XetroximynAuthor Commented:
@CEHJ:

Can you clarify what the problem with the spec seems to be?  Why could it not be implemented?

Below is a more detailed spec I am working on...
 

CEHJCommented:
>>Below is a more detailed spec I am working on...

Let me know when it's finalised. Whoever implements this will make it better for you if you formulate it as a flowchart, e.g. http://www.hollyfield.kingston.sch.uk/gcseit/GCSE/algoflow.htm Hint: in your case, there will be many Decision elements. Were i to do it myself, the flowchart would be a prerequisite
Mick BarryJava DeveloperCommented:
you haven;t answered the question?

> Can you clarify what the problem with the spec seems to be?  Why could it not be implemented?
XetroximynAuthor Commented:
@CEHJ -- I was thinking that each question type would be treated independently.  

So look for each question type independently.  

If the question of that type is not found -- write out the code specified for that.

When a question of a type is found.  Follow the process laid out to generate the code.  

I think when looking at in on a question by question the flow of logic is pretty straight forward.   By all means though -- you will likely notice things that seem unlcear -- if you tell what seems unclear or give an example, I think I could clarify.  


CEHJCommented:
>>@CEHJ -- I was thinking that each question type would be treated independently.  

That's fine, and that would also be reflected in one flowchart
XetroximynAuthor Commented:
Unless a flow chart is needed because of  a lack of clarity in the text spec -- I feel it is counter-intuitive.  

A flow chart limits the project to a single implementation possibility.   Since I am not the one programming it, I dont know what methods are the easiest for you guys to program.  

For instance, one could make an entire pass through the input file for each question type, or one could make one pass and check for each question type at each question they find.  Either way works just the same -- BUT One might be easier and more intuitive to program.  And I would not know which one.  

A flow chart would be making me there person deciding exactly HOW the program achieved the ends.  But I feel the programmer is the person best to decide that.  Since they know what is easy and what is counter productive.  

 What I care about are the ENDS.  I define the ENDS the program should get to.   And the programmer decides the best way to make that happen.  

Or is my thinking on the matter totally out of line?


If something is unclear about the text spec -- by all means ask me to clarify.   It is very unlikely I am going to make a flow chart for this.  
(If you wanted to offer a quote, and we chose you and you wanted to make a flow chart for approval to confirm the scope was very clear...  we could do something like that)




CEHJCommented:
>>A flow chart limits the project to a single implementation possibility.

A flow chart doesn't have anything to do with an implementation - it describes a procedure
Mick BarryJava DeveloperCommented:
flow charts are so yesterday :-D (and inappropriate)
XetroximynAuthor Commented:
OK -- so it limits the implementation to the specified procedure.  Even though it might be easier/quicker/more intuitive in the used language, to program it using a different procedure the yields the same end results.

I can totally see how flow charts are probably really needed in a lot of situations.  

I just don't feel that this project necessitates one.  If you let me know what is so unclear about the text spec that makes you feel a flow chart would clarify -- please let me know.  
Even if you are not interested in doing the project yourself -- I would find it helpful to have feedback as to what might be unclear in the text spec -- it is still a work in progress, so any input on what is unclear from third perspective would be great.





CEHJCommented:
Well i think i've said enough above, but feel free to contact me via my profile
XetroximynAuthor Commented:
Thanks!
mrcoffee365Commented:
I think CEHJ did the work here, but thanks for the points, and good luck!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.