Adding the Genericode documents to the classes
skinkie opened this issue · comments
Would it be possible to add the "Genericode" namespace for CodeList to the project as well? While the file format is quite trivial, having the values available could be quite nice. This question might be a bit ambiguous, ideally I would start with parsing the Genericode documents. But I think it would certainly make sense to automatically generate for example all possible QuantityTypes, or something like QuantityTypeUnitCodeEnumeration.
I guess you mean the *codelist projects. They contain all the Genericode lists as classes/enums.
Or what exactly do you have in mind?
@phax am I missing a repository of you?
@phax Was this the intended syntax?
QuantityType quantityType5 = new QuantityType();
quantityType5.setUnitCode(EUnitOfMeasureCode21.LH.toString());
quantityType5.setValue(BigDecimal.valueOf(5));
Personally I think it would be nice to have QuantityType statically initialised with the different variants, so AgencyName and AgencyID are also added. I'll see if I can make a first contribution here :-)
List<QuantityType> quantityTypeList = cd.getSimpleCodeList().getRow().stream()
.map(row -> {
Optional<Value> value = row.getValue().stream().filter(e -> ((Column) e.getColumnRef()).getShortName().getValue().equals("Code")).findAny();
if (value.isPresent()) {
QuantityType quantityType = new QuantityType();
quantityType.setUnitCodeListID(unitCodeListID);
quantityType.setUnitCodeListAgencyID(agencyId);
quantityType.setUnitCodeListAgencyName(agencyName);
quantityType.setUnitCode(value.get().getSimpleValue().getValue());
return quantityType;
}
return null;
})
.filter(Objects::nonNull)
.collect(Collectors.toList());