Question: Generalize Rule
NamUKF opened this issue · 2 comments
Hi,
i don't understand how to use the last generalize example.
How is
"$this.replaceMatches('(?<year>\\d{2,4})-(?<month>\\d{1,2})-(?<day>\\d{1,2})\\b', '${year}-${month}'"
a key value pair for the cases in the generalization method ? Ist straightup just a method with two params in it.
Other example make more sense:
"$this >= @2010-1-1": "@2010"
Where the key is clearly the condition and the value is target.
In the replaceMatches example the key-value pair of condition-target is not understandble, hence i don't know how to specify the JSON file appropriately.
In this case, if the value is yy-mm-dd or yyyy-mm-dd, then generalize to yy-mm or yyyy-mm respectively.
Hope this helps
Hi
i've found the solution to it some time ago. Please fix your READ.ME under
https://github.com/microsoft/Tools-for-Health-Data-Anonymization/blob/master/docs/FHIR-anonymization.md#generalize
The last row in the table is straight up wrong, and includes a typo. Furthermore, using the anonymization.yaml requires a double escaped description of the Regex param. Please add that to your docs.
Thanks ! :)
method: generalize
cases:
"true": "$this.toString().replaceMatches('\\\\b(?<year>\\\\d{2,4})-(?<month>\\\\d{1,2})-(?<day>\\\\d{1,2})\\\\b','${year}-${month}')"