Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the Genericode documents to the classes #28

Closed
skinkie opened this issue Jul 29, 2020 · 4 comments
Closed

Adding the Genericode documents to the classes #28

skinkie opened this issue Jul 29, 2020 · 4 comments
Assignees

Comments

@skinkie
Copy link
Contributor

skinkie commented Jul 29, 2020

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.

@phax
Copy link
Owner

phax commented Jul 29, 2020

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 phax self-assigned this Jul 29, 2020
@skinkie
Copy link
Contributor Author

skinkie commented Jul 29, 2020

@phax am I missing a repository of you?

@skinkie skinkie closed this as completed Jul 29, 2020
@skinkie
Copy link
Contributor Author

skinkie commented Jul 29, 2020

@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());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants