Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hotosm/osm-fieldwork
Browse files Browse the repository at this point in the history
Sync with main.
  • Loading branch information
rsavoye committed Jan 1, 2024
2 parents d3e1713 + 568e4d0 commit 2ebf64a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ FROM runtime as ci
ARG PYTHON_IMG_TAG
COPY --from=extract-deps \
/opt/python/requirements-ci.txt /opt/python/
RUN mv /root/.local/bin/* /usr/local/bin/ \
&& mv /root/.local/lib/python${PYTHON_IMG_TAG}/site-packages/* \
RUN cp -r /root/.local/bin/* /usr/local/bin/ \
&& cp -r /root/.local/lib/python${PYTHON_IMG_TAG}/site-packages/* \
/usr/local/lib/python${PYTHON_IMG_TAG}/site-packages/ \
&& set -ex \
&& apt-get update \
Expand All @@ -206,7 +206,7 @@ RUN mv /root/.local/bin/* /usr/local/bin/ \
&& pip install --upgrade --no-warn-script-location \
--no-cache-dir -r \
/opt/python/requirements-ci.txt \
&& rm -r /opt/python \
&& rm -r /opt/python && rm -r /root/.local \
# Pre-compile packages to .pyc (init speed gains)
&& python -c "import compileall; compileall.compile_path(maxlevels=10, quiet=1)"
# Override entrypoint, as not possible in Github action
Expand Down
27 changes: 27 additions & 0 deletions osm_fieldwork/OdkCentral.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,33 @@ def publishForm(
log.info(f"Published {xform} on Central.")
return result.status_code


def form_fields(self,
projectId:int,
xform:str):

"""
Retrieves the form fields for a xform from odk central.
Args:
projectId (int): The ID of the project on ODK Central
xform (str): The XForm to get the details of from ODK Central
Returns:
dict: A json object containing the form fields.
"""

if xform.find("_") > 0:
xid = xform.split('_')[2]
else:
xid = xform

url = f"{self.base}projects/{projectId}/forms/{xid}/fields?odata=true"
result=self.session.get(url, auth=self.auth)
return result.json()


def dump(self):
"""Dump internal data structures, for debugging purposes only."""
# super().dump()
Expand Down

0 comments on commit 2ebf64a

Please sign in to comment.