ADIF import and applying QSL_VIA field from Manager Database

8 posts / 0 new
Last post
DL3LAR
ADIF import and applying QSL_VIA field from Manager Database

Hello,

cqrlog has a wonderful QSL Manager database.

However, when I'm importing a N1MM-contest log via ADIF Import, QSL_VIA field is left empty.

Is there some way to apply QSL_VIA field automatically from cqrlog's manager database for a filtered list of qso's after having them imported ?

73 de Rolf, DL3LAR

oh1kh
ADIF import and applying QSL_VIA field from Manager Database

HI Rolf!

Have you tried "ADIF remote" with N1MM.
It should import qsos "on fly" to cqrlog. And I think then also Callbook support and qsl via would be filled.

I am not sure as I do not have N1MM to test. While developing adif remote I did have N1MM installed via Wine (but did not have proper skills to use it).
And I have forgotten does it pull callbook and qsl via when adding a qso. But I guess it is so (easy to check from source, or with N1MM test)

--
Saku
OH1KH

oh1kh
ADIF import and applying QSL_VIA field from Manager DatabaseADIF

Hi Rolf!

I checked few things.
Now I understand your problem better. After import you can see qsl manager with "QSO list/View QSO" . It looks like everything is OK but if you export qsl labels the "QSL manager" will be empty as the manager is searched only for QSO view time.

If you assign N1MM so that it sends every qso with UDP to 127.0.0.1 port 2333 and you have same IP and port at preferences/fldigi/wsjtx interface's "ADIF remote" settings then you sould be able to add N1MM logged qsos
"on fly" to cqrlog by setting ADIF remote (Ctrl+K) on.

If you have callbook support set at preferences and preferences/NewQSO has "Enable auto search on HamQTH/QRZ" checked the callsign info is added to qso with qsl manager info.
If you do not want callbook info just uncheck "Enable auto search on HamQTH/QRZ" and only qsl manager info is added from internal database (this is a bit faster).

Then I also checked what if contest is already worked and there is just an adif file to import. It can be "imperted" but a bit complicated way. How ever at the moment this is the quick fix for this problem.

If contents of that adif file is pushed via "ADIF remote" call book and qsl mgr info can be added.
But for that a special format of adif file is needed and a script that feeds qso records via UDP.

ADIF remote expects one qso record to be one UDP message. For easy script that means that one qso recored must be in one line (we read adif file line by line)
Every qso must beigin with header and end to EOR.

At the moment I do not know what is the N1MM adif file format. I tested with cqrlog's own adif file and it, unfortunately, has "<EOF>" tag on different line than all other qso record data. Then we also need the header to every qso record.
Both can be fixed quick with "sed" command.

We just have to check first what is the first adif data in qso record. Open adif fiel with text editor and find the header end "<EOH>" at the beginning of file. What comes after that is the start of a qso record.

With cqrlog exported qso record looks like this:

<QSO_DATE:8>20160121<TIME_ON:4>0945<STATION_CALLSIGN:5>OH1KH<CALL:4>4K9W<MODE:2>CW<FREQ:7>24.8944<BAND:3>12m
<EOR>

So the "<QSO_DATE:" starts one record. We need to add "<ADIF_VER:1>1<EOH>" before that to get header to every qso record. We do it with sed in command console.

sed -i s/\<QSO_DATE/\<ADIF_VER:1\>1\<EOH\>\<QSO_DATE/g n1mm.adi

Where adif version number is not mandatory and adif file name in this example is n1mm.adi. Now qso record looks like this:

<ADIF_VER:1>1<EOH><QSO_DATE:8>20160121<TIME_ON:4>0945<STATION_CALLSIGN:5>OH1KH<CALL:4>4K9W<MODE:2>CW<FREQ:7>24.8944<BAND:3>12m
<EOR>

If our qso record still has end of record in it s own line like this example we do another sed command:

sed -zi 's/\n/*/g;s/*<EOR>/<EOR>*/g;s/*/\n/g' n1mm.adi

In case of windows text file the "\n" may need to be replaced with "\n\r" or "\r\n" (no windoze here to test)
Now our qso record looks like this:
<ADIF_VER:1>1<EOH><QSO_DATE:8>20160121<TIME_ON:4>0945<STATION_CALLSIGN:5>OH1KH<CALL:4>4K9W<MODE:2>CW<FREQ:7>24.8944<BAND:3>12m<EOR>
(This is actually one line even it shows here in forum as multi line chapter)

Then it is time to make a script. For UDP messages we need command "nc" or "ncat" (depends on linux) If it does not exist the package ncat or netcat must be installed first.

With text editor we make a script file called adifremote.sh that has contents:

#!/bin/bash
while IFS='' read -r LinefromFile || [[ -n "${LinefromFile}" ]]; do

echo ${LinefromFile} | nc -u 127.0.0.1 2333
sleep 1

done < "$1"

Save and give execution rights to everyone:
chmod a+x adifremote.sh

Then we put cqrlog to ADIF remote with Ctrl+K (or from menu NewQSO/file/ADIF remote) and start the script with file name.
./adifremote.sh n1mm.adi

It should now feed one qso per second from file to cqrlog. It is a bit slow because ADIF export does check new UDP record once a second and it is not wise to feed qso records faster than that because adding qso also takes time. Specially when HamQTH/QRZ data is added. But should do the job.

--
Saku
OH1KH

oh1kh
ADIF import and applying QSL_VIA field from Manager Database

If imported qso is viewed it will have QSL manager visible if it exist. How ever it is not saved to qso record unless you take qso to edit mode and then save it.

I have made a pull request for fix that checks QSL manager database for possible manager for callsign when qsl labels are printed in case qsl manager field is empty.

I think (I do not use labels) this fixes the biggest problem with elsewhere adif imported qsos.

--
Saku
OH1KH

DL3LAR
ADIF import and applying QSL_VIA field from Manager Database

Hi Saku !

Thanks a lot for your information. I've read before about "ADIF remote" while searching for some hints or solution for my usecase.
But I haven't tried it until now.

Most of the contests, I'm logging with N1MM (one of two programs, where I use windows) on a laptop. VHF/UHF contest I participate from a nearby hill with my portable station. So, there is no desktop-pc with cqrlog available where I could use "ADIF remote".

In your reply you mentioned, you don't know N1MM Adif Format. Here's a cutout, how it starts. Every QSO is seperated with EOR.


ADIF Export from N1MMLogger.net - Version 1.0.9324.0
Built: 02.11.2021 11:51:10
DP4B logs generated @ 2021-11-07 16:31:48Z
Contest Name: VHFREG1 - 2021-11-05
[EOH]
[CALL:5]DJ0WW [QSO_DATE:8]20211106 [TIME_ON:6]140952 [TIME_OFF:6]140952 [BAND:2]2M [STATION_CALLSIGN:4]DP4B [FREQ:9]144.08187 [CONTEST_ID:9]VHF-REG-1 [FREQ_RX:9]144.08187 [MODE:2]CW [RST_RCVD:3]599 [RST_SENT:3]599 [TX_PWR:3]100 [OPERATOR:4]DP4B [GRIDSQUARE:6]JO40CF [SRX:1]7 [CQZ:2]14 [STX:1]1 [APP_N1MM_POINTS:3]283 [APP_N1MM_RADIO_NR:1]1 [APP_N1MM_MISCTEXT:3]216 [APP_N1MM_CONTINENT:2]EU [APP_N1MM_RUN1RUN2:1]1 [APP_N1MM_RADIOINTERFACED:1]1 [APP_N1MM_ISORIGINAL:4]True [APP_N1MM_NETBIOSNAME:15]DESKTOP-FNJKLB2 [APP_N1MM_ISRUNQSO:1]0 [PFX:3]DJ0 [APP_N1MM_MULT1:1]0 [APP_N1MM_MULT2:1]0 [APP_N1MM_MULT3:1]0 [APP_N1MM_ID:32]773817b596af4c85815f7abd68485bfc [APP_N1MM_CLAIMEDQSO:1]1 [EOR]

(remark: I wasn't able to post the adif code from N1MM export files originally, so I replaced '<','>' with '[',']' )

Don't know, if this helps. I could also send you some full contest log, if you need it.
It seems to me, N1MM is using own labels "APP_N1MM_something" to extend ADIF range for points, multis, and so on.

I haven't followed your instructions so far, but this weekend, I'm participating the DARC VHF-, UHF-, MW-Contest, so I've available a new log by next week to give it a try.
However, a more convinient way would be an import option with the ADIF import of cqrlog, like a checkbox for "align with managers database".

In my opinion this would fit more the usecase than checking the database while exporting labels.
Thanks again for your great support !

73 de Rolf, DL3LAR

oh1kh
ADIF import and applying QSL_VIA field from Manager Database

HI Rolf!

If the N1MM record is one line from CALL to EOR you just need to add header to every qso record for input via script/adif remote. (it can not be seen here when pasted to forum message)
But in this case N1MM seems to start a record with CALL where cqrlog adif starts with qso_date.

Then the sed command changes like this:
sed -i s/\<CALL/\<ADIF_VER:1\>1\<EOH\>\<CALL/g n1mm.adi

That should add header adif_ver to every qso record.

The EOR seems to be on same line, so that is OK.

If there is a selection in N1MM that leaves app_n1mm based adif tags away (plain adif export selection) you should use it as it drops over half of record length away.

Adding the qso with manager lookup to adif import is as easy as to qsl label printing. There is ready build function for that.
Perhaps it could be added as checkbox selection as it will slow down import process that is already slow if duplicate checking is used with huge adif files.

But on the other hand if you open any of your imported qsos ( view qso or edit qso) cqrlog will check the qsl manager at that phase. I think this solution is better because if manger changes, or a call that did not have manager gets one, the manager information is always up to date this way. Thanks for Martin, OK1RR, who keeps manager and dxcc lists up to date on regular basis.

Based on same thinking I added manager check to label printing phase rather than to adif import.

------
I give one option more for you:
If you have only windoze running laptop there is a CMD based NCAT also for windows. https://nmap.org/ncat/
I do not know if this work but suggestion is as follows:

Configute N1MM to send UDP remote datagram for every qso logged to IP 127.0.0.1 port 2333
install NCAT for windows and open command console and give command:

ncat --exec "" -lkuo /tmp/test.adi 127.0.0.1 2333

Change /tmp/test.adi to something suitable for windoze (C:\WINDOWS\TEMP\TEST.ADI ??)
--exec "" with linux gives an error, but command ncat keeps on running (how windoze?)
Other parameters are:
l = listen
k= keep on running
u= use UDP
o= output to file

Stop with Ctrl+C after contest. It should collect all N1MM logged qsos in the format that is suitable for cqrlog adif remote. You just need to feed the file with script described before.

With my test ncat in linux it worked perfectly.

--
Saku
OH1KH

k8wdx
What if you filtered the

What if you filtered the contacts then did database update?

Tom K8WDX

oh1kh
What if you filtered the

HI Tom!

Caalbook/Database update does not update qsl managers.
But you can not see that because if you view qso the QSL manager is added then.

The way to test it is:
create a new log. Set QRZ or HamQTH username and password.
Add one qso with callsign that has qsl manager. Ex: YL7X
before saving qso clean qsl via field from new qso.
Check qso with Filter/SQL console using command:
select callsign,qsl_via from cqrlog_main
You see that there is nothing in qsl_via
Close sql console and do callbook/database update
Open SQL console again and execute same command, sill no qsl_via.
Close SQL console and view qso. QSL manager appears then but still does not appear to database "qsl_via" (check with SQL console).
Open qso for edit. QSL manager appears. Save qso. Then see with SQL console. Now the qsl_via is filled.

Good or bad?

If ADIF imported qso is not opened for edit there will not be QSL manager info.
Later time when QSL labels are printed callsigns qsl manager may have changed. So it is good that it is not set at ADIF import phase.
After latest fix qsl manager is now checked at label printing time if qsl_via column is empty.
Maybe this way the latest manager info is added to label at printing phase if qsl manager is checked to be printed.
Even at that time it is not added to qso data, just to the label.

So you see it with view qso and get it to qsl label.
And it is always latest information, thanks for Martin, OK1RR, who maintains the cqrlog's qsl manager and dxcc databases.

--
Saku
OH1KH