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

FHIRPath cli output should indicate field names and hierarchy #2702

Closed
lmsurpre opened this issue Aug 18, 2021 · 1 comment
Closed

FHIRPath cli output should indicate field names and hierarchy #2702

lmsurpre opened this issue Aug 18, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@lmsurpre
Copy link
Member

lmsurpre commented Aug 18, 2021

Is your feature request related to a problem? Please describe.
I used the new(ish) FHIRPath cli jar to build up a complex FHIRPath expression.

One thing that would have helped me is to see the names of the fields in the objects that I was getting back as I build up the expression.

For example, while java -jar fhir-path-4.9.0-cli.jar --file bundle.json --path "Bundle.entry.resource.as(Claim) emits the selected resources as list of json objects, an expression like Bundle.entry.resource.as(Claim).item.detail emits a flattened list of just the leaf node values:

$ java -jar fhir-path-4.9.0-cli.jar --file bundle.json --path "Bundle.entry.resource.as(Claim).item.detail"  
http://example.com/fhir/CodeSystem/claim-item-detail-classification
dispensing-fee
1
http://hl7.org/fhir/sid/ndc
...

What I'd really like at this point is to know which fields those are and what, if any, hierarchy they have so that I can continue to expand on the FHIRPath from here.

Describe the solution you'd like
Use the FHIR model's toString for FHIRPath cli output that results from fhir-path FHIRElementNodes.

This approach would also have the benefit of helping users distinguish between FHIRElementNode results and FHIRPath primitive value results.

Describe alternatives you've considered
Use some other columnar output where the field names are listed with their path from the current location in the leftmost column.

path value
extension.url http://example.com/fhir/CodeSystem/claim-item-detail-classification
extension.value dispensing-fee
sequence 1
... ...

Acceptance Criteria

  1. GIVEN [a precondition]
    AND [another precondition]
    WHEN [test step]
    AND [test step]
    THEN [verification step]
    AND [verification step]

Additional context

@lmsurpre lmsurpre added the enhancement New feature or request label Aug 18, 2021
@lmsurpre lmsurpre self-assigned this Aug 19, 2021
@lmsurpre lmsurpre added this to the Sprint 2021-11 milestone Aug 19, 2021
lmsurpre added a commit that referenced this issue Aug 19, 2021
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
lmsurpre added a commit that referenced this issue Aug 19, 2021
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
lmsurpre added a commit that referenced this issue Aug 19, 2021
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
lmsurpre added a commit that referenced this issue Aug 19, 2021
* issue #2702 - use Element.toString to print element nodes

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>

* Update fhir-path/src/main/java/com/ibm/fhir/path/tool/Main.java

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
@prb112
Copy link
Contributor

prb112 commented Aug 23, 2021

Ran the following examples:

java -jar fhir-path/target/fhir-path-4.9.0-SNAPSHOT-cli.jar --path 'Bundle.entry.request.method' --file fhir-server-test/src/test/resources/testdata/everything-operation/Antonia30_Acosta403.json --pretty

java -jar fhir-path/target/fhir-path-4.9.0-SNAPSHOT-cli.jar --path 'Bundle.entry.request.method' --file fhir-server-test/src/test/resources/testdata/everything-operation/Antonia30_Acosta403.json

Shows field name and value
{
"code": "POST"
}

@prb112 prb112 closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants