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

K-API Feature: IFM Analysis query #60

Closed
2 tasks done
chrisdicaprio opened this issue Nov 14, 2022 · 0 comments
Closed
2 tasks done

K-API Feature: IFM Analysis query #60

chrisdicaprio opened this issue Nov 14, 2022 · 0 comments
Assignees

Comments

@chrisdicaprio
Copy link
Collaborator

chrisdicaprio commented Nov 14, 2022

We want an API query for logic tree components.

API examples:

note that value and value_options fields are encoded as JSON-String types. This is done because the types vary and this is not easily handled in graphql.

get Model options

using source_logic_tree_spec field we can find the options applicable to each fault system branch

query get_model_by_version {
  nzshm_model (version: "NSHM_1.0.0" ) {
    model {
      version
      title
      source_logic_tree_spec {
          fault_system_branches {
              short_name
              long_name
              branches {
                  name
                 long_name
                 value_options
              }
          }
       }
     }
   }
}

returns

{
  "data": {
    "nzshm_model": {
      "model": {
        "version": "NSHM_1.0.0",
        "title": "Initial version",
        "source_logic_tree_spec": {
          "fault_system_branches": [
            {
              "short_name": "PUY",
              "long_name": "Puysegur",
              "branches": [
                {
                  "name": "dm",
                  "long_name": "deformation model",
                  "value_options": "[\"0.7\"]"
                },
                {
                  "name": "bN",
                  "long_name": "bN pair",
                  "value_options": "[[0.902, 4.6]]"
                },
                {
                  "name": "C",
                  "long_name": "area-magnitude scaling",
                  "value_options": "[4.0]"
                },
                {
                  "name": "s",
                  "long_name": "moment rate scaling",
                  "value_options": "[0.28, 1.0, 1.72]"
                }
              ]
            },

... etc

2) get Source Logic Tree

using source_logic_tree field to obtain the complete SLT

query get_model_version {
  nzshm_model(version: "NSHM_1.0.0") {
    model {
      version
      title
      source_logic_tree {
        fault_system_branches {
          long_name
          short_name
          branches {
            weight
            inversion_solution_id
            inversion_solution_type
            onfault_nrml_id
            distributed_nrml_id
            values {
              long_name
              json_value
            }
          }
        }
      }
    }
  }
}

returns

{
  "data": {
    "nzshm_model": {
      "model": {
        "version": "NSHM_1.0.0",
        "title": "Initial version",
        "source_logic_tree": {
          "fault_system_branches": [
            {
              "long_name": "Puysegur",
              "short_name": "PUY",
              "branches": [
                {
                  "weight": 0.21,
                  "inversion_solution_id": "U2NhbGVkSW52ZXJzaW9uU29sdXRpb246MTE4NTQ2",
                  "inversion_solution_type": "ScaledInversionSolution",
                  "onfault_nrml_id": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjExODcxNw==",
                  "distributed_nrml_id": "RmlsZToxMzA3NTM=",
                  "values": [
                    {
                      "name": "dm",
                      "long_name": "deformation model",
                      "json_value": "\"0.7\""
                    },
                    {
                      "name": "bN",
                      "long_name": "bN pair",
                      "json_value": "[0.902, 4.6]"
                    },
                    {
                      "name": "C",
                      "long_name": "area-magnitude scaling",
                      "json_value": "4.0"
                    },
                    {
                      "name": "s",
                      "long_name": "moment rate scaling",
                      "json_value": "0.28"
                    }
                  ]
                },

etc...

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