Hello team
I want to implement soundex phonetic on firstname and doublemetaphone on lastname.Is this possible.Any help would really be appreciated
Many Thanks
Hello team
I want to implement soundex phonetic on firstname and doublemetaphone on lastname.Is this possible.Any help would really be appreciated
Many Thanks
Welcome to the community, @danoti! Could you provide an example that supports your issue so that the community would be able to help you if itâs possible?
Many thanks @Kal_Lam
I want to generate a unigue identifier from
<soundex(fname)><double_metaphone(lname)><dob(yyyymmdd)>
for example
gender=M
soundex(firstname)=J500
doubleMetaphone(lastname)=KHNT
dob(yyyymmdd)= 19990203
pkv=<soundex(fname)><double_metaphone(lname)><dob(yyyymmdd)>
pkv= MJ500KHNT19990203
You could do this by following the post discussed in our previous post:
many thanks @Kal_Lam
What I need is a specific unique identifier pkv
pkv=gender+soundex(firstname)+doubleMetaphone(lastname)+dob
pkv should be something like FA500AP19870615
var soundex = require(âsoundex-codeâ) //include the soundex library
var doubleMet= require(âdouble-metaphoneâ) //include the double metaphone library
var gender=âMâ //gender can be Male M, Female F,
var dob=â19990203â //date of birth is in YMD format
var fname=soundex(âjohnâ) //apply soundex to the first name
var lname=doubleMet(âachiengâ) //apply double-metaphone to the last name
var PKV1=gender+fname+lname[0]+dob //use the first metaphone for the last name
var PKV2=gender+fname+lname[1]+dob //use the second metaphone for the last name
Many thanks @Kal_Lam
I need something like this
soundex(fname)=E520
doubleMetaphone(lname)=AK,AK
@danoti, did you try the workaround shared above? Let us know the place where you were stuck.
Am trying to find a code that would help me implement this in kobo collect
Any help will highly be appreciated
const express = require(âexpressâ)
const app = express()
const morgan = require(âmorganâ)
const bodyParser = require(âbody-parserâ)
app.use(morgan(âshortâ))
app.use(express.static(â./publicâ))
app.use(bodyParser.urlencoded({extended: false}))
const sqlite = require(âsqlite3â).verbose()
let db = new sqlite.Database(â./encode.dbâ)
let soundex = require(âsoundex-codeâ) //include the soundex library
let doubleMet= require(âdouble-metaphoneâ) //include the double metaphone library
app.post(â/createâ, (req, res) =>{
let gender = req.body.gender
let dob = req.body.dob
//let fname = soundex(âreq.body.fnameâ)
//let lname = doubleMet(âreq.body.lnameâ)
let fname = soundex(req.body.fname)
let lname = doubleMet(req.body.lname)
let pkv1 = gender+fname+lname[0]+dob
let pkv2 = gender+fname+lname[1]+dob
db.run("INSERT into customer(gender, dob, fname, lname, pkv1, pkv2) values('"+gender+"', '"+dob+"', '"+fname+"','"+lname+"', '"+pkv1+"','"+pkv2+"')",function(err,row){
if(err){
console.log(err.message)
}
console.log("Entry added to table")
res.send("New Customer has ben added")
});
res.end()
})
app.get("/", (req, res)=> {
console.log(âResponding to root routeâ)
res.send(âHello from Roootâ)
})
app.get("/users", (req, res) => {
let db = new sqlite.Database(â./encode.dbâ)
db.all(âSELECT * FROM customerâ, (err, rows, fields) =>{
console.log(âI think the data was Fetchedâ)
res.json(rows)
})
})
app.listen(3003, () => {
console.log(âServer is up and listening on 3003âŚâ)
})
//npm install double-metaphone
// npm install soundex-code
// npm i body-parser
// npm install sqlite3
// sudo npm i -g nodemon
// npm install express
// npm init -y
// node app.js
Link to guide on what I request help on
Fast Double Metaphone algorithm. Contribute to words/double-metaphone development by creating an account on GitHub.
A snippet of my case. I have hardcoded the variable data values but the expectation is that they be drawn from the participant through kobo collect
var soundex = require(âsoundex-codeâ) //include the soundex library
var doubleMet= require(âdouble-metaphoneâ) //include the double metaphone library
var gender=âMâ //gender can be Male M, Female F, or Other O, or Unknown U
var dob=â19990203â //date of birth is in YMD format
var fname=soundex(âjohnâ) //apply soundex to the first name
var lname=doubleMet(âachiengâ) //apply double-metaphone to the last name
var PKV1=gender+fname+lname[0]+dob //use the first metaphone for the last name
var PKV2=gender+fname+lname[1]+dob //use the second metaphone for the last name
You can test your code on runkit (RunKit)
From the odk-x survey a user inputs this data
First Name Last Name Gender DOB gender
JOHN KAHINDI M 1999-02-03 M
The input is subjected to the phonetic algorithmn
To get
The PKV flag potential duplicates at facility level and merge multiple records from the same individual at central level. Itâs used for deduplication
The database should have
Summary of what I want
I have kobo collect configured with these variables( firstname, lastname, gender, DOB).Identifiers such as name should be anonymized such that the data leaving the facility(data on the tablet) should bear phonetics rather than the actual names. patient PII (name) should not leave the health facility for privacy/data security concerns
Hi @danoti
I have seen you had asked the same question sometime back in 2020 within the ODK forum. I have done some extensive search to see if anyone has been able to implement this; unfortunately, there is very little information around the implementation of the same as a direct form function. I have also tried playing with the code on other environments and unfortunately, we are not able to execute this.
I will leave this for other users to potentially chime on it. Pinging some, for now, @wroos @Xiphware @Josh
Stephane
Many many thanks @stephanealoo
Hi @danoti, from what I understand, it doesnât seem like your requirements are possible â I could be missing the point here. Unfortunately you are confined by the XLSForm standards in what you can do without the data leaving the device. Perhaps encrypting the data may help with the âprivacy/data security concernsâ and allow you to perform this transformation off-device? It seems like your proposed âphoneticâ id could still be used to deanonymize patients if thatâs something of concern.